@coalescesoftware/coa 7.23.0 → 7.23.2
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
|
@@ -124,7 +124,7 @@ ${t}`;return Object.assign(new Error(n),r,{stack:o})}XS.callErrorFromStatus=JAa;
|
|
|
124
124
|
`)+1))),this.lastActivityTimestamp=new Date}getChannelzInfo(){return{target:this.originalTarget,state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}}trace(t,n){(0,_rr.trace)(n??LRe.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,Rnt.uriToString)(this.target)+" "+t)}callRefTimerRef(){var t,n,i,o;!((n=(t=this.callRefTimer).hasRef)===null||n===void 0)&&n.call(t)||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(o=(i=this.callRefTimer).ref)===null||o===void 0||o.call(i))}callRefTimerUnref(){var t,n;(!this.callRefTimer.hasRef||this.callRefTimer.hasRef())&&(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(n=(t=this.callRefTimer).unref)===null||n===void 0||n.call(t))}removeConnectivityStateWatcher(t){let n=this.connectivityStateWatchers.findIndex(i=>i===t);n>=0&&this.connectivityStateWatchers.splice(n,1)}updateState(t){(0,_rr.trace)(LRe.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,Rnt.uriToString)(this.target)+" "+uM.ConnectivityState[this.connectivityState]+" -> "+uM.ConnectivityState[t]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+uM.ConnectivityState[t]),this.connectivityState=t;let n=this.connectivityStateWatchers.slice();for(let i of n)t!==i.currentState&&(i.timer&&clearTimeout(i.timer),this.removeConnectivityStateWatcher(i),i.callback());t!==uM.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(t){if(t>this.keepaliveTime){this.keepaliveTime=t;for(let n of this.wrappedSubchannels)n.throttleKeepalive(t)}}removeWrappedSubchannel(t){this.wrappedSubchannels.delete(t)}doPick(t,n){return this.currentPicker.pick({metadata:t,extraPickInfo:n})}queueCallForPick(t){this.pickQueue.push(t),this.callRefTimerRef()}getConfig(t,n){return this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector(t,n)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(t){this.configSelectionQueue.push(t),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState(uM.ConnectivityState.IDLE),this.currentPicker=new Wkn.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}startIdleTimeout(t){var n,i;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let s=new Date().valueOf()-this.lastActivityTimestamp.valueOf();s>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-s)},t),(i=(n=this.idleTimer).unref)===null||i===void 0||i.call(n)}maybeStartIdleTimer(){this.connectivityState!==uM.ConnectivityState.SHUTDOWN&&!this.idleTimer&&this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(t){this.channelzEnabled&&(t.code===LRe.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(t,n,i,o,s){let a=(0,Trr.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+a+'] method="'+n+'"'),new W2a.LoadBalancingCall(this,t,n,i,o,s,a)}createRetryingCall(t,n,i,o,s){let a=(0,Trr.getNextCallNumber)();return this.trace("createRetryingCall ["+a+'] method="'+n+'"'),new Brr.RetryingCall(this,t,n,i,o,s,a,this.retryBufferTracker,Mnt.get(this.getTarget()))}createInnerCall(t,n,i,o,s){return this.options["grpc.enable_retries"]===0?this.createLoadBalancingCall(t,n,i,o,s):this.createRetryingCall(t,n,i,o,s)}createResolvingCall(t,n,i,o,s){let a=(0,Trr.getNextCallNumber)();this.trace("createResolvingCall ["+a+'] method="'+t+'", deadline='+(0,G2a.deadlineToString)(n));let l={deadline:n,flags:s??LRe.Propagate.DEFAULTS,host:i??this.defaultAuthority,parentCall:o},u=new V2a.ResolvingCall(this,t,l,this.filterStackFactory.clone(),this.credentials._getCallCredentials(),a);return this.onCallStart(),u.addStatusWatcher(c=>{this.onCallEnd(c)}),u}close(){this.resolvingLoadBalancer.destroy(),this.updateState(uM.ConnectivityState.SHUTDOWN),clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,FRe.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels()}getTarget(){return(0,Rnt.uriToString)(this.target)}getConnectivityState(t){let n=this.connectivityState;return t&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),n}watchConnectivityState(t,n,i){if(this.connectivityState===uM.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let o=null;if(n!==1/0){let a=n instanceof Date?n:new Date(n),l=new Date;if(n===-1/0||a<=l){process.nextTick(i,new Error("Deadline passed without connectivity state change"));return}o=setTimeout(()=>{this.removeConnectivityStateWatcher(s),i(new Error("Deadline passed without connectivity state change"))},a.getTime()-l.getTime())}let s={currentState:t,callback:i,timer:o};this.connectivityStateWatchers.push(s)}getChannelzRef(){return this.channelzRef}createCall(t,n,i,o,s){if(typeof t!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof n=="number"||n instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===uM.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(t,n,i,o,s)}};xnt.InternalChannel=Mrr});var Per=I(Dnt=>{"use strict";Object.defineProperty(Dnt,"__esModule",{value:!0});Dnt.ChannelImplementation=void 0;var eya=Art(),tya=Vkn(),xrr=class{constructor(t,n,i){if(typeof t!="string")throw new TypeError("Channel target must be a string");if(!(n instanceof eya.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(i&&typeof i!="object")throw new TypeError("Channel options must be an object");this.internalChannel=new tya.InternalChannel(t,n,i)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(t){return this.internalChannel.getConnectivityState(t)}watchConnectivityState(t,n,i){this.internalChannel.watchConnectivityState(t,n,i)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(t,n,i,o,s){if(typeof t!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof n=="number"||n instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(t,n,i,o,s)}};Dnt.ChannelImplementation=xrr});var rQn=I(iO=>{"use strict";Object.defineProperty(iO,"__esModule",{value:!0});iO.Http2ServerCallStream=iO.ServerDuplexStreamImpl=iO.ServerWritableStreamImpl=iO.ServerReadableStreamImpl=iO.ServerUnaryCallImpl=void 0;var Xkn=require("events"),Jde=require("http2"),Prr=require("stream"),$kn=require("zlib"),Zkn=require("util"),Zd=sc(),krr=_3(),rya=rrr(),eQn=E1(),qRe=art(),tQn="server_call",nya=(0,Zkn.promisify)($kn.unzip),iya=(0,Zkn.promisify)($kn.inflate);function zRe(r){eQn.trace(Zd.LogVerbosity.DEBUG,tQn,r)}var oya="grpc-accept-encoding",sya="grpc-encoding",Hkn="grpc-message",Kkn="grpc-status",Ykn="grpc-timeout",aya=/(\d{1,8})\s*([HMSmun])/,lya={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},cya={[oya]:"identity,deflate,gzip",[sya]:"identity"},Jkn={[Jde.constants.HTTP2_HEADER_STATUS]:Jde.constants.HTTP_STATUS_OK,[Jde.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},uya={waitForTrailers:!0},Drr=class extends Xkn.EventEmitter{constructor(t,n,i){super(),this.call=t,this.metadata=n,this.request=i,this.cancelled=!1,this.call.setupSurfaceCall(this)}getPeer(){return this.call.getPeer()}sendMetadata(t){this.call.sendMetadata(t)}getDeadline(){return this.call.getDeadline()}getPath(){return this.call.getPath()}};iO.ServerUnaryCallImpl=Drr;var Nnt=class extends Prr.Readable{constructor(t,n,i,o){super({objectMode:!0}),this.call=t,this.metadata=n,this.deserialize=i,this.cancelled=!1,this.call.setupSurfaceCall(this),this.call.setupReadable(this,o)}_read(t){this.call.consumeUnpushedMessages(this)&&this.call.resume()}getPeer(){return this.call.getPeer()}sendMetadata(t){this.call.sendMetadata(t)}getDeadline(){return this.call.getDeadline()}getPath(){return this.call.getPath()}};iO.ServerReadableStreamImpl=Nnt;var URe=class extends Prr.Writable{constructor(t,n,i,o){super({objectMode:!0}),this.call=t,this.metadata=n,this.serialize=i,this.request=o,this.cancelled=!1,this.trailingMetadata=new krr.Metadata,this.call.setupSurfaceCall(this),this.on("error",s=>{this.call.sendError(s),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(t){this.call.sendMetadata(t)}getDeadline(){return this.call.getDeadline()}getPath(){return this.call.getPath()}_write(t,n,i){try{let o=this.call.serializeMessage(t);if(!this.call.write(o)){this.call.once("drain",i);return}}catch(o){this.emit("error",{details:(0,qRe.getErrorMessage)(o),code:Zd.Status.INTERNAL})}i()}_final(t){this.call.sendStatus({code:Zd.Status.OK,details:"OK",metadata:this.trailingMetadata}),t(null)}end(t){return t&&(this.trailingMetadata=t),super.end()}};iO.ServerWritableStreamImpl=URe;var Xde=class extends Prr.Duplex{constructor(t,n,i,o,s){super({objectMode:!0}),this.call=t,this.metadata=n,this.serialize=i,this.deserialize=o,this.cancelled=!1,this.trailingMetadata=new krr.Metadata,this.call.setupSurfaceCall(this),this.call.setupReadable(this,s),this.on("error",a=>{this.call.sendError(a),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(t){this.call.sendMetadata(t)}getDeadline(){return this.call.getDeadline()}getPath(){return this.call.getPath()}end(t){return t&&(this.trailingMetadata=t),super.end()}};iO.ServerDuplexStreamImpl=Xde;Xde.prototype._read=Nnt.prototype._read;Xde.prototype._write=URe.prototype._write;Xde.prototype._final=URe.prototype._final;var Nrr=class extends Xkn.EventEmitter{constructor(t,n,i){super(),this.stream=t,this.handler=n,this.cancelled=!1,this.deadlineTimer=null,this.statusSent=!1,this.deadline=1/0,this.wantTrailers=!1,this.metadataSent=!1,this.canPush=!1,this.isPushPending=!1,this.bufferedMessages=[],this.messagesToPush=[],this.maxSendMessageSize=Zd.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=Zd.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.stream.once("error",o=>{}),this.stream.once("close",()=>{var o;zRe("Request to method "+((o=this.handler)===null||o===void 0?void 0:o.path)+" stream closed with rstCode "+this.stream.rstCode),this.statusSent||(this.cancelled=!0,this.emit("cancelled","cancelled"),this.emit("streamEnd",!1),this.sendStatus({code:Zd.Status.CANCELLED,details:"Cancelled by client",metadata:null}),this.deadlineTimer&&clearTimeout(this.deadlineTimer))}),this.stream.on("drain",()=>{this.emit("drain")}),"grpc.max_send_message_length"in i&&(this.maxSendMessageSize=i["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in i&&(this.maxReceiveMessageSize=i["grpc.max_receive_message_length"])}checkCancelled(){return(this.stream.destroyed||this.stream.closed)&&(this.cancelled=!0),this.cancelled}getDecompressedMessage(t,n){return n==="deflate"?iya(t.subarray(5)):n==="gzip"?nya(t.subarray(5)):n==="identity"?t.subarray(5):Promise.reject({code:Zd.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${n}"`})}sendMetadata(t){if(this.checkCancelled()||this.metadataSent)return;this.metadataSent=!0;let n=t?t.toHttp2Headers():null,i=Object.assign(Object.assign(Object.assign({},Jkn),cya),n);this.stream.respond(i,uya)}receiveMetadata(t){let n=krr.Metadata.fromHttp2Headers(t);eQn.isTracerEnabled(tQn)&&zRe("Request to "+this.handler.path+" received headers "+JSON.stringify(n.toJSON()));let i=n.get(Ykn);if(i.length>0){let o=i[0].toString().match(aya);if(o===null){let l=new Error("Invalid deadline");return l.code=Zd.Status.OUT_OF_RANGE,this.sendError(l),n}let s=+o[1]*lya[o[2]]|0,a=new Date;this.deadline=a.setMilliseconds(a.getMilliseconds()+s),this.deadlineTimer=setTimeout(dya,s,this),n.remove(Ykn)}return n.remove(Jde.constants.HTTP2_HEADER_ACCEPT_ENCODING),n.remove(Jde.constants.HTTP2_HEADER_TE),n.remove(Jde.constants.HTTP2_HEADER_CONTENT_TYPE),n.remove("grpc-accept-encoding"),n}receiveUnaryMessage(t){return new Promise((n,i)=>{let{stream:o}=this,s=0,a=this,l=[],u=this.maxReceiveMessageSize;this.stream.on("data",c),this.stream.on("end",d),this.stream.on("error",d);function c(p){if(s+=p.byteLength,u!==-1&&s>u){o.removeListener("data",c),o.removeListener("end",d),o.removeListener("error",d),i({code:Zd.Status.RESOURCE_EXHAUSTED,details:`Received message larger than max (${s} vs. ${u})`});return}l.push(p)}function d(p){if(o.removeListener("data",c),o.removeListener("end",d),o.removeListener("error",d),p!==void 0){i({code:Zd.Status.INTERNAL,details:p.message});return}if(s===0){i({code:Zd.Status.INTERNAL,details:"received empty unary message"});return}a.emit("receiveMessage");let A=Buffer.concat(l,s),h=A.readUInt8(0)===1?t:"identity",y=a.getDecompressedMessage(A,h);if(Buffer.isBuffer(y)){n(a.deserializeMessageWithInternalError(y));return}y.then(C=>n(a.deserializeMessageWithInternalError(C)),C=>i(C.code?C:{code:Zd.Status.INTERNAL,details:`Received "grpc-encoding" header "${t}" but ${t} decompression failed`}))}})}async deserializeMessageWithInternalError(t){try{return this.deserializeMessage(t)}catch(n){throw{details:(0,qRe.getErrorMessage)(n),code:Zd.Status.INTERNAL}}}serializeMessage(t){let n=this.handler.serialize(t),i=n.byteLength,o=Buffer.allocUnsafe(i+5);return o.writeUInt8(0,0),o.writeUInt32BE(i,1),n.copy(o,5),o}deserializeMessage(t){return this.handler.deserialize(t)}async sendUnaryMessage(t,n,i,o){if(!this.checkCancelled()){if(i===void 0&&(i=null),t){!Object.prototype.hasOwnProperty.call(t,"metadata")&&i&&(t.metadata=i),this.sendError(t);return}try{let s=this.serializeMessage(n);this.write(s),this.sendStatus({code:Zd.Status.OK,details:"OK",metadata:i})}catch(s){this.sendError({details:(0,qRe.getErrorMessage)(s),code:Zd.Status.INTERNAL})}}}sendStatus(t){var n,i;if(this.emit("callEnd",t.code),this.emit("streamEnd",t.code===Zd.Status.OK),!this.checkCancelled())if(zRe("Request to method "+((n=this.handler)===null||n===void 0?void 0:n.path)+" ended with status code: "+Zd.Status[t.code]+" details: "+t.details),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.headersSent)this.wantTrailers||(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{var o;let s=Object.assign({[Kkn]:t.code,[Hkn]:encodeURI(t.details)},(o=t.metadata)===null||o===void 0?void 0:o.toHttp2Headers());this.stream.sendTrailers(s),this.statusSent=!0}),this.stream.end());else{let o=Object.assign(Object.assign({[Kkn]:t.code,[Hkn]:encodeURI(t.details)},Jkn),(i=t.metadata)===null||i===void 0?void 0:i.toHttp2Headers());this.stream.respond(o,{endStream:!0}),this.statusSent=!0}}sendError(t){let n={code:Zd.Status.UNKNOWN,details:"message"in t?t.message:"Unknown Error",metadata:"metadata"in t&&t.metadata!==void 0?t.metadata:null};"code"in t&&typeof t.code=="number"&&Number.isInteger(t.code)&&(n.code=t.code,"details"in t&&typeof t.details=="string"&&(n.details=t.details)),this.sendStatus(n)}write(t){if(!this.checkCancelled()){if(this.maxSendMessageSize!==-1&&t.length>this.maxSendMessageSize){this.sendError({code:Zd.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${t.length} vs. ${this.maxSendMessageSize})`});return}return this.sendMetadata(),this.emit("sendMessage"),this.stream.write(t)}}resume(){this.stream.resume()}setupSurfaceCall(t){this.once("cancelled",n=>{t.cancelled=!0,t.emit("cancelled",n)}),this.once("callEnd",n=>t.emit("callEnd",n))}setupReadable(t,n){let i=new rya.StreamDecoder,o=!1,s=!1,a=!1,l=async()=>{!a&&o&&!s&&(a=!0,await this.pushOrBufferMessage(t,null))};this.stream.on("data",async u=>{let c=i.write(u);s=!0,this.stream.pause();for(let d of c){if(this.maxReceiveMessageSize!==-1&&d.length>this.maxReceiveMessageSize){this.sendError({code:Zd.Status.RESOURCE_EXHAUSTED,details:`Received message larger than max (${d.length} vs. ${this.maxReceiveMessageSize})`});return}this.emit("receiveMessage");let A=d.readUInt8(0)===1?n:"identity",f=await this.getDecompressedMessage(d,A);if(!f)return;await this.pushOrBufferMessage(t,f)}s=!1,this.stream.resume(),await l()}),this.stream.once("end",async()=>{o=!0,await l()})}consumeUnpushedMessages(t){for(this.canPush=!0;this.messagesToPush.length>0;){let n=this.messagesToPush.shift(),i=t.push(n);if(n===null||i===!1){this.canPush=!1;break}}return this.canPush}async pushOrBufferMessage(t,n){this.isPushPending?this.bufferedMessages.push(n):await this.pushMessage(t,n)}async pushMessage(t,n){if(n===null){zRe("Received end of stream"),this.canPush?t.push(null):this.messagesToPush.push(null);return}zRe("Received message of length "+n.length),this.isPushPending=!0;try{let i=await this.deserializeMessage(n);this.canPush?t.push(i)||(this.canPush=!1,this.stream.pause()):this.messagesToPush.push(i)}catch(i){this.bufferedMessages.length=0;let o=(0,qRe.getErrorCode)(i);(o===null||o<Zd.Status.OK||o>Zd.Status.UNAUTHENTICATED)&&(o=Zd.Status.INTERNAL),t.emit("error",{details:(0,qRe.getErrorMessage)(i),code:o})}this.isPushPending=!1,this.bufferedMessages.length>0&&await this.pushMessage(t,this.bufferedMessages.shift())}getPeer(){var t;let n=(t=this.stream.session)===null||t===void 0?void 0:t.socket;return n?.remoteAddress?n.remotePort?`${n.remoteAddress}:${n.remotePort}`:n.remoteAddress:"unknown"}getDeadline(){return this.deadline}getPath(){return this.handler.path}};iO.Http2ServerCallStream=Nrr;function dya(r){let t=new Error("Deadline exceeded");t.code=Zd.Status.DEADLINE_EXCEEDED,r.sendError(t),r.cancelled=!0,r.emit("cancelled","deadline")}});var Frr=I(Pnt=>{"use strict";Object.defineProperty(Pnt,"__esModule",{value:!0});Pnt.ServerCredentials=void 0;var nQn=oer(),jRe=class{static createInsecure(){return new Qrr}static createSsl(t,n,i=!1){if(t!==null&&!Buffer.isBuffer(t))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(n))throw new TypeError("keyCertPairs must be an array");if(typeof i!="boolean")throw new TypeError("checkClientCertificate must be a boolean");let o=[],s=[];for(let a=0;a<n.length;a++){let l=n[a];if(l===null||typeof l!="object")throw new TypeError(`keyCertPair[${a}] must be an object`);if(!Buffer.isBuffer(l.private_key))throw new TypeError(`keyCertPair[${a}].private_key must be a Buffer`);if(!Buffer.isBuffer(l.cert_chain))throw new TypeError(`keyCertPair[${a}].cert_chain must be a Buffer`);o.push(l.cert_chain),s.push(l.private_key)}return new Lrr({ca:t||(0,nQn.getDefaultRootsData)()||void 0,cert:o,key:s,requestCert:i,ciphers:nQn.CIPHER_SUITES})}};Pnt.ServerCredentials=jRe;var Qrr=class extends jRe{_isSecure(){return!1}_getSettings(){return null}},Lrr=class extends jRe{constructor(t){super(),this.options=t}_isSecure(){return!0}_getSettings(){return this.options}}});var sQn=I(Lnt=>{"use strict";Object.defineProperty(Lnt,"__esModule",{value:!0});Lnt.Server=void 0;var Cq=require("http2"),uP=sc(),vee=rQn(),pya=Frr(),iQn=YR(),knt=E1(),Y_=XR(),Aya=ev(),vb=Cee(),Qnt=~(1<<31),fya=~(1<<31),hya=2e4,{HTTP2_HEADER_PATH:oQn}=Cq.constants,gya="server";function mya(){}function zrr(r){return{code:uP.Status.UNIMPLEMENTED,details:`The server does not implement the method ${r}`}}function yya(r,t){let n=zrr(t);switch(r){case"unary":return(i,o)=>{o(n,null)};case"clientStream":return(i,o)=>{o(n,null)};case"serverStream":return i=>{i.emit("error",n)};case"bidi":return i=>{i.emit("error",n)};default:throw new Error(`Invalid handlerType ${r}`)}}var qrr=class{constructor(t){var n,i,o,s;this.http2ServerList=[],this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.channelzTrace=new vb.ChannelzTrace,this.callTracker=new vb.ChannelzCallTracker,this.listenerChildrenTracker=new vb.ChannelzChildrenTracker,this.sessionChildrenTracker=new vb.ChannelzChildrenTracker,this.options=t??{},this.options["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzRef=(0,vb.registerChannelzServer)(()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(n=this.options["grpc.max_connection_age_ms"])!==null&&n!==void 0?n:Qnt,this.maxConnectionAgeGraceMs=(i=this.options["grpc.max_connection_age_grace_ms"])!==null&&i!==void 0?i:Qnt,this.keepaliveTimeMs=(o=this.options["grpc.keepalive_time_ms"])!==null&&o!==void 0?o:fya,this.keepaliveTimeoutMs=(s=this.options["grpc.keepalive_timeout_ms"])!==null&&s!==void 0?s:hya,this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfoGetter(t){return()=>{var n,i,o;let s=this.sessions.get(t),a=t.socket,l=a.remoteAddress?(0,Y_.stringToSubchannelAddress)(a.remoteAddress,a.remotePort):null,u=a.localAddress?(0,Y_.stringToSubchannelAddress)(a.localAddress,a.localPort):null,c;if(t.encrypted){let p=a,A=p.getCipher(),f=p.getCertificate(),h=p.getPeerCertificate();c={cipherSuiteStandardName:(n=A.standardName)!==null&&n!==void 0?n:null,cipherSuiteOtherName:A.standardName?null:A.name,localCertificate:f&&"raw"in f?f.raw:null,remoteCertificate:h&&"raw"in h?h.raw:null}}else c=null;return{remoteAddress:l,localAddress:u,security:c,remoteName:null,streamsStarted:s.streamTracker.callsStarted,streamsSucceeded:s.streamTracker.callsSucceeded,streamsFailed:s.streamTracker.callsFailed,messagesSent:s.messagesSent,messagesReceived:s.messagesReceived,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:s.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:s.lastMessageSentTimestamp,lastMessageReceivedTimestamp:s.lastMessageReceivedTimestamp,localFlowControlWindow:(i=t.state.localWindowSize)!==null&&i!==void 0?i:null,remoteFlowControlWindow:(o=t.state.remoteWindowSize)!==null&&o!==void 0?o:null}}}trace(t){knt.trace(uP.LogVerbosity.DEBUG,gya,"("+this.channelzRef.id+") "+t)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(t,n){if(t===null||typeof t!="object"||n===null||typeof n!="object")throw new Error("addService() requires two objects as arguments");let i=Object.keys(t);if(i.length===0)throw new Error("Cannot add an empty service to a server");i.forEach(o=>{let s=t[o],a;s.requestStream?s.responseStream?a="bidi":a="clientStream":s.responseStream?a="serverStream":a="unary";let l=n[o],u;if(l===void 0&&typeof s.originalName=="string"&&(l=n[s.originalName]),l!==void 0?u=l.bind(n):u=yya(a,o),this.register(s.path,u,s.responseSerialize,s.requestDeserialize,a)===!1)throw new Error(`Method handler for ${s.path} already provided.`)})}removeService(t){if(t===null||typeof t!="object")throw new Error("removeService() requires object as argument");Object.keys(t).forEach(i=>{let o=t[i];this.unregister(o.path)})}bind(t,n){throw new Error("Not implemented. Use bindAsync() instead")}bindAsync(t,n,i){if(this.started===!0)throw new Error("server is already started");if(this.shutdown)throw new Error("bindAsync called after shutdown");if(typeof t!="string")throw new TypeError("port must be a string");if(n===null||!(n instanceof pya.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if(typeof i!="function")throw new TypeError("callback must be a function");let o=(0,Aya.parseUri)(t);if(o===null)throw new Error(`Could not parse port "${t}"`);let s=(0,iQn.mapUriDefaultScheme)(o);if(s===null)throw new Error(`Could not get a default scheme for port "${t}"`);let a={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER};"grpc-node.max_session_memory"in this.options?a.maxSessionMemory=this.options["grpc-node.max_session_memory"]:a.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(a.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]});let l=(f,h)=>{process.nextTick(()=>i(f,h))},u=()=>{let f;if(n._isSecure()){let h=Object.assign(a,n._getSettings());h.enableTrace=this.options["grpc-node.tls_enable_trace"]===1,f=Cq.createSecureServer(h),f.on("secureConnection",y=>{y.on("error",C=>{this.trace("An incoming TLS connection closed with error: "+C.message)})})}else f=Cq.createServer(a);return f.setTimeout(0,mya),this._setupHandlers(f),f},c=(f,h,y)=>f.length===0?Promise.resolve({port:h,count:y}):Promise.all(f.map(C=>{this.trace("Attempting to bind "+(0,Y_.subchannelAddressToString)(C));let O;(0,Y_.isTcpSubchannelAddress)(C)?O={host:C.host,port:h}:O=C;let w=u();return new Promise((T,R)=>{let P=z=>{this.trace("Failed to bind "+(0,Y_.subchannelAddressToString)(C)+" with error "+z.message),T(z)};w.once("error",P),w.listen(O,()=>{if(this.shutdown){w.close(),T(new Error("bindAsync failed because server is shutdown"));return}let z=w.address(),q;typeof z=="string"?q={path:z}:q={host:z.address,port:z.port};let H=(0,vb.registerChannelzSocket)((0,Y_.subchannelAddressToString)(q),()=>({localAddress:q,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled);this.channelzEnabled&&this.listenerChildrenTracker.refChild(H),this.http2ServerList.push({server:w,channelzRef:H}),this.trace("Successfully bound "+(0,Y_.subchannelAddressToString)(q)),T("port"in q?q.port:h),w.removeListener("error",P)})})})).then(C=>{let O=0;for(let w of C)if(typeof w=="number"&&(O+=1,w!==h))throw new Error("Invalid state: multiple port numbers added from single address");return{port:h,count:O+y}}),d=f=>{if(f.length===0)return Promise.resolve({port:0,count:0});let h=f[0],y=u();return new Promise((C,O)=>{let w=T=>{this.trace("Failed to bind "+(0,Y_.subchannelAddressToString)(h)+" with error "+T.message),C(d(f.slice(1)))};y.once("error",w),y.listen(h,()=>{if(this.shutdown){y.close(),C({port:0,count:0});return}let T=y.address(),R={host:T.address,port:T.port},P=(0,vb.registerChannelzSocket)((0,Y_.subchannelAddressToString)(R),()=>({localAddress:R,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled);this.channelzEnabled&&this.listenerChildrenTracker.refChild(P),this.http2ServerList.push({server:y,channelzRef:P}),this.trace("Successfully bound "+(0,Y_.subchannelAddressToString)(R)),C(c(f.slice(1),T.port,1)),y.removeListener("error",w)})})},p={onSuccessfulResolution:(f,h,y)=>{if(p.onSuccessfulResolution=()=>{},this.shutdown&&l(new Error("bindAsync failed because server is shutdown"),0),f.length===0){l(new Error(`No addresses resolved for port ${t}`),0);return}let C;(0,Y_.isTcpSubchannelAddress)(f[0])?f[0].port===0?C=d(f):C=c(f,f[0].port,0):C=c(f,1,0),C.then(O=>{if(O.count===0){let w=`No address added out of total ${f.length} resolved`;knt.log(uP.LogVerbosity.ERROR,w),l(new Error(w),0)}else O.count<f.length&&knt.log(uP.LogVerbosity.INFO,`WARNING Only ${O.count} addresses added out of total ${f.length} resolved`),l(null,O.port)},O=>{let w=`No address added out of total ${f.length} resolved`;knt.log(uP.LogVerbosity.ERROR,w),l(new Error(w),0)})},onError:f=>{l(new Error(f.details),0)}};(0,iQn.createResolver)(s,p,this.options).updateResolution()}forceShutdown(){for(let{server:t,channelzRef:n}of this.http2ServerList)t.listening&&t.close(()=>{this.channelzEnabled&&(this.listenerChildrenTracker.unrefChild(n),(0,vb.unregisterChannelzRef)(n))});this.started=!1,this.shutdown=!0,this.sessions.forEach((t,n)=>{n.destroy(Cq.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),this.channelzEnabled&&(0,vb.unregisterChannelzRef)(this.channelzRef)}register(t,n,i,o,s){return this.handlers.has(t)?!1:(this.handlers.set(t,{func:n,serialize:i,deserialize:o,type:s,path:t}),!0)}unregister(t){return this.handlers.delete(t)}start(){if(this.http2ServerList.length===0||this.http2ServerList.every(({server:t})=>t.listening!==!0))throw new Error("server must be bound in order to start");if(this.started===!0)throw new Error("server is already started");this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Starting"),this.started=!0}tryShutdown(t){let n=s=>{this.channelzEnabled&&(0,vb.unregisterChannelzRef)(this.channelzRef),t(s)},i=0;function o(){i--,i===0&&n()}this.started=!1,this.shutdown=!0;for(let{server:s,channelzRef:a}of this.http2ServerList)s.listening&&(i++,s.close(()=>{this.channelzEnabled&&(this.listenerChildrenTracker.unrefChild(a),(0,vb.unregisterChannelzRef)(a)),o()}));this.sessions.forEach((s,a)=>{a.closed||(i+=1,a.close(o))}),i===0&&n()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(t,n){let i=n[Cq.constants.HTTP2_HEADER_CONTENT_TYPE];return typeof i!="string"||!i.startsWith("application/grpc")?(t.respond({[Cq.constants.HTTP2_HEADER_STATUS]:Cq.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1):!0}_retrieveHandler(t){this.trace("Received call to method "+t+" at address "+this.serverAddressString);let n=this.handlers.get(t);return n===void 0?(this.trace("No handler registered for method "+t+". Sending UNIMPLEMENTED status."),null):n}_respondWithError(t,n,i=null){let o=new vee.Http2ServerCallStream(n,null,this.options);t.code===void 0&&(t.code=uP.Status.INTERNAL),this.channelzEnabled&&(this.callTracker.addCallFailed(),i?.streamTracker.addCallFailed()),o.sendError(t)}_channelzHandler(t,n){let i=this.sessions.get(t.session);if(this.callTracker.addCallStarted(),i?.streamTracker.addCallStarted(),!this._verifyContentType(t,n)){this.callTracker.addCallFailed(),i?.streamTracker.addCallFailed();return}let o=n[oQn],s=this._retrieveHandler(o);if(!s){this._respondWithError(zrr(o),t,i);return}let a=new vee.Http2ServerCallStream(t,s,this.options);a.once("callEnd",l=>{l===uP.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}),i&&(a.once("streamEnd",l=>{l?i.streamTracker.addCallSucceeded():i.streamTracker.addCallFailed()}),a.on("sendMessage",()=>{i.messagesSent+=1,i.lastMessageSentTimestamp=new Date}),a.on("receiveMessage",()=>{i.messagesReceived+=1,i.lastMessageReceivedTimestamp=new Date})),this._runHandlerForCall(a,s,n)||(this.callTracker.addCallFailed(),i?.streamTracker.addCallFailed(),a.sendError({code:uP.Status.INTERNAL,details:`Unknown handler type: ${s.type}`}))}_streamHandler(t,n){if(this._verifyContentType(t,n)!==!0)return;let i=n[oQn],o=this._retrieveHandler(i);if(!o){this._respondWithError(zrr(i),t,null);return}let s=new vee.Http2ServerCallStream(t,o,this.options);this._runHandlerForCall(s,o,n)||s.sendError({code:uP.Status.INTERNAL,details:`Unknown handler type: ${o.type}`})}_runHandlerForCall(t,n,i){var o;let s=t.receiveMetadata(i),a=(o=s.get("grpc-encoding")[0])!==null&&o!==void 0?o:"identity";s.remove("grpc-encoding");let{type:l}=n;if(l==="unary")Eya(t,n,s,a);else if(l==="clientStream")bya(t,n,s,a);else if(l==="serverStream")Cya(t,n,s,a);else if(l==="bidi")Iya(t,n,s,a);else return!1;return!0}_setupHandlers(t){if(t===null)return;let n=t.address(),i="null";n&&(typeof n=="string"?i=n:i=n.address+":"+n.port),this.serverAddressString=i;let o=this.channelzEnabled?this._channelzHandler:this._streamHandler;t.on("stream",o.bind(this)),t.on("session",s=>{var a,l,u,c,d;if(!this.started){s.destroy();return}let p=(0,vb.registerChannelzSocket)((a=s.socket.remoteAddress)!==null&&a!==void 0?a:"unknown",this.getChannelzSessionInfoGetter(s),this.channelzEnabled),A={ref:p,streamTracker:new vb.ChannelzCallTracker,messagesSent:0,messagesReceived:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};this.sessions.set(s,A);let f=s.socket.remoteAddress;this.channelzEnabled&&(this.channelzTrace.addTrace("CT_INFO","Connection established by client "+f),this.sessionChildrenTracker.refChild(p));let h=null,y=null,C=!1;if(this.maxConnectionAgeMs!==Qnt){let w=this.maxConnectionAgeMs/10,T=Math.random()*w*2-w;h=(u=(l=setTimeout(()=>{var R,P;C=!0,this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+f);try{s.goaway(Cq.constants.NGHTTP2_NO_ERROR,~(1<<31),Buffer.from("max_age"))}catch{s.destroy();return}s.close(),this.maxConnectionAgeGraceMs!==Qnt&&(y=(P=(R=setTimeout(()=>{s.destroy()},this.maxConnectionAgeGraceMs)).unref)===null||P===void 0?void 0:P.call(R))},this.maxConnectionAgeMs+T)).unref)===null||u===void 0?void 0:u.call(l)}let O=(d=(c=setInterval(()=>{var w,T;let R=(T=(w=setTimeout(()=>{C=!0,this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+f),s.close()},this.keepaliveTimeoutMs)).unref)===null||T===void 0?void 0:T.call(w);try{s.ping((P,z,q)=>{clearTimeout(R)})}catch{s.destroy()}},this.keepaliveTimeMs)).unref)===null||d===void 0?void 0:d.call(c);s.on("close",()=>{this.channelzEnabled&&(C||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+f),this.sessionChildrenTracker.unrefChild(p),(0,vb.unregisterChannelzRef)(p)),h&&clearTimeout(h),y&&clearTimeout(y),O&&clearTimeout(O),this.sessions.delete(s)})})}};Lnt.Server=qrr;async function Eya(r,t,n,i){try{let o=await r.receiveUnaryMessage(i);if(o===void 0||r.cancelled)return;let s=new vee.ServerUnaryCallImpl(r,n,o);t.func(s,(a,l,u,c)=>{r.sendUnaryMessage(a,l,u,c)})}catch(o){r.sendError(o)}}function bya(r,t,n,i){let o=new vee.ServerReadableStreamImpl(r,n,t.deserialize,i);function s(a,l,u,c){o.destroy(),r.sendUnaryMessage(a,l,u,c)}r.cancelled||(o.on("error",s),t.func(o,s))}async function Cya(r,t,n,i){try{let o=await r.receiveUnaryMessage(i);if(o===void 0||r.cancelled)return;let s=new vee.ServerWritableStreamImpl(r,n,t.serialize,o);t.func(s)}catch(o){r.sendError(o)}}function Iya(r,t,n,i){let o=new vee.ServerDuplexStreamImpl(r,n,t.serialize,t.deserialize,i);r.cancelled||t.func(o)}});var aQn=I(Fnt=>{"use strict";Object.defineProperty(Fnt,"__esModule",{value:!0});Fnt.StatusBuilder=void 0;var Urr=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(t){return this.code=t,this}withDetails(t){return this.details=t,this}withMetadata(t){return this.metadata=t,this}build(){let t={};return this.code!==null&&(t.code=this.code),this.details!==null&&(t.details=this.details),this.metadata!==null&&(t.metadata=this.metadata),t}};Fnt.StatusBuilder=Urr});var jrr=I(Iq=>{"use strict";Object.defineProperty(Iq,"__esModule",{value:!0});Iq.isDuration=Iq.durationToMs=Iq.msToDuration=void 0;function vya(r){return{seconds:r/1e3|0,nanos:r%1e3*1e6|0}}Iq.msToDuration=vya;function Sya(r){return r.seconds*1e3+r.nanos/1e6|0}Iq.durationToMs=Sya;function Oya(r){return typeof r.seconds=="number"&&typeof r.nanos=="number"}Iq.isDuration=Oya});var Xrr=I(vq=>{"use strict";var Wrr;Object.defineProperty(vq,"__esModule",{value:!0});vq.setup=vq.OutlierDetectionLoadBalancer=vq.OutlierDetectionLoadBalancingConfig=void 0;var qnt=YS(),cQn=sc(),See=jrr(),uQn=$rr(),dQn=$z(),wya=brt(),_ya=rq(),lQn=XR(),Tya=Bnt(),Bya=E1(),Rya="outlier_detection";function Wh(r){Bya.trace(cQn.LogVerbosity.DEBUG,Rya,r)}var Jrr="outlier_detection",Mya=((Wrr=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&Wrr!==void 0?Wrr:"true")==="true",xya={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},Dya={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function $de(r,t,n,i){if(t in r&&typeof r[t]!==n){let o=i?`${i}.${t}`:t;throw new Error(`outlier detection config ${o} parse error: expected ${n}, got ${typeof r[t]}`)}}function Grr(r,t,n){let i=n?`${n}.${t}`:t;if(t in r){if(!(0,See.isDuration)(r[t]))throw new Error(`outlier detection config ${i} parse error: expected Duration, got ${typeof r[t]}`);if(!(r[t].seconds>=0&&r[t].seconds<=315576e6&&r[t].nanos>=0&&r[t].nanos<=999999999))throw new Error(`outlier detection config ${i} parse error: values out of range for non-negative Duaration`)}}function znt(r,t,n){let i=n?`${n}.${t}`:t;if($de(r,t,"number",n),t in r&&!(r[t]>=0&&r[t]<=100))throw new Error(`outlier detection config ${i} parse error: value out of range for percentage (0-100)`)}var WRe=class r{constructor(t,n,i,o,s,a,l){if(this.childPolicy=l,l.length>0&&l[0].getLoadBalancerName()==="pick_first")throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=t??1e4,this.baseEjectionTimeMs=n??3e4,this.maxEjectionTimeMs=i??3e5,this.maxEjectionPercent=o??10,this.successRateEjection=s?Object.assign(Object.assign({},xya),s):null,this.failurePercentageEjection=a?Object.assign(Object.assign({},Dya),a):null}getLoadBalancerName(){return Jrr}toJsonObject(){return{interval:(0,See.msToDuration)(this.intervalMs),base_ejection_time:(0,See.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,See.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:this.successRateEjection,failure_percentage_ejection:this.failurePercentageEjection,child_policy:this.childPolicy.map(t=>t.toJsonObject())}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}copyWithChildPolicy(t){return new r(this.intervalMs,this.baseEjectionTimeMs,this.maxEjectionTimeMs,this.maxEjectionPercent,this.successRateEjection,this.failurePercentageEjection,t)}static createFromJson(t){var n;if(Grr(t,"interval"),Grr(t,"base_ejection_time"),Grr(t,"max_ejection_time"),znt(t,"max_ejection_percent"),"success_rate_ejection"in t){if(typeof t.success_rate_ejection!="object")throw new Error("outlier detection config success_rate_ejection must be an object");$de(t.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),znt(t.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),$de(t.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),$de(t.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in t){if(typeof t.failure_percentage_ejection!="object")throw new Error("outlier detection config failure_percentage_ejection must be an object");znt(t.failure_percentage_ejection,"threshold","failure_percentage_ejection"),znt(t.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),$de(t.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),$de(t.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}return new r(t.interval?(0,See.durationToMs)(t.interval):null,t.base_ejection_time?(0,See.durationToMs)(t.base_ejection_time):null,t.max_ejection_time?(0,See.durationToMs)(t.max_ejection_time):null,(n=t.max_ejection_percent)!==null&&n!==void 0?n:null,t.success_rate_ejection,t.failure_percentage_ejection,t.child_policy.map(dQn.validateLoadBalancingConfig))}};vq.OutlierDetectionLoadBalancingConfig=WRe;var Hrr=class extends Tya.BaseSubchannelWrapper{constructor(t,n){super(t),this.mapEntry=n,this.stateListeners=[],this.ejected=!1,this.refCount=0,this.childSubchannelState=t.getConnectivityState(),t.addConnectivityStateListener((i,o,s,a)=>{if(this.childSubchannelState=s,!this.ejected)for(let l of this.stateListeners)l(this,o,s,a)})}getConnectivityState(){return this.ejected?qnt.ConnectivityState.TRANSIENT_FAILURE:this.childSubchannelState}addConnectivityStateListener(t){this.stateListeners.push(t)}removeConnectivityStateListener(t){let n=this.stateListeners.indexOf(t);n>-1&&this.stateListeners.splice(n,1)}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){let t=this.mapEntry.subchannelWrappers.indexOf(this);t>=0&&this.mapEntry.subchannelWrappers.splice(t,1)}}eject(){this.ejected=!0;for(let t of this.stateListeners)t(this,this.childSubchannelState,qnt.ConnectivityState.TRANSIENT_FAILURE,-1)}uneject(){this.ejected=!1;for(let t of this.stateListeners)t(this,qnt.ConnectivityState.TRANSIENT_FAILURE,this.childSubchannelState,-1)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}};function Vrr(){return{success:0,failure:0}}var Krr=class{constructor(){this.activeBucket=Vrr(),this.inactiveBucket=Vrr()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=Vrr()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}},Yrr=class{constructor(t,n){this.wrappedPicker=t,this.countCalls=n}pick(t){let n=this.wrappedPicker.pick(t);if(n.pickResultType===_ya.PickResultType.COMPLETE){let i=n.subchannel,o=i.getMapEntry();if(o){let s=n.onCallEnded;return this.countCalls&&(s=a=>{var l;a===cQn.Status.OK?o.counter.addSuccess():o.counter.addFailure(),(l=n.onCallEnded)===null||l===void 0||l.call(n,a)}),Object.assign(Object.assign({},n),{subchannel:i.getWrappedSubchannel(),onCallEnded:s})}else return Object.assign(Object.assign({},n),{subchannel:i.getWrappedSubchannel()})}else return n}},Unt=class{constructor(t){this.addressMap=new Map,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new wya.ChildLoadBalancerHandler((0,uQn.createChildChannelControlHelper)(t,{createSubchannel:(n,i)=>{let o=t.createSubchannel(n,i),s=this.addressMap.get((0,lQn.subchannelAddressToString)(n)),a=new Hrr(o,s);return s?.currentEjectionTimestamp!==null&&a.eject(),s?.subchannelWrappers.push(a),a},updateState:(n,i)=>{n===qnt.ConnectivityState.READY?t.updateState(n,new Yrr(i,this.isCountingEnabled())):t.updateState(n,i)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let t=0;for(let n of this.addressMap.values())n.currentEjectionTimestamp!==null&&(t+=1);return t*100/this.addressMap.size}runSuccessRateCheck(t){if(!this.latestConfig)return;let n=this.latestConfig.getSuccessRateEjectionConfig();if(!n)return;Wh("Running success rate check");let i=n.request_volume,o=0,s=[];for(let[p,A]of this.addressMap){let f=A.counter.getLastSuccesses(),h=A.counter.getLastFailures();Wh("Stats for "+p+": successes="+f+" failures="+h+" targetRequestVolume="+i),f+h>=i&&(o+=1,s.push(f/(f+h)))}if(Wh("Found "+o+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+s+"]"),o<n.minimum_hosts)return;let a=s.reduce((p,A)=>p+A)/s.length,l=0;for(let p of s){let A=p-a;l+=A*A}let u=l/s.length,c=Math.sqrt(u),d=a-c*(n.stdev_factor/1e3);Wh("stdev="+c+" ejectionThreshold="+d);for(let[p,A]of this.addressMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let f=A.counter.getLastSuccesses(),h=A.counter.getLastFailures();if(f+h<i)continue;let y=f/(f+h);if(Wh("Checking candidate "+p+" successRate="+y),y<d){let C=Math.random()*100;Wh("Candidate "+p+" randomNumber="+C+" enforcement_percentage="+n.enforcement_percentage),C<n.enforcement_percentage&&(Wh("Ejecting candidate "+p),this.eject(A,t))}}}runFailurePercentageCheck(t){if(!this.latestConfig)return;let n=this.latestConfig.getFailurePercentageEjectionConfig();if(!n)return;Wh("Running failure percentage check. threshold="+n.threshold+" request volume threshold="+n.request_volume);let i=0;for(let o of this.addressMap.values()){let s=o.counter.getLastSuccesses(),a=o.counter.getLastFailures();s+a>=n.request_volume&&(i+=1)}if(!(i<n.minimum_hosts))for(let[o,s]of this.addressMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let a=s.counter.getLastSuccesses(),l=s.counter.getLastFailures();if(Wh("Candidate successes="+a+" failures="+l),a+l<n.request_volume)continue;if(l*100/(l+a)>n.threshold){let c=Math.random()*100;Wh("Candidate "+o+" randomNumber="+c+" enforcement_percentage="+n.enforcement_percentage),c<n.enforcement_percentage&&(Wh("Ejecting candidate "+o),this.eject(s,t))}}}eject(t,n){t.currentEjectionTimestamp=new Date,t.ejectionTimeMultiplier+=1;for(let i of t.subchannelWrappers)i.eject()}uneject(t){t.currentEjectionTimestamp=null;for(let n of t.subchannelWrappers)n.uneject()}switchAllBuckets(){for(let t of this.addressMap.values())t.counter.switchBuckets()}startTimer(t){var n,i;this.ejectionTimer=setTimeout(()=>this.runChecks(),t),(i=(n=this.ejectionTimer).unref)===null||i===void 0||i.call(n)}runChecks(){let t=new Date;if(Wh("Ejection timer running"),this.switchAllBuckets(),!!this.latestConfig){this.timerStartTime=t,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(t),this.runFailurePercentageCheck(t);for(let[n,i]of this.addressMap.entries())if(i.currentEjectionTimestamp===null)i.ejectionTimeMultiplier>0&&(i.ejectionTimeMultiplier-=1);else{let o=this.latestConfig.getBaseEjectionTimeMs(),s=this.latestConfig.getMaxEjectionTimeMs(),a=new Date(i.currentEjectionTimestamp.getTime());a.setMilliseconds(a.getMilliseconds()+Math.min(o*i.ejectionTimeMultiplier,Math.max(o,s))),a<new Date&&(Wh("Unejecting "+n),this.uneject(i))}}}updateAddressList(t,n,i){if(!(n instanceof WRe))return;let o=new Set;for(let a of t)o.add((0,lQn.subchannelAddressToString)(a));for(let a of o)this.addressMap.has(a)||(Wh("Adding map entry for "+a),this.addressMap.set(a,{counter:new Krr,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));for(let a of this.addressMap.keys())o.has(a)||(Wh("Removing map entry for "+a),this.addressMap.delete(a));let s=(0,dQn.getFirstUsableConfig)(n.getChildPolicy(),!0);if(this.childBalancer.updateAddressList(t,s,i),n.getSuccessRateEjectionConfig()||n.getFailurePercentageEjectionConfig())if(this.timerStartTime){Wh("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);let a=n.getIntervalMs()-(new Date().getTime()-this.timerStartTime.getTime());this.startTimer(a)}else Wh("Starting new timer"),this.timerStartTime=new Date,this.startTimer(n.getIntervalMs()),this.switchAllBuckets();else{Wh("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(let a of this.addressMap.values())this.uneject(a),a.ejectionTimeMultiplier=0}this.latestConfig=n}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return Jrr}};vq.OutlierDetectionLoadBalancer=Unt;function Nya(){Mya&&(0,uQn.registerLoadBalancerType)(Jrr,Unt,WRe)}vq.setup=Nya});var $rr=I(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});vs.OutlierDetectionLoadBalancingConfig=vs.BaseSubchannelWrapper=vs.registerAdminService=vs.FilterStackFactory=vs.BaseFilter=vs.PickResultType=vs.QueuePicker=vs.UnavailablePicker=vs.ChildLoadBalancerHandler=vs.subchannelAddressToString=vs.validateLoadBalancingConfig=vs.getFirstUsableConfig=vs.registerLoadBalancerType=vs.createChildChannelControlHelper=vs.BackoffTimeout=vs.durationToMs=vs.uriToString=vs.createResolver=vs.registerResolver=vs.log=vs.trace=void 0;var pQn=E1();Object.defineProperty(vs,"trace",{enumerable:!0,get:function(){return pQn.trace}});Object.defineProperty(vs,"log",{enumerable:!0,get:function(){return pQn.log}});var AQn=YR();Object.defineProperty(vs,"registerResolver",{enumerable:!0,get:function(){return AQn.registerResolver}});Object.defineProperty(vs,"createResolver",{enumerable:!0,get:function(){return AQn.createResolver}});var Pya=ev();Object.defineProperty(vs,"uriToString",{enumerable:!0,get:function(){return Pya.uriToString}});var kya=jrr();Object.defineProperty(vs,"durationToMs",{enumerable:!0,get:function(){return kya.durationToMs}});var Qya=dRe();Object.defineProperty(vs,"BackoffTimeout",{enumerable:!0,get:function(){return Qya.BackoffTimeout}});var jnt=$z();Object.defineProperty(vs,"createChildChannelControlHelper",{enumerable:!0,get:function(){return jnt.createChildChannelControlHelper}});Object.defineProperty(vs,"registerLoadBalancerType",{enumerable:!0,get:function(){return jnt.registerLoadBalancerType}});Object.defineProperty(vs,"getFirstUsableConfig",{enumerable:!0,get:function(){return jnt.getFirstUsableConfig}});Object.defineProperty(vs,"validateLoadBalancingConfig",{enumerable:!0,get:function(){return jnt.validateLoadBalancingConfig}});var Lya=XR();Object.defineProperty(vs,"subchannelAddressToString",{enumerable:!0,get:function(){return Lya.subchannelAddressToString}});var Fya=brt();Object.defineProperty(vs,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return Fya.ChildLoadBalancerHandler}});var Zrr=rq();Object.defineProperty(vs,"UnavailablePicker",{enumerable:!0,get:function(){return Zrr.UnavailablePicker}});Object.defineProperty(vs,"QueuePicker",{enumerable:!0,get:function(){return Zrr.QueuePicker}});Object.defineProperty(vs,"PickResultType",{enumerable:!0,get:function(){return Zrr.PickResultType}});var zya=fnt();Object.defineProperty(vs,"BaseFilter",{enumerable:!0,get:function(){return zya.BaseFilter}});var qya=drr();Object.defineProperty(vs,"FilterStackFactory",{enumerable:!0,get:function(){return qya.FilterStackFactory}});var Uya=Irt();Object.defineProperty(vs,"registerAdminService",{enumerable:!0,get:function(){return Uya.registerAdminService}});var jya=Bnt();Object.defineProperty(vs,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return jya.BaseSubchannelWrapper}});var Wya=Xrr();Object.defineProperty(vs,"OutlierDetectionLoadBalancingConfig",{enumerable:!0,get:function(){return Wya.OutlierDetectionLoadBalancingConfig}})});var fQn=I(Wnt=>{"use strict";Object.defineProperty(Wnt,"__esModule",{value:!0});Wnt.setup=void 0;var Gya=YR(),enr=class{constructor(t,n,i){this.listener=n,this.addresses=[],this.hasReturnedResult=!1;let o;t.authority===""?o="/"+t.path:o=t.path,this.addresses=[{path:o}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener.onSuccessfulResolution,this.addresses,null,null,null,{}))}destroy(){}static getDefaultAuthority(t){return"localhost"}};function Vya(){(0,Gya.registerResolver)("unix",enr)}Wnt.setup=Vya});var EQn=I(Hnt=>{"use strict";Object.defineProperty(Hnt,"__esModule",{value:!0});Hnt.setup=void 0;var hQn=require("net"),Gnt=sc(),tnr=_3(),gQn=YR(),mQn=ev(),Hya=E1(),Kya="ip_resolver";function yQn(r){Hya.trace(Gnt.LogVerbosity.DEBUG,Kya,r)}var rnr="ipv4",nnr="ipv6",Yya=443,Vnt=class{constructor(t,n,i){var o;this.listener=n,this.addresses=[],this.error=null,this.hasReturnedResult=!1,yQn("Resolver constructed for target "+(0,mQn.uriToString)(t));let s=[];if(!(t.scheme===rnr||t.scheme===nnr)){this.error={code:Gnt.Status.UNAVAILABLE,details:`Unrecognized scheme ${t.scheme} in IP resolver`,metadata:new tnr.Metadata};return}let a=t.path.split(",");for(let l of a){let u=(0,mQn.splitHostPort)(l);if(u===null){this.error={code:Gnt.Status.UNAVAILABLE,details:`Failed to parse ${t.scheme} address ${l}`,metadata:new tnr.Metadata};return}if(t.scheme===rnr&&!(0,hQn.isIPv4)(u.host)||t.scheme===nnr&&!(0,hQn.isIPv6)(u.host)){this.error={code:Gnt.Status.UNAVAILABLE,details:`Failed to parse ${t.scheme} address ${l}`,metadata:new tnr.Metadata};return}s.push({host:u.host,port:(o=u.port)!==null&&o!==void 0?o:Yya})}this.addresses=s,yQn("Parsed "+t.scheme+" address list "+this.addresses)}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener.onError(this.error):this.listener.onSuccessfulResolution(this.addresses,null,null,null,{})}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(t){return t.path.split(",")[0]}};function Jya(){(0,gQn.registerResolver)(rnr,Vnt),(0,gQn.registerResolver)(nnr,Vnt)}Hnt.setup=Jya});var IQn=I(dM=>{"use strict";Object.defineProperty(dM,"__esModule",{value:!0});dM.setup=dM.PickFirstLoadBalancer=dM.shuffled=dM.PickFirstLoadBalancingConfig=void 0;var bQn=$z(),V2=YS(),Knt=rq(),Xya=E1(),$ya=sc(),Zya="pick_first";function inr(r){Xya.trace($ya.LogVerbosity.DEBUG,Zya,r)}var GRe="pick_first",e3a=250,VRe=class r{constructor(t){this.shuffleAddressList=t}getLoadBalancerName(){return GRe}toJsonObject(){return{[GRe]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(t){if("shuffleAddressList"in t&&typeof t.shuffleAddressList!="boolean")throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new r(t.shuffleAddressList===!0)}};dM.PickFirstLoadBalancingConfig=VRe;var onr=class{constructor(t){this.subchannel=t}pick(t){return{pickResultType:Knt.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}};function CQn(r){let t=r.slice();for(let n=t.length-1;n>1;n--){let i=Math.floor(Math.random()*(n+1)),o=t[n];t[n]=t[i],t[i]=o}return t}dM.shuffled=CQn;var Ynt=class{constructor(t){this.channelControlHelper=t,this.children=[],this.currentState=V2.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(n,i,o,s,a)=>{this.onSubchannelStateUpdate(n,i,o,a)},this.triedAllSubchannels=!1,this.stickyTransientFailureMode=!1,this.requestedResolutionSinceLastUpdate=!1,this.lastError=null,this.latestAddressList=null,this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(t=>t.hasReportedTransientFailure)}calculateAndReportNewState(){this.currentPick?this.updateState(V2.ConnectivityState.READY,new onr(this.currentPick)):this.children.length===0?this.updateState(V2.ConnectivityState.IDLE,new Knt.QueuePicker(this)):this.stickyTransientFailureMode?this.updateState(V2.ConnectivityState.TRANSIENT_FAILURE,new Knt.UnavailablePicker({details:`No connection established. Last error: ${this.lastError}`})):this.updateState(V2.ConnectivityState.CONNECTING,new Knt.QueuePicker(this))}requestReresolution(){this.requestedResolutionSinceLastUpdate=!0,this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF()&&(this.requestedResolutionSinceLastUpdate||this.requestReresolution(),!this.stickyTransientFailureMode)){this.stickyTransientFailureMode=!0;for(let{subchannel:t}of this.children)t.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){if(this.currentPick!==null){let t=this.currentPick;this.currentPick=null,t.unref(),t.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(t.getChannelzRef())}}onSubchannelStateUpdate(t,n,i,o){var s;if(!((s=this.currentPick)===null||s===void 0)&&s.realSubchannelEquals(t)){i!==V2.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState(),this.requestReresolution());return}for(let[a,l]of this.children.entries())if(t.realSubchannelEquals(l.subchannel)){i===V2.ConnectivityState.READY&&this.pickSubchannel(l.subchannel),i===V2.ConnectivityState.TRANSIENT_FAILURE&&(l.hasReportedTransientFailure=!0,o&&(this.lastError=o),this.maybeEnterStickyTransientFailureMode(),a===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(a+1)),l.subchannel.startConnecting();return}}startNextSubchannelConnecting(t){if(clearTimeout(this.connectionDelayTimeout),!this.triedAllSubchannels){for(let[n,i]of this.children.entries())if(n>=t){let o=i.subchannel.getConnectivityState();if(o===V2.ConnectivityState.IDLE||o===V2.ConnectivityState.CONNECTING){this.startConnecting(n);return}}this.triedAllSubchannels=!0,this.maybeEnterStickyTransientFailureMode()}}startConnecting(t){var n,i;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=t,this.children[t].subchannel.getConnectivityState()===V2.ConnectivityState.IDLE&&(inr("Start connecting to subchannel with address "+this.children[t].subchannel.getAddress()),process.nextTick(()=>{var o;(o=this.children[t])===null||o===void 0||o.subchannel.startConnecting()})),this.connectionDelayTimeout=(i=(n=setTimeout(()=>{this.startNextSubchannelConnecting(t+1)},e3a)).unref)===null||i===void 0?void 0:i.call(n)}pickSubchannel(t){this.currentPick&&t.realSubchannelEquals(this.currentPick)||(inr("Pick subchannel with address "+t.getAddress()),this.stickyTransientFailureMode=!1,this.currentPick!==null&&(this.currentPick.unref(),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeConnectivityStateListener(this.subchannelStateListener)),this.currentPick=t,t.ref(),this.channelControlHelper.addChannelzChild(t.getChannelzRef()),this.resetSubchannelList(),clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState())}updateState(t,n){inr(V2.ConnectivityState[this.currentState]+" -> "+V2.ConnectivityState[t]),this.currentState=t,this.channelControlHelper.updateState(t,n)}resetSubchannelList(){for(let t of this.children)this.currentPick&&t.subchannel.realSubchannelEquals(this.currentPick)||t.subchannel.removeConnectivityStateListener(this.subchannelStateListener),t.subchannel.unref(),this.channelControlHelper.removeChannelzChild(t.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[],this.triedAllSubchannels=!1,this.requestedResolutionSinceLastUpdate=!1}connectToAddressList(t){let n=t.map(i=>({subchannel:this.channelControlHelper.createSubchannel(i,{}),hasReportedTransientFailure:!1}));for(let{subchannel:i}of n)i.ref(),this.channelControlHelper.addChannelzChild(i.getChannelzRef());this.resetSubchannelList(),this.children=n;for(let{subchannel:i}of this.children)if(i.addConnectivityStateListener(this.subchannelStateListener),i.getConnectivityState()===V2.ConnectivityState.READY){this.pickSubchannel(i);return}for(let i of this.children)i.subchannel.getConnectivityState()===V2.ConnectivityState.TRANSIENT_FAILURE&&(i.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(t,n){n instanceof VRe&&(n.getShuffleAddressList()&&(t=CQn(t)),this.latestAddressList=t,this.connectToAddressList(t))}exitIdle(){this.currentState===V2.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return GRe}};dM.PickFirstLoadBalancer=Ynt;function t3a(){(0,bQn.registerLoadBalancerType)(GRe,Ynt,VRe),(0,bQn.registerDefaultLoadBalancerType)(GRe)}dM.setup=t3a});var SQn=I(Zde=>{"use strict";Object.defineProperty(Zde,"__esModule",{value:!0});Zde.setup=Zde.RoundRobinLoadBalancer=void 0;var r3a=$z(),H2=YS(),Jnt=rq(),n3a=XR(),i3a=E1(),o3a=sc(),s3a="round_robin";function vQn(r){i3a.trace(o3a.LogVerbosity.DEBUG,s3a,r)}var Xnt="round_robin",snr=class r{getLoadBalancerName(){return Xnt}constructor(){}toJsonObject(){return{[Xnt]:{}}}static createFromJson(t){return new r}},anr=class{constructor(t,n=0){this.subchannelList=t,this.nextIndex=n}pick(t){let n=this.subchannelList[this.nextIndex];return this.nextIndex=(this.nextIndex+1)%this.subchannelList.length,{pickResultType:Jnt.PickResultType.COMPLETE,subchannel:n,status:null,onCallStarted:null,onCallEnded:null}}peekNextSubchannel(){return this.subchannelList[this.nextIndex]}},$nt=class{constructor(t){this.channelControlHelper=t,this.subchannels=[],this.currentState=H2.ConnectivityState.IDLE,this.currentReadyPicker=null,this.lastError=null,this.subchannelStateListener=(n,i,o,s,a)=>{this.calculateAndUpdateState(),(o===H2.ConnectivityState.TRANSIENT_FAILURE||o===H2.ConnectivityState.IDLE)&&(a&&(this.lastError=a),this.channelControlHelper.requestReresolution(),n.startConnecting())}}countSubchannelsWithState(t){return this.subchannels.filter(n=>n.getConnectivityState()===t).length}calculateAndUpdateState(){if(this.countSubchannelsWithState(H2.ConnectivityState.READY)>0){let t=this.subchannels.filter(i=>i.getConnectivityState()===H2.ConnectivityState.READY),n=0;this.currentReadyPicker!==null&&(n=t.indexOf(this.currentReadyPicker.peekNextSubchannel()),n<0&&(n=0)),this.updateState(H2.ConnectivityState.READY,new anr(t,n))}else this.countSubchannelsWithState(H2.ConnectivityState.CONNECTING)>0?this.updateState(H2.ConnectivityState.CONNECTING,new Jnt.QueuePicker(this)):this.countSubchannelsWithState(H2.ConnectivityState.TRANSIENT_FAILURE)>0?this.updateState(H2.ConnectivityState.TRANSIENT_FAILURE,new Jnt.UnavailablePicker({details:`No connection established. Last error: ${this.lastError}`})):this.updateState(H2.ConnectivityState.IDLE,new Jnt.QueuePicker(this))}updateState(t,n){vQn(H2.ConnectivityState[this.currentState]+" -> "+H2.ConnectivityState[t]),t===H2.ConnectivityState.READY?this.currentReadyPicker=n:this.currentReadyPicker=null,this.currentState=t,this.channelControlHelper.updateState(t,n)}resetSubchannelList(){for(let t of this.subchannels)t.removeConnectivityStateListener(this.subchannelStateListener),t.unref(),this.channelControlHelper.removeChannelzChild(t.getChannelzRef());this.subchannels=[]}updateAddressList(t,n){this.resetSubchannelList(),vQn("Connect to address list "+t.map(i=>(0,n3a.subchannelAddressToString)(i))),this.subchannels=t.map(i=>this.channelControlHelper.createSubchannel(i,{}));for(let i of this.subchannels){i.ref(),i.addConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.addChannelzChild(i.getChannelzRef());let o=i.getConnectivityState();(o===H2.ConnectivityState.IDLE||o===H2.ConnectivityState.TRANSIENT_FAILURE)&&i.startConnecting()}this.calculateAndUpdateState()}exitIdle(){for(let t of this.subchannels)t.startConnecting()}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return Xnt}};Zde.RoundRobinLoadBalancer=$nt;function a3a(){(0,r3a.registerLoadBalancerType)(Xnt,$nt,snr)}Zde.setup=a3a});var TQn=I(_i=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});_i.experimental=_i.addAdminServicesToServer=_i.getChannelzHandlers=_i.getChannelzServiceDefinition=_i.InterceptorConfigurationError=_i.InterceptingCall=_i.RequesterBuilder=_i.ListenerBuilder=_i.StatusBuilder=_i.getClientChannel=_i.ServerCredentials=_i.Server=_i.setLogVerbosity=_i.setLogger=_i.load=_i.loadObject=_i.CallCredentials=_i.ChannelCredentials=_i.waitForClientReady=_i.closeClient=_i.Channel=_i.makeGenericClientConstructor=_i.makeClientConstructor=_i.loadPackageDefinition=_i.Client=_i.compressionAlgorithms=_i.propagate=_i.connectivityState=_i.status=_i.logVerbosity=_i.Metadata=_i.credentials=void 0;var Znt=ner();Object.defineProperty(_i,"CallCredentials",{enumerable:!0,get:function(){return Znt.CallCredentials}});var l3a=Per();Object.defineProperty(_i,"Channel",{enumerable:!0,get:function(){return l3a.ChannelImplementation}});var c3a=prr();Object.defineProperty(_i,"compressionAlgorithms",{enumerable:!0,get:function(){return c3a.CompressionAlgorithms}});var u3a=YS();Object.defineProperty(_i,"connectivityState",{enumerable:!0,get:function(){return u3a.ConnectivityState}});var eit=Art();Object.defineProperty(_i,"ChannelCredentials",{enumerable:!0,get:function(){return eit.ChannelCredentials}});var OQn=Ner();Object.defineProperty(_i,"Client",{enumerable:!0,get:function(){return OQn.Client}});var lnr=sc();Object.defineProperty(_i,"logVerbosity",{enumerable:!0,get:function(){return lnr.LogVerbosity}});Object.defineProperty(_i,"status",{enumerable:!0,get:function(){return lnr.Status}});Object.defineProperty(_i,"propagate",{enumerable:!0,get:function(){return lnr.Propagate}});var wQn=E1(),cnr=Qer();Object.defineProperty(_i,"loadPackageDefinition",{enumerable:!0,get:function(){return cnr.loadPackageDefinition}});Object.defineProperty(_i,"makeClientConstructor",{enumerable:!0,get:function(){return cnr.makeClientConstructor}});Object.defineProperty(_i,"makeGenericClientConstructor",{enumerable:!0,get:function(){return cnr.makeClientConstructor}});var d3a=_3();Object.defineProperty(_i,"Metadata",{enumerable:!0,get:function(){return d3a.Metadata}});var p3a=sQn();Object.defineProperty(_i,"Server",{enumerable:!0,get:function(){return p3a.Server}});var A3a=Frr();Object.defineProperty(_i,"ServerCredentials",{enumerable:!0,get:function(){return A3a.ServerCredentials}});var f3a=aQn();Object.defineProperty(_i,"StatusBuilder",{enumerable:!0,get:function(){return f3a.StatusBuilder}});_i.credentials={combineChannelCredentials:(r,...t)=>t.reduce((n,i)=>n.compose(i),r),combineCallCredentials:(r,...t)=>t.reduce((n,i)=>n.compose(i),r),createInsecure:eit.ChannelCredentials.createInsecure,createSsl:eit.ChannelCredentials.createSsl,createFromSecureContext:eit.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:Znt.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:Znt.CallCredentials.createFromGoogleCredential,createEmpty:Znt.CallCredentials.createEmpty};var h3a=r=>r.close();_i.closeClient=h3a;var g3a=(r,t,n)=>r.waitForReady(t,n);_i.waitForClientReady=g3a;var m3a=(r,t)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};_i.loadObject=m3a;var y3a=(r,t,n)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};_i.load=y3a;var E3a=r=>{wQn.setLogger(r)};_i.setLogger=E3a;var b3a=r=>{wQn.setLoggerVerbosity(r)};_i.setLogVerbosity=b3a;var C3a=r=>OQn.Client.prototype.getChannel.call(r);_i.getClientChannel=C3a;var tit=Mer();Object.defineProperty(_i,"ListenerBuilder",{enumerable:!0,get:function(){return tit.ListenerBuilder}});Object.defineProperty(_i,"RequesterBuilder",{enumerable:!0,get:function(){return tit.RequesterBuilder}});Object.defineProperty(_i,"InterceptingCall",{enumerable:!0,get:function(){return tit.InterceptingCall}});Object.defineProperty(_i,"InterceptorConfigurationError",{enumerable:!0,get:function(){return tit.InterceptorConfigurationError}});var _Qn=Cee();Object.defineProperty(_i,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return _Qn.getChannelzServiceDefinition}});Object.defineProperty(_i,"getChannelzHandlers",{enumerable:!0,get:function(){return _Qn.getChannelzHandlers}});var I3a=Irt();Object.defineProperty(_i,"addAdminServicesToServer",{enumerable:!0,get:function(){return I3a.addAdminServicesToServer}});var v3a=$rr();_i.experimental=v3a;var S3a=Ztr(),O3a=fQn(),w3a=EQn(),_3a=IQn(),T3a=SQn(),B3a=Xrr(),R3a=Cee();S3a.setup(),O3a.setup(),w3a.setup(),_3a.setup(),T3a.setup(),B3a.setup(),R3a.setup()});var xUn,DUn=be(()=>{xUn=typeof globalThis=="object"?globalThis:global});var NUn=be(()=>{DUn()});var PUn=be(()=>{NUn()});var CP,zsr=be(()=>{CP="1.9.0"});function $5a(r){var t=new Set([r]),n=new Set,i=r.match(kUn);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(u){return u===r};function s(l){return n.add(l),!1}function a(l){return t.add(l),!0}return function(u){if(t.has(u))return!0;if(n.has(u))return!1;var c=u.match(kUn);if(!c)return s(u);var d={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return d.prerelease!=null||o.major!==d.major?s(u):o.major===0?o.minor===d.minor&&o.patch<=d.patch?a(u):s(u):o.minor<=d.minor?a(u):s(u)}}var kUn,QUn,LUn=be(()=>{zsr();kUn=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;QUn=$5a(CP)});function SM(r,t,n,i){var o;i===void 0&&(i=!1);var s=KMe[HMe]=(o=KMe[HMe])!==null&&o!==void 0?o:{version:CP};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!==CP){var a=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+r+" does not match previously registered API v"+CP);return n.error(a.stack||a.message),!1}return s[r]=t,n.debug("@opentelemetry/api: Registered a global for "+r+" v"+CP+"."),!0}function sv(r){var t,n,i=(t=KMe[HMe])===null||t===void 0?void 0:t.version;if(!(!i||!QUn(i)))return(n=KMe[HMe])===null||n===void 0?void 0:n[r]}function OM(r,t){t.debug("@opentelemetry/api: Unregistering a global for "+r+" v"+CP+".");var n=KMe[HMe];n&&delete n[r]}var Z5a,HMe,KMe,ste=be(()=>{PUn();zsr();LUn();Z5a=CP.split(".")[0],HMe=Symbol.for("opentelemetry.js.api."+Z5a),KMe=xUn});function YMe(r,t,n){var i=sv("diag");if(i)return n.unshift(t),i[r].apply(i,twa([],ewa(n),!1))}var ewa,twa,FUn,zUn=be(()=>{ste();ewa=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},twa=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))},FUn=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 YMe("debug",this._namespace,t)},r.prototype.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YMe("error",this._namespace,t)},r.prototype.info=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YMe("info",this._namespace,t)},r.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YMe("warn",this._namespace,t)},r.prototype.verbose=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return YMe("verbose",this._namespace,t)},r}()});var hm,Pot=be(()=>{(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"})(hm||(hm={}))});function qUn(r,t){r<hm.NONE?r=hm.NONE:r>hm.ALL&&(r=hm.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",hm.ERROR),warn:n("warn",hm.WARN),info:n("info",hm.INFO),debug:n("debug",hm.DEBUG),verbose:n("verbose",hm.VERBOSE)}}var UUn=be(()=>{Pot()});var rwa,nwa,iwa,X2,ate=be(()=>{zUn();UUn();Pot();ste();rwa=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},nwa=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))},iwa="diag",X2=function(){function r(){function t(o){return function(){for(var s=[],a=0;a<arguments.length;a++)s[a]=arguments[a];var l=sv("diag");if(l)return l[o].apply(l,nwa([],rwa(s),!1))}}var n=this,i=function(o,s){var a,l,u;if(s===void 0&&(s={logLevel:hm.INFO}),o===n){var c=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=c.stack)!==null&&a!==void 0?a:c.message),!1}typeof s=="number"&&(s={logLevel:s});var d=sv("diag"),p=qUn((l=s.logLevel)!==null&&l!==void 0?l:hm.INFO,o);if(d&&!s.suppressOverrideMessage){var A=(u=new Error().stack)!==null&&u!==void 0?u:"<failed to generate stacktrace>";d.warn("Current logger will be overwritten from "+A),p.warn("Current logger will overwrite one already registered from "+A)}return SM("diag",p,n,!0)};n.setLogger=i,n.disable=function(){OM(iwa,n)},n.createComponentLogger=function(o){return new FUn(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 owa,swa,jUn,WUn=be(()=>{owa=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},swa=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.")},jUn=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=owa(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=swa(i),l=a.next();!l.done;l=a.next()){var u=l.value;s._entries.delete(u)}}catch(c){t={error:c}}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 GUn,VUn=be(()=>{GUn=Symbol("BaggageEntryMetadata")});function HUn(r){return r===void 0&&(r={}),new jUn(new Map(Object.entries(r)))}function KUn(r){return typeof r!="string"&&(awa.error("Cannot create baggage metadata from unknown type: "+typeof r),r=""),{__TYPE__:GUn,toString:function(){return r}}}var awa,qsr=be(()=>{ate();WUn();VUn();awa=X2.instance()});function i1e(r){return Symbol.for(r)}var lwa,kot,JMe=be(()=>{lwa=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}(),kot=new lwa});var Usr,YUn,JUn=be(()=>{Usr=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],YUn=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<Usr.length;n++)this[Usr[n].n]=t(Usr[n].c)}return r}()});function XUn(){return Wsr}var lte,cwa,Qot,uwa,dwa,pwa,Awa,jsr,fwa,hwa,gwa,Wsr,mwa,ywa,Ewa,bwa,Cwa,Iwa,vwa,Gsr=be(()=>{lte=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)}}(),cwa=function(){function r(){}return r.prototype.createGauge=function(t,n){return ywa},r.prototype.createHistogram=function(t,n){return Ewa},r.prototype.createCounter=function(t,n){return mwa},r.prototype.createUpDownCounter=function(t,n){return bwa},r.prototype.createObservableGauge=function(t,n){return Iwa},r.prototype.createObservableCounter=function(t,n){return Cwa},r.prototype.createObservableUpDownCounter=function(t,n){return vwa},r.prototype.addBatchObservableCallback=function(t,n){},r.prototype.removeBatchObservableCallback=function(t){},r}(),Qot=function(){function r(){}return r}(),uwa=function(r){lte(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.add=function(n,i){},t}(Qot),dwa=function(r){lte(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.add=function(n,i){},t}(Qot),pwa=function(r){lte(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.record=function(n,i){},t}(Qot),Awa=function(r){lte(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.record=function(n,i){},t}(Qot),jsr=function(){function r(){}return r.prototype.addCallback=function(t){},r.prototype.removeCallback=function(t){},r}(),fwa=function(r){lte(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(jsr),hwa=function(r){lte(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(jsr),gwa=function(r){lte(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t}(jsr),Wsr=new cwa,mwa=new uwa,ywa=new pwa,Ewa=new Awa,bwa=new dwa,Cwa=new fwa,Iwa=new hwa,vwa=new gwa});var Lot,$Un=be(()=>{(function(r){r[r.INT=0]="INT",r[r.DOUBLE=1]="DOUBLE"})(Lot||(Lot={}))});var Fot,zot,Vsr=be(()=>{Fot={get:function(r,t){if(r!=null)return r[t]},keys:function(r){return r==null?[]:Object.keys(r)}},zot={set:function(r,t,n){r!=null&&(r[t]=n)}}});var Swa,Owa,ZUn,ejn=be(()=>{JMe();Swa=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},Owa=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))},ZUn=function(){function r(){}return r.prototype.active=function(){return kot},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,Owa([i],Swa(o),!1))},r.prototype.bind=function(t,n){return n},r.prototype.enable=function(){return this},r.prototype.disable=function(){return this},r}()});var wwa,_wa,Hsr,Twa,Kq,XMe=be(()=>{ejn();ste();ate();wwa=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},_wa=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))},Hsr="context",Twa=new ZUn,Kq=function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalContextManager=function(t){return SM(Hsr,t,X2.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,_wa([t,n,i],wwa(s),!1))},r.prototype.bind=function(t,n){return this._getContextManager().bind(t,n)},r.prototype._getContextManager=function(){return sv(Hsr)||Twa},r.prototype.disable=function(){this._getContextManager().disable(),OM(Hsr,X2.instance())},r}()});var o1e,Ksr=be(()=>{(function(r){r[r.NONE=0]="NONE",r[r.SAMPLED=1]="SAMPLED"})(o1e||(o1e={}))});var $Me,ZMe,qot,Uot=be(()=>{Ksr();$Me="0000000000000000",ZMe="00000000000000000000000000000000",qot={traceId:ZMe,spanId:$Me,traceFlags:o1e.NONE}});var Yq,jot=be(()=>{Uot();Yq=function(){function r(t){t===void 0&&(t=qot),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 Wot(r){return r.getValue(Ysr)||void 0}function tjn(){return Wot(Kq.getInstance().active())}function e8e(r,t){return r.setValue(Ysr,t)}function rjn(r){return r.deleteValue(Ysr)}function njn(r,t){return e8e(r,new Yq(t))}function Got(r){var t;return(t=Wot(r))===null||t===void 0?void 0:t.spanContext()}var Ysr,Jsr=be(()=>{JMe();jot();XMe();Ysr=i1e("OpenTelemetry Context Key SPAN")});function Xsr(r){return Bwa.test(r)&&r!==ZMe}function $sr(r){return Rwa.test(r)&&r!==$Me}function s1e(r){return Xsr(r.traceId)&&$sr(r.spanId)}function ijn(r){return new Yq(r)}var Bwa,Rwa,Vot=be(()=>{Uot();jot();Bwa=/^([0-9a-f]{32})$/i,Rwa=/^[0-9a-f]{16}$/i});function Mwa(r){return typeof r=="object"&&typeof r.spanId=="string"&&typeof r.traceId=="string"&&typeof r.traceFlags=="number"}var Zsr,Hot,ear=be(()=>{XMe();Jsr();jot();Vot();Zsr=Kq.getInstance(),Hot=function(){function r(){}return r.prototype.startSpan=function(t,n,i){i===void 0&&(i=Zsr.active());var o=!!n?.root;if(o)return new Yq;var s=i&&Got(i);return Mwa(s)&&s1e(s)?new Yq(s):new Yq},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 u=a??Zsr.active(),c=this.startSpan(t,s,u),d=e8e(u,c);return Zsr.with(d,l,void 0,c)}},r}()});var xwa,Kot,tar=be(()=>{ear();xwa=new Hot,Kot=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):xwa},r}()});var ojn,sjn=be(()=>{ear();ojn=function(){function r(){}return r.prototype.getTracer=function(t,n,i){return new Hot},r}()});var Dwa,t8e,rar=be(()=>{tar();sjn();Dwa=new ojn,t8e=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 Kot(this,t,n,i)},r.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Dwa},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 Yot,ajn=be(()=>{(function(r){r[r.NOT_RECORD=0]="NOT_RECORD",r[r.RECORD=1]="RECORD",r[r.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Yot||(Yot={}))});var Jot,ljn=be(()=>{(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"})(Jot||(Jot={}))});var Xot,cjn=be(()=>{(function(r){r[r.UNSET=0]="UNSET",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR"})(Xot||(Xot={}))});function ujn(r){return kwa.test(r)}function djn(r){return Qwa.test(r)&&!Lwa.test(r)}var nar,Nwa,Pwa,kwa,Qwa,Lwa,pjn=be(()=>{nar="[_0-9a-z-*/]",Nwa="[a-z]"+nar+"{0,255}",Pwa="[a-z0-9]"+nar+"{0,240}@[a-z]"+nar+"{0,13}",kwa=new RegExp("^(?:"+Nwa+"|"+Pwa+")$"),Qwa=/^[ -~]{0,255}[!-~]$/,Lwa=/,|=/});var Ajn,Fwa,fjn,hjn,gjn,mjn=be(()=>{pjn();Ajn=32,Fwa=512,fjn=",",hjn="=",gjn=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+hjn+t.get(i)),n},[]).join(fjn)},r.prototype._parse=function(t){t.length>Fwa||(this._internalState=t.split(fjn).reverse().reduce(function(n,i){var o=i.trim(),s=o.indexOf(hjn);if(s!==-1){var a=o.slice(0,s),l=o.slice(s+1,i.length);ujn(a)&&djn(l)&&n.set(a,l)}return n},new Map),this._internalState.size>Ajn&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,Ajn))))},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 yjn(r){return new gjn(r)}var Ejn=be(()=>{mjn()});var iar,bjn=be(()=>{XMe();iar=Kq.getInstance()});var oar,Cjn=be(()=>{ate();oar=X2.instance()});var zwa,Ijn,vjn=be(()=>{Gsr();zwa=function(){function r(){}return r.prototype.getMeter=function(t,n,i){return Wsr},r}(),Ijn=new zwa});var sar,Sjn,Ojn=be(()=>{vjn();ste();ate();sar="metrics",Sjn=function(){function r(){}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalMeterProvider=function(t){return SM(sar,t,X2.instance())},r.prototype.getMeterProvider=function(){return sv(sar)||Ijn},r.prototype.getMeter=function(t,n,i){return this.getMeterProvider().getMeter(t,n,i)},r.prototype.disable=function(){OM(sar,X2.instance())},r}()});var aar,wjn=be(()=>{Ojn();aar=Sjn.getInstance()});var _jn,Tjn=be(()=>{_jn=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 car(r){return r.getValue(lar)||void 0}function Bjn(){return car(Kq.getInstance().active())}function Rjn(r,t){return r.setValue(lar,t)}function Mjn(r){return r.deleteValue(lar)}var lar,xjn=be(()=>{XMe();JMe();lar=i1e("OpenTelemetry Baggage Key")});var uar,qwa,Djn,Njn=be(()=>{ste();Tjn();Vsr();xjn();qsr();ate();uar="propagation",qwa=new _jn,Djn=function(){function r(){this.createBaggage=HUn,this.getBaggage=car,this.getActiveBaggage=Bjn,this.setBaggage=Rjn,this.deleteBaggage=Mjn}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalPropagator=function(t){return SM(uar,t,X2.instance())},r.prototype.inject=function(t,n,i){return i===void 0&&(i=zot),this._getGlobalPropagator().inject(t,n,i)},r.prototype.extract=function(t,n,i){return i===void 0&&(i=Fot),this._getGlobalPropagator().extract(t,n,i)},r.prototype.fields=function(){return this._getGlobalPropagator().fields()},r.prototype.disable=function(){OM(uar,X2.instance())},r.prototype._getGlobalPropagator=function(){return sv(uar)||qwa},r}()});var dar,Pjn=be(()=>{Njn();dar=Djn.getInstance()});var par,kjn,Qjn=be(()=>{ste();rar();Vot();Jsr();ate();par="trace",kjn=function(){function r(){this._proxyTracerProvider=new t8e,this.wrapSpanContext=ijn,this.isSpanContextValid=s1e,this.deleteSpan=rjn,this.getSpan=Wot,this.getActiveSpan=tjn,this.getSpanContext=Got,this.setSpan=e8e,this.setSpanContext=njn}return r.getInstance=function(){return this._instance||(this._instance=new r),this._instance},r.prototype.setGlobalTracerProvider=function(t){var n=SM(par,this._proxyTracerProvider,X2.instance());return n&&this._proxyTracerProvider.setDelegate(t),n},r.prototype.getTracerProvider=function(){return sv(par)||this._proxyTracerProvider},r.prototype.getTracer=function(t,n){return this.getTracerProvider().getTracer(t,n)},r.prototype.disable=function(){OM(par,X2.instance()),this._proxyTracerProvider=new t8e},r}()});var av,Ljn=be(()=>{Qjn();av=kjn.getInstance()});var Fjn={};o3(Fjn,{DiagConsoleLogger:()=>YUn,DiagLogLevel:()=>hm,INVALID_SPANID:()=>$Me,INVALID_SPAN_CONTEXT:()=>qot,INVALID_TRACEID:()=>ZMe,ProxyTracer:()=>Kot,ProxyTracerProvider:()=>t8e,ROOT_CONTEXT:()=>kot,SamplingDecision:()=>Yot,SpanKind:()=>Jot,SpanStatusCode:()=>Xot,TraceFlags:()=>o1e,ValueType:()=>Lot,baggageEntryMetadataFromString:()=>KUn,context:()=>iar,createContextKey:()=>i1e,createNoopMeter:()=>XUn,createTraceState:()=>yjn,default:()=>Uwa,defaultTextMapGetter:()=>Fot,defaultTextMapSetter:()=>zot,diag:()=>oar,isSpanContextValid:()=>s1e,isValidSpanId:()=>$sr,isValidTraceId:()=>Xsr,metrics:()=>aar,propagation:()=>dar,trace:()=>av});var Uwa,cte=be(()=>{qsr();JMe();JUn();Pot();Gsr();$Un();Vsr();tar();rar();ajn();ljn();cjn();Ksr();Ejn();Vot();Uot();bjn();Cjn();wjn();Pjn();Ljn();Uwa={context:iar,diag:oar,metrics:aar,propagation:dar,trace:av}});function Gwa(){let r,t;return{promise:new Promise((n,i)=>{r=n,t=i}),resolve:r,reject:t}}function Vwa(r,t){return[...r,t]}function Hwa(r,t){return[...r.slice(0,t),...r.slice(t+1)]}function Kwa(r,t){let n=r.indexOf(t);return n!==-1?Hwa(r,n):r}var qjn,Aar,jwa,Wwa,$ot,far=be(()=>{Aar=new WeakMap,jwa=()=>{},Wwa=class Jq{constructor(t){this.subscribers=[],this.settlement=null,this[qjn]="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=Gwa();this.subscribers=Vwa(this.subscribers,o),t=o.promise,n=()=>{this.subscribers!==null&&(this.subscribers=Kwa(this.subscribers,o))}}else{let{status:o}=i;o==="fulfilled"?t=Promise.resolve(i.value):t=Promise.reject(i.reason),n=jwa}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=Jq.getSubscribablePromise(t);return typeof n<"u"?n:Jq.createSubscribablePromise(t)}static createSubscribablePromise(t){let n=new Jq(t);return Aar.set(t,n),Aar.set(n,n),n}static getSubscribablePromise(t){return Aar.get(t)}static resolve(t){return Jq.proxy(t).subscribe()}static async any(t){let n=t.map(Jq.resolve);try{return await Promise.any(n)}finally{n.forEach(({unsubscribe:i})=>{i()})}}static async race(t){let n=t.map(Jq.resolve);try{return await Promise.race(n)}finally{n.forEach(({unsubscribe:i})=>{i()})}}static async raceSingletons(t){let n=t.map(i=>Jq.proxy(i).then(()=>[i]));try{return await Promise.race(n)}finally{for(let i of n)i.unsubscribe()}}};qjn=Symbol.toStringTag;$ot=Wwa});var ute,Hh,Ywa,Ujn=be(()=>{"use strict";qt();far();I$e();ute=class extends Ye{},Hh=async(r,t,n)=>{let i=Ywa(r),o=i.promise.then(()=>{throw new ute(t)});return await $ot.race([n,o]).finally(i.cancel)},Ywa=r=>{let t=g3(),n=setTimeout(t.resolve,r),i=()=>clearTimeout(n);return{promise:t.promise,cancel:i}}});var w$0,jjn=be(()=>{"use strict";w$0=global.setImmediate??setTimeout});var r6=be(()=>{"use strict";Ujn();jjn()});var har,Wjn=be(()=>{"use strict";f1();har=(r,t,n,...i)=>{let o=ua(),s={...t,area:r};o[n](...i,s)}});var Xq,Zot,n6,a1e,est=be(()=>{"use strict";qt();f1();Wjn();Xq=class{valid=!1;failures;originalValue;constructor(t,n){this.originalValue=wR(t),this.failures=n}get failureMessage(){return this.failures.map(t=>t.path.length>0?`${t.path}: ${t.message}`:t.message).join(`
|
|
125
125
|
`)}},Zot=null,n6=class extends Ye{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}},a1e=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:u,errorMessage:c}=i||{},d=this.validate(t),p=i?.additionalValidation?.(t)||{valid:!0},A=p.valid?d:p;if(!A.valid){let f=typeof c=="function"?c(A):c??`Found ${A.failures.length} validation failure(s) for ${this.name}`,h=new n6(f,A,u);if(a!==Zot){let y=t;y&&typeof y=="object"&&(y=wR(y)),har(s,o,a||"error",h,y)}if(n)throw h;return t}return l&&har(s,o,l,`${this.name} validation succeeded`,t),A.value}}});var gar,Ob,mar=be(()=>{"use strict";f1();qt();est();gar=class extends a1e{constructor(n,i){super(n);this.runtype=i;if(!i)throw new Ye(`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 ua().error(`RuntypesValidator: Unable to validate ${this.name} value. `,`
|
|
126
126
|
Error: `,i,`
|
|
127
|
-
Value: `,n),new Xq(n,[{path:"",message:"value triggered unknown runtypes error"}])}}createValidationFailedResult(n,i){let o=[],s=(a,l)=>{for(let[u,c]of Object.entries(l)){let d=a.concat(u);typeof c=="string"?o.push({path:d.join("."),message:c}):s(d,c)}};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 Xq(i,o)}},Ob=(r,t)=>new gar(r,t)});var Jwa,Xwa,yar,Ht,Gjn=be(()=>{"use strict";No();qt();f1();est();pr();Jwa=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,Xwa=r=>SGt(r.issues.map(t=>Jwa(t))),yar=class extends a1e{constructor(n,i){super(n);this.zodType=i;if(!i)throw new Ye(`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=mGt(o.unionErrors,a=>Xwa(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 Xq(n,o)}catch(i){let o=i instanceof _.ZodError?[i.flatten(),i.issues]:[];return ua().error(`ZodValidator: Unable to validate ${this.name} value`,"error: ",i,"value: ",n,...o),new Xq(n,[{path:"",message:"value triggered unknown Zod error"}])}}},Ht=(r,t)=>new yar(r,t)});var l1e=be(()=>{"use strict";mar();est();Gjn()});var rst,nst,Kjn,dte=be(()=>{"use strict";rst={emerg:"emerg",info:"info",error:"error",debug:"debug",assert:"assert",warn:"warn",alert:"alert",app:"app"},nst={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"}},Kjn=["Authorization","Token","Password","Secret","idToken","id_token","clientID","clientSecret","apiKey","snowflakeKeyPairKey","snowflakeKeyPairPass","keyPairKey","keyPairPass","key"]});var Tar,lv,r8e=be(()=>{"use strict";Tar=["ACTUAL_STATE","ADVANCED_DEPLOY","APP","AUTH","BULK_WRITE","CLEANUP_TOOL","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","AI_COPILOT"],lv={...Object.fromEntries(Tar.map(r=>[r,{level:"info"}]))}});var c1e,u1e,wb,ist=be(()=>{"use strict";c1e=(r,t,n,i,o)=>({orgID:r,workspaceID:t,userID:n,runID:i,nodeID:o}),u1e=(r,t)=>{r.runID=t},wb={}});var Jjn=I(Yjn=>{"use strict";Object.defineProperty(Yjn,"__esModule",{value:!0})});var Bar=I(ost=>{"use strict";Object.defineProperty(ost,"__esModule",{value:!0});ost.Failcode=void 0;ost.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 p1e=I(d1e=>{"use strict";var e_a=d1e&&d1e.__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(d1e,"__esModule",{value:!0});d1e.ValidationError=void 0;var t_a=function(r){e_a(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);d1e.ValidationError=t_a});var n8e=I(Rar=>{"use strict";Object.defineProperty(Rar,"__esModule",{value:!0});var sst=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||sst(r)(t.underlying);case"union":return t.alternatives.map(sst(r)).join(" | ");case"intersect":return t.intersectees.map(sst(r)).join(" & ");default:break}return"`${".concat(cv(!1,r)(t),"}`")}},ast=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,"}"):ast(r)(t.underlying);case"union":if(t.alternatives.length===1){var n=t.alternatives[0];return ast(r)(n.reflect)}break;case"intersect":if(t.intersectees.length===1){var n=t.intersectees[0];return ast(r)(n.reflect)}break;default:break}return"${".concat(cv(!1,r)(t),"}")}},cv=function(r,t){return function(n){var i=function(c){return r?"(".concat(c,")"):c};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(c){return c===""})){var s=n.runtypes[0];return sst(t)(s.reflect)}var a=!1,l=n.strings.reduce(function(c,d,p){var A=c+d,f=n.runtypes[p];if(f){var h=ast(t)(f.reflect);return!a&&h.startsWith("$")&&(a=!0),A+h}else return A},"");return a?"`".concat(l,"`"):'"'.concat(l,'"')}case"array":return"".concat(Xjn(n)).concat(cv(!0,t)(n.element),"[]");case"dictionary":return"{ [_: ".concat(n.key,"]: ").concat(cv(!1,t)(n.value)," }");case"record":{var u=Object.keys(n.fields);return u.length?"{ ".concat(u.map(function(c){return"".concat(Xjn(n)).concat(c).concat(r_a(n,c),": ").concat(n.fields[c].tag==="optional"?cv(!1,t)(n.fields[c].underlying):cv(!1,t)(n.fields[c]),";")}).join(" ")," }"):"{}"}case"tuple":return"[".concat(n.components.map(cv(!1,t)).join(", "),"]");case"union":return i("".concat(n.alternatives.map(cv(!0,t)).join(" | ")));case"intersect":return i("".concat(n.intersectees.map(cv(!0,t)).join(" & ")));case"optional":return cv(r,t)(n.underlying)+" | undefined";case"constraint":return n.name||cv(r,t)(n.underlying);case"instanceof":return n.ctor.name;case"brand":return cv(r,t)(n.entity)}}finally{t.delete(n)}throw Error("impossible")}};Rar.default=cv(!1,new Set);function r_a(r,t){var n=r.isPartial,i=r.fields;return n||t!==void 0&&i[t].tag==="optional"?"?":""}function Xjn(r){var t=r.isReadonly;return t?"readonly ":""}});var rp=I(yu=>{"use strict";var Mar=yu&&yu.__assign||function(){return Mar=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},Mar.apply(this,arguments)};Object.defineProperty(yu,"__esModule",{value:!0});yu.FAILURE=yu.SUCCESS=yu.enumerableKeysOf=yu.typeOf=yu.hasKey=void 0;var _M=Bar(),pte=n8e();function n_a(r,t){return typeof t=="object"&&t!==null&&r in t}yu.hasKey=n_a;var i_a=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};yu.typeOf=i_a;var o_a=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}):[]};yu.enumerableKeysOf=o_a;function s_a(r){return{success:!0,value:r}}yu.SUCCESS=s_a;yu.FAILURE=Object.assign(function(r,t,n){return Mar({success:!1,code:r,message:t},n?{details:n}:{})},{TYPE_INCORRECT:function(r,t){var n="Expected ".concat(r.tag==="template"?"string ".concat((0,pte.default)(r)):(0,pte.default)(r),", but was ").concat((0,yu.typeOf)(t));return(0,yu.FAILURE)(_M.Failcode.TYPE_INCORRECT,n)},VALUE_INCORRECT:function(r,t,n){return(0,yu.FAILURE)(_M.Failcode.VALUE_INCORRECT,"Expected ".concat(r," ").concat(String(t),", but was ").concat(String(n)))},KEY_INCORRECT:function(r,t,n){return(0,yu.FAILURE)(_M.Failcode.KEY_INCORRECT,"Expected ".concat((0,pte.default)(r)," key to be ").concat((0,pte.default)(t),", but was ").concat((0,yu.typeOf)(n)))},CONTENT_INCORRECT:function(r,t){var n="Expected ".concat((0,pte.default)(r),", but was incompatible");return(0,yu.FAILURE)(_M.Failcode.CONTENT_INCORRECT,n,t)},ARGUMENT_INCORRECT:function(r){return(0,yu.FAILURE)(_M.Failcode.ARGUMENT_INCORRECT,r)},RETURN_INCORRECT:function(r){return(0,yu.FAILURE)(_M.Failcode.RETURN_INCORRECT,r)},CONSTRAINT_FAILED:function(r,t){var n=t?": ".concat(t):"";return(0,yu.FAILURE)(_M.Failcode.CONSTRAINT_FAILED,"Failed constraint check for ".concat((0,pte.default)(r)).concat(n))},PROPERTY_MISSING:function(r){var t="Expected ".concat((0,pte.default)(r),", but was missing");return(0,yu.FAILURE)(_M.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(r){var t="Expected nothing, but was ".concat((0,yu.typeOf)(r));return(0,yu.FAILURE)(_M.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(r){var t="Expected nothing, but was ".concat((0,yu.typeOf)(r));return(0,yu.FAILURE)(_M.Failcode.NOTHING_EXPECTED,t)}})});var $jn=I($q=>{"use strict";var a_a=$q&&$q.__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},l_a=$q&&$q.__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($q,"__esModule",{value:!0});$q.Contract=void 0;var c_a=p1e(),u_a=rp();function d_a(){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 u="Expected ".concat(i.length," arguments but only received ").concat(a.length),c=u_a.FAILURE.ARGUMENT_INCORRECT(u);throw new c_a.ValidationError(c)}for(var d=0;d<i.length;d++)i[d].check(a[d]);return o.check(s.apply(void 0,l_a([],a_a(a),!1)))}}}}$q.Contract=d_a});var tWn=I(Zq=>{"use strict";var p_a=Zq&&Zq.__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},A_a=Zq&&Zq.__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(Zq,"__esModule",{value:!0});Zq.AsyncContract=void 0;var Zjn=p1e(),eWn=rp();function f_a(){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 u="Expected ".concat(i.length," arguments but only received ").concat(a.length),c=eWn.FAILURE.ARGUMENT_INCORRECT(u);throw new Zjn.ValidationError(c)}for(var d=0;d<i.length;d++)i[d].check(a[d]);var p=s.apply(void 0,A_a([],p_a(a),!1));if(!(p instanceof Promise)){var u="Expected function to return a promise, but instead got ".concat(p),c=eWn.FAILURE.RETURN_INCORRECT(u);throw new Zjn.ValidationError(c)}return p.then(o.check)}}}}Zq.AsyncContract=f_a});var rWn=I(TM=>{"use strict";var h_a=TM&&TM.__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.")},g_a=TM&&TM.__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(TM,"__esModule",{value:!0});TM.when=TM.match=void 0;function m_a(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return function(n){var i,o;try{for(var s=h_a(r),a=s.next();!a.done;a=s.next()){var l=g_a(a.value,2),u=l[0],c=l[1];if(u.guard(n))return c(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")}}TM.match=m_a;function y_a(r,t){return[r,t]}TM.when=y_a});var I1=I(tU=>{"use strict";Object.defineProperty(tU,"__esModule",{value:!0});tU.innerValidate=tU.create=tU.isRuntype=void 0;var eU=uO(),E_a=n8e(),b_a=p1e(),nWn=rp(),iWn=Symbol(),C_a=function(r){return(0,nWn.hasKey)(iWn,r)};tU.isRuntype=C_a;function I_a(r,t){return t[iWn]=!0,t.check=n,t.assert=n,t._innerValidate=function(p,A){return A.has(p,t)?(0,nWn.SUCCESS)(p):r(p,A)},t.validate=function(p){return t._innerValidate(p,S_a())},t.guard=i,t.Or=o,t.And=s,t.optional=a,t.nullable=l,t.withConstraint=u,t.withGuard=c,t.withBrand=d,t.reflect=t,t.toString=function(){return"Runtype<".concat((0,E_a.default)(t),">")},t;function n(p){var A=t.validate(p);if(A.success)return A.value;throw new b_a.ValidationError(A)}function i(p){return t.validate(p).success}function o(p){return(0,eU.Union)(t,p)}function s(p){return(0,eU.Intersect)(t,p)}function a(){return(0,eU.Optional)(t)}function l(){return(0,eU.Union)(t,eU.Null)}function u(p,A){return(0,eU.Constraint)(t,p,A)}function c(p,A){return(0,eU.Constraint)(t,p,A)}function d(p){return(0,eU.Brand)(p,t)}}tU.create=I_a;function v_a(r,t,n){return r._innerValidate(t,n)}tU.innerValidate=v_a;function S_a(){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 cst=I(lst=>{"use strict";Object.defineProperty(lst,"__esModule",{value:!0});lst.Unknown=void 0;var O_a=I1(),w_a=rp(),__a={tag:"unknown"};lst.Unknown=(0,O_a.create)(function(r){return(0,w_a.SUCCESS)(r)},__a)});var oWn=I(ust=>{"use strict";Object.defineProperty(ust,"__esModule",{value:!0});ust.Never=void 0;var T_a=I1(),B_a=rp(),R_a={tag:"never"};ust.Never=(0,T_a.create)(B_a.FAILURE.NOTHING_EXPECTED,R_a)});var sWn=I(dst=>{"use strict";Object.defineProperty(dst,"__esModule",{value:!0});dst.Void=void 0;var M_a=cst();dst.Void=M_a.Unknown});var xar=I(A1e=>{"use strict";var pst=A1e&&A1e.__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(A1e,"__esModule",{value:!0});A1e.Union=void 0;var Ast=I1(),i8e=rp();function x_a(){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,Ast.create)(function(o,s){var a,l,u,c,d,p,A,f;if(typeof o!="object"||o===null){try{for(var h=pst(r),y=h.next();!y.done;y=h.next()){var C=y.value;if((0,Ast.innerValidate)(C,o,s).success)return(0,i8e.SUCCESS)(o)}}catch(Y){a={error:Y}}finally{try{y&&!y.done&&(l=h.return)&&l.call(h)}finally{if(a)throw a.error}}return i8e.FAILURE.TYPE_INCORRECT(i,o)}var O={};try{for(var w=pst(r),T=w.next();!T.done;T=w.next()){var C=T.value;if(C.reflect.tag==="record"){var R=function(j){var k=C.reflect.fields[j];k.tag==="literal"&&(O[j]?O[j].every(function(X){return X!==k.value})&&O[j].push(k.value):O[j]=[k.value])};for(var P in C.reflect.fields)R(P)}}}catch(Y){u={error:Y}}finally{try{T&&!T.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var P in O)if(O[P].length===r.length)try{for(var z=(d=void 0,pst(r)),q=z.next();!q.done;q=z.next()){var C=q.value;if(C.reflect.tag==="record"){var H=C.reflect.fields[P];if(H.tag==="literal"&&(0,i8e.hasKey)(P,o)&&o[P]===H.value)return(0,Ast.innerValidate)(C,o,s)}}}catch(j){d={error:j}}finally{try{q&&!q.done&&(p=z.return)&&p.call(z)}finally{if(d)throw d.error}}try{for(var V=pst(r),U=V.next();!U.done;U=V.next()){var Q=U.value;if((0,Ast.innerValidate)(Q,o,s).success)return(0,i8e.SUCCESS)(o)}}catch(Y){A={error:Y}}finally{try{U&&!U.done&&(f=V.return)&&f.call(V)}finally{if(A)throw A.error}}return i8e.FAILURE.TYPE_INCORRECT(i,o)},i)}A1e.Union=x_a});var Par=I(_b=>{"use strict";Object.defineProperty(_b,"__esModule",{value:!0});_b.Nullish=_b.Null=_b.Undefined=_b.Literal=_b.literal=void 0;var D_a=I1(),aWn=rp(),N_a=xar();function Dar(r){return Array.isArray(r)?String(r.map(String)):typeof r=="bigint"?String(r)+"n":String(r)}_b.literal=Dar;function Nar(r){var t={tag:"literal",value:r};return(0,D_a.create)(function(n){return n===r?(0,aWn.SUCCESS)(n):aWn.FAILURE.VALUE_INCORRECT("literal","`".concat(Dar(r),"`"),"`".concat(Dar(n),"`"))},t)}_b.Literal=Nar;_b.Undefined=Nar(void 0);_b.Null=Nar(null);_b.Nullish=(0,N_a.Union)(_b.Null,_b.Undefined)});var pWn=I(BM=>{"use strict";var rU=BM&&BM.__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},kar=BM&&BM.__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))},lWn=BM&&BM.__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(BM,"__esModule",{value:!0});BM.Template=void 0;var fst=I1(),cWn=n8e(),IP=rp(),dWn=Par(),Qar=function(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},P_a=function(r){if(0<r.length&&Array.isArray(r[0])){var t=rU(r),n=t[0],i=t.slice(1);return[Array.from(n),i]}else{var o=r,n=o.reduce(function(l,u){return(0,fst.isRuntype)(u)?l.push(""):l.push(l.pop()+String(u)),l},[""]),i=o.filter(fst.isRuntype);return[n,i]}},k_a=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,kar([n,1],rU(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],u=a.slice(1,-1),c=a[a.length-1];r.splice.apply(r,kar(kar([n,2,r[n]+l],rU(u),!1),[c+r[n+1]],!1))}break}case"union":{var d=t[n];if(d.alternatives.length===1)try{var p=a8e(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 A=t[n];if(A.intersectees.length===1)try{var f=a8e(A);t.splice(n,1);var o=String(f.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}default:n++;break}},Q_a=function(r){var t=rU(P_a(r),2),n=t[0],i=t[1];return k_a(n,i),[n,i]},a8e=function(r){switch(r.reflect.tag){case"literal":return r;case"brand":return a8e(r.reflect.entity);case"union":if(r.reflect.alternatives.length===1)return a8e(r.reflect.alternatives[0]);break;case"intersect":if(r.reflect.intersectees.length===1)return a8e(r.reflect.intersectees[0]);break;default:break}throw void 0},uWn=function(r){return r},Lar={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"]},o8e=function(r){switch(r.tag){case"literal":{var t=rU(Lar[(0,IP.typeOf)(r.value)]||[uWn],1),n=t[0];return n}case"brand":return o8e(r.entity);case"constraint":return o8e(r.underlying);case"union":return r.alternatives.map(o8e);case"intersect":return r.intersectees.map(o8e);default:var i=rU(Lar[r.tag]||[uWn],1),o=i[0];return o}},Far=function(r,t){return function(n){var i,o,s,a,l=o8e(r);if(Array.isArray(l))switch(r.tag){case"union":try{for(var u=lWn(r.alternatives),c=u.next();!c.done;c=u.next()){var d=c.value,p=Far(d.reflect,t)(n);if(p.success)return p}}catch(C){i={error:C}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return IP.FAILURE.TYPE_INCORRECT(r,n);case"intersect":try{for(var A=lWn(r.intersectees),f=A.next();!f.done;f=A.next()){var h=f.value,p=Far(h.reflect,t)(n);if(!p.success)return p}}catch(C){s={error:C}}finally{try{f&&!f.done&&(a=A.return)&&a.call(A)}finally{if(s)throw s.error}}return(0,IP.SUCCESS)(n);default:throw Error("impossible")}else{var y=l,p=(0,fst.innerValidate)(r,y(n),t);return!p.success&&p.code==="VALUE_INCORRECT"&&r.tag==="literal"?IP.FAILURE.VALUE_INCORRECT("literal",'"'.concat((0,dWn.literal)(r.value),'"'),'"'.concat(n,'"')):p}}},s8e=function(r){switch(r.tag){case"literal":return Qar(String(r.value));case"brand":return s8e(r.entity);case"constraint":return s8e(r.underlying);case"union":return r.alternatives.map(s8e).join("|");case"template":return r.strings.map(Qar).reduce(function(i,o,s){var a=i+o,l=r.runtypes[s];return l?a+"(?:".concat(s8e(l.reflect),")"):a},"");default:var t=rU(Lar[r.tag]||[void 0,".*"]),n=t.slice(1);return n.join("|")}},L_a=function(r){var t=r.strings.map(Qar).reduce(function(n,i,o){var s=n+i,a=r.runtypes[o];return a?s+"(".concat(s8e(a.reflect),")"):s},"");return new RegExp("^".concat(t,"$"),"su")};function F_a(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=rU(Q_a(r),2),i=n[0],o=n[1],s={tag:"template",strings:i,runtypes:o},a=L_a(s),l=function(u,c){var d=u.match(a);if(d){for(var p=d.slice(1),A=0;A<o.length;A++){var f=o[A],h=p[A],y=Far(f.reflect,c)(h);if(!y.success)return y}return(0,IP.SUCCESS)(u)}else return IP.FAILURE.VALUE_INCORRECT("string","".concat((0,cWn.default)(s)),'"'.concat((0,dWn.literal)(u),'"'))};return(0,fst.create)(function(u,c){if(typeof u!="string")return IP.FAILURE.TYPE_INCORRECT(s,u);var d=l(u,c);if(d.success)return(0,IP.SUCCESS)(u);var p=IP.FAILURE.VALUE_INCORRECT("string","".concat((0,cWn.default)(s)),'"'.concat(u,'"'));return p.message!==d.message&&(p.message+=" (inner: ".concat(d.message,")")),p},s)}BM.Template=F_a});var hWn=I(hst=>{"use strict";Object.defineProperty(hst,"__esModule",{value:!0});hst.Boolean=void 0;var z_a=I1(),AWn=rp(),fWn={tag:"boolean"};hst.Boolean=(0,z_a.create)(function(r){return typeof r=="boolean"?(0,AWn.SUCCESS)(r):AWn.FAILURE.TYPE_INCORRECT(fWn,r)},fWn)});var yWn=I(gst=>{"use strict";Object.defineProperty(gst,"__esModule",{value:!0});gst.Number=void 0;var q_a=I1(),gWn=rp(),mWn={tag:"number"};gst.Number=(0,q_a.create)(function(r){return typeof r=="number"?(0,gWn.SUCCESS)(r):gWn.FAILURE.TYPE_INCORRECT(mWn,r)},mWn)});var CWn=I(mst=>{"use strict";Object.defineProperty(mst,"__esModule",{value:!0});mst.BigInt=void 0;var U_a=I1(),EWn=rp(),bWn={tag:"bigint"};mst.BigInt=(0,U_a.create)(function(r){return typeof r=="bigint"?(0,EWn.SUCCESS)(r):EWn.FAILURE.TYPE_INCORRECT(bWn,r)},bWn)});var zar=I(yst=>{"use strict";Object.defineProperty(yst,"__esModule",{value:!0});yst.String=void 0;var j_a=I1(),IWn=rp(),vWn={tag:"string"};yst.String=(0,j_a.create)(function(r){return typeof r=="string"?(0,IWn.SUCCESS)(r):IWn.FAILURE.TYPE_INCORRECT(vWn,r)},vWn)});var _Wn=I(Est=>{"use strict";Object.defineProperty(Est,"__esModule",{value:!0});Est.Symbol=void 0;var wWn=I1(),l8e=rp(),W_a=function(r){var t={tag:"symbol",key:r};return(0,wWn.create)(function(n){if(typeof n!="symbol")return l8e.FAILURE.TYPE_INCORRECT(t,n);var i=globalThis.Symbol.keyFor(n);return i!==r?l8e.FAILURE.VALUE_INCORRECT("symbol key",OWn(r),OWn(i)):(0,l8e.SUCCESS)(n)},t)},SWn={tag:"symbol"};Est.Symbol=(0,wWn.create)(function(r){return typeof r=="symbol"?(0,l8e.SUCCESS)(r):l8e.FAILURE.TYPE_INCORRECT(SWn,r)},Object.assign(W_a,SWn));var OWn=function(r){return r===void 0?"undefined":'"'.concat(r,'"')}});var RWn=I(bst=>{"use strict";Object.defineProperty(bst,"__esModule",{value:!0});bst.Array=void 0;var TWn=I1(),c8e=rp();function BWn(r,t){var n={tag:"array",isReadonly:t,element:r};return V_a((0,TWn.create)(function(i,o){if(!Array.isArray(i))return c8e.FAILURE.TYPE_INCORRECT(n,i);var s=(0,c8e.enumerableKeysOf)(i),a=s.map(function(u){return(0,TWn.innerValidate)(r,i[u],o)}),l=s.reduce(function(u,c){var d=a[c];return d.success||(u[c]=d.details||d.message),u},[]);return(0,c8e.enumerableKeysOf)(l).length!==0?c8e.FAILURE.CONTENT_INCORRECT(n,l):(0,c8e.SUCCESS)(i)},n))}function G_a(r){return BWn(r,!1)}bst.Array=G_a;function V_a(r){return r.asReadonly=t,r;function t(){return BWn(r.element,!0)}}});var xWn=I(Cst=>{"use strict";Object.defineProperty(Cst,"__esModule",{value:!0});Cst.Tuple=void 0;var MWn=I1(),f1e=rp();function H_a(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"tuple",components:r};return(0,MWn.create)(function(i,o){if(!Array.isArray(i))return f1e.FAILURE.TYPE_INCORRECT(n,i);if(i.length!==r.length)return f1e.FAILURE.CONSTRAINT_FAILED(n,"Expected length ".concat(r.length,", but was ").concat(i.length));var s=(0,f1e.enumerableKeysOf)(i),a=s.map(function(u){return(0,MWn.innerValidate)(r[u],i[u],o)}),l=s.reduce(function(u,c){var d=a[c];return d.success||(u[c]=d.details||d.message),u},[]);return(0,f1e.enumerableKeysOf)(l).length!==0?f1e.FAILURE.CONTENT_INCORRECT(n,l):(0,f1e.SUCCESS)(i)},n)}Cst.Tuple=H_a});var NWn=I(dO=>{"use strict";var qar=dO&&dO.__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},Uar=dO&&dO.__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(dO,"__esModule",{value:!0});dO.Partial=dO.Record=dO.InternalRecord=void 0;var DWn=I1(),Tb=rp();function nU(r,t,n){var i={tag:"record",isPartial:t,isReadonly:n,fields:r};return J_a((0,DWn.create)(function(o,s){if(o==null)return Tb.FAILURE.TYPE_INCORRECT(i,o);var a=(0,Tb.enumerableKeysOf)(r);if(a.length!==0&&typeof o!="object")return Tb.FAILURE.TYPE_INCORRECT(i,o);var l=Uar([],qar(new Set(Uar(Uar([],qar(a),!1),qar((0,Tb.enumerableKeysOf)(o)),!1))),!1),u=l.reduce(function(d,p){var A=(0,Tb.hasKey)(p,r),f=(0,Tb.hasKey)(p,o);if(A){var h=r[p],y=t||h.reflect.tag==="optional";if(f){var C=o[p];y&&C===void 0?d[p]=(0,Tb.SUCCESS)(C):d[p]=(0,DWn.innerValidate)(h,C,s)}else y?d[p]=(0,Tb.SUCCESS)(void 0):d[p]=Tb.FAILURE.PROPERTY_MISSING(h.reflect)}else if(f){var C=o[p];d[p]=(0,Tb.SUCCESS)(C)}else throw new Error("impossible");return d},{}),c=l.reduce(function(d,p){var A=u[p];return A.success||(d[p]=A.details||A.message),d},{});return(0,Tb.enumerableKeysOf)(c).length!==0?Tb.FAILURE.CONTENT_INCORRECT(i,c):(0,Tb.SUCCESS)(o)},i))}dO.InternalRecord=nU;function K_a(r){return nU(r,!1,!1)}dO.Record=K_a;function Y_a(r){return nU(r,!0,!1)}dO.Partial=Y_a;function J_a(r){return r.asPartial=t,r.asReadonly=n,r.pick=i,r.omit=o,r.extend=s,r;function t(){return nU(r.fields,!0,r.isReadonly)}function n(){return nU(r.fields,r.isPartial,!0)}function i(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u={};return a.forEach(function(c){u[c]=r.fields[c]}),nU(u,r.isPartial,r.isReadonly)}function o(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u={},c=(0,Tb.enumerableKeysOf)(r.fields);return c.forEach(function(d){a.includes(d)||(u[d]=r.fields[d])}),nU(u,r.isPartial,r.isReadonly)}function s(a){return nU(Object.assign({},r.fields,a),r.isPartial,r.isReadonly)}}});var War=I(h1e=>{"use strict";Object.defineProperty(h1e,"__esModule",{value:!0});h1e.Guard=h1e.Constraint=void 0;var X_a=I1(),jar=rp(),$_a=cst();function Z_a(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,X_a.create)(function(a){var l=r.validate(a);if(!l.success)return l;var u=t(l.value);return typeof u=="string"?jar.FAILURE.CONSTRAINT_FAILED(s,u):u?(0,jar.SUCCESS)(l.value):jar.FAILURE.CONSTRAINT_FAILED(s)},s)}h1e.Constraint=Z_a;var e6a=function(r,t){return $_a.Unknown.withGuard(r,t)};h1e.Guard=e6a});var kWn=I(Ist=>{"use strict";Object.defineProperty(Ist,"__esModule",{value:!0});Ist.Dictionary=void 0;var PWn=I1(),Gar=zar(),t6a=War(),r6a=n8e(),Ate=rp(),n6a=(0,t6a.Constraint)(Gar.String,function(r){return!isNaN(+r)},{name:"number"});function i6a(r,t){var n=t===void 0||t==="string"?Gar.String:t==="number"?n6a:t,i=(0,r6a.default)(n),o={tag:"dictionary",key:i,value:r};return(0,PWn.create)(function(s,a){if(s==null||typeof s!="object"||Object.getPrototypeOf(s)!==Object.prototype&&(!Array.isArray(s)||i==="string"))return Ate.FAILURE.TYPE_INCORRECT(o,s);var l=/^(?:NaN|-?\d+(?:\.\d+)?)$/,u=(0,Ate.enumerableKeysOf)(s),c=u.reduce(function(p,A){var f=typeof A=="string"&&l.test(A),h=f?globalThis.Number(A):A;return(f?!n.guard(h)&&!n.guard(A):!n.guard(h))?p[A]=Ate.FAILURE.KEY_INCORRECT(o,n.reflect,h):p[A]=(0,PWn.innerValidate)(r,s[A],a),p},{}),d=u.reduce(function(p,A){var f=c[A];return f.success||(p[A]=f.details||f.message),p},{});return(0,Ate.enumerableKeysOf)(d).length!==0?Ate.FAILURE.CONTENT_INCORRECT(o,d):(0,Ate.SUCCESS)(s)},o)}Ist.Dictionary=i6a});var LWn=I(g1e=>{"use strict";var o6a=g1e&&g1e.__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(g1e,"__esModule",{value:!0});g1e.Intersect=void 0;var QWn=I1(),s6a=rp();function a6a(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"intersect",intersectees:r};return(0,QWn.create)(function(i,o){var s,a;try{for(var l=o6a(r),u=l.next();!u.done;u=l.next()){var c=u.value,d=(0,QWn.innerValidate)(c,i,o);if(!d.success)return d}}catch(p){s={error:p}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(s)throw s.error}}return(0,s6a.SUCCESS)(i)},n)}g1e.Intersect=a6a});var FWn=I(vst=>{"use strict";Object.defineProperty(vst,"__esModule",{value:!0});vst.Optional=void 0;var l6a=I1(),c6a=rp();function u6a(r){var t={tag:"optional",underlying:r};return(0,l6a.create)(function(n){return n===void 0?(0,c6a.SUCCESS)(n):r.validate(n)},t)}vst.Optional=u6a});var UWn=I(Sst=>{"use strict";Object.defineProperty(Sst,"__esModule",{value:!0});Sst.Function=void 0;var d6a=I1(),zWn=rp(),qWn={tag:"function"};Sst.Function=(0,d6a.create)(function(r){return typeof r=="function"?(0,zWn.SUCCESS)(r):zWn.FAILURE.TYPE_INCORRECT(qWn,r)},qWn)});var WWn=I(Ost=>{"use strict";Object.defineProperty(Ost,"__esModule",{value:!0});Ost.InstanceOf=void 0;var p6a=I1(),jWn=rp();function A6a(r){var t={tag:"instanceof",ctor:r};return(0,p6a.create)(function(n){return n instanceof r?(0,jWn.SUCCESS)(n):jWn.FAILURE.TYPE_INCORRECT(t,n)},t)}Ost.InstanceOf=A6a});var GWn=I(wst=>{"use strict";Object.defineProperty(wst,"__esModule",{value:!0});wst.Lazy=void 0;var f6a=I1();function h6a(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,f6a.create)(function(o){return i().validate(o)},t)}wst.Lazy=h6a});var VWn=I(_st=>{"use strict";Object.defineProperty(_st,"__esModule",{value:!0});_st.Brand=void 0;var g6a=I1();function m6a(r,t){var n={tag:"brand",brand:r,entity:t};return(0,g6a.create)(function(i){return t.validate(i)},n)}_st.Brand=m6a});var HWn=I(m1e=>{"use strict";Object.defineProperty(m1e,"__esModule",{value:!0});m1e.checked=m1e.check=void 0;var y6a=p1e(),E6a=rp(),Var=new WeakMap;function b6a(r,t,n){var i=Var.get(r)||new Map;Var.set(r,i);var o=i.get(t)||[];i.set(t,o),o.push(n)}m1e.check=b6a;function C6a(r,t,n){var i=Var.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 I6a(){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=C6a(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 u=[],c=0;c<arguments.length;c++)u[c]=arguments[c];return r.forEach(function(d,p){var A=l[p],f=d.validate(u[A]);if(!f.success){var h="".concat(a,", argument #").concat(A,": ").concat(f.message),y=E6a.FAILURE.ARGUMENT_INCORRECT(h);throw new y6a.ValidationError(y)}}),s.apply(this,u)}}}m1e.checked=I6a});var uO=I(Ms=>{"use strict";var v6a=Ms&&Ms.__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]}),Wu=Ms&&Ms.__exportStar||function(r,t){for(var n in r)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&v6a(t,r,n)};Object.defineProperty(Ms,"__esModule",{value:!0});Ms.InstanceOf=Ms.Nullish=Ms.Null=Ms.Undefined=Ms.Literal=void 0;Wu(Jjn(),Ms);Wu(Bar(),Ms);Wu($jn(),Ms);Wu(tWn(),Ms);Wu(rWn(),Ms);Wu(p1e(),Ms);Wu(cst(),Ms);Wu(oWn(),Ms);Wu(sWn(),Ms);var Tst=Par();Object.defineProperty(Ms,"Literal",{enumerable:!0,get:function(){return Tst.Literal}});Object.defineProperty(Ms,"Undefined",{enumerable:!0,get:function(){return Tst.Undefined}});Object.defineProperty(Ms,"Null",{enumerable:!0,get:function(){return Tst.Null}});Object.defineProperty(Ms,"Nullish",{enumerable:!0,get:function(){return Tst.Nullish}});Wu(pWn(),Ms);Wu(hWn(),Ms);Wu(yWn(),Ms);Wu(CWn(),Ms);Wu(zar(),Ms);Wu(_Wn(),Ms);Wu(RWn(),Ms);Wu(xWn(),Ms);Wu(NWn(),Ms);Wu(kWn(),Ms);Wu(xar(),Ms);Wu(LWn(),Ms);Wu(FWn(),Ms);Wu(UWn(),Ms);var S6a=WWn();Object.defineProperty(Ms,"InstanceOf",{enumerable:!0,get:function(){return S6a.InstanceOf}});Wu(GWn(),Ms);Wu(War(),Ms);Wu(VWn(),Ms);Wu(HWn(),Ms)});var u8e=I((WZ0,KWn)=>{var O6a="2.0.0",w6a=Number.MAX_SAFE_INTEGER||9007199254740991,_6a=16,T6a=250,B6a=["major","premajor","minor","preminor","patch","prepatch","prerelease"];KWn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:_6a,MAX_SAFE_BUILD_LENGTH:T6a,MAX_SAFE_INTEGER:w6a,RELEASE_TYPES:B6a,SEMVER_SPEC_VERSION:O6a,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var d8e=I((GZ0,YWn)=>{var R6a=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};YWn.exports=R6a});var y1e=I((vP,JWn)=>{var{MAX_SAFE_COMPONENT_LENGTH:Har,MAX_SAFE_BUILD_LENGTH:M6a,MAX_LENGTH:x6a}=u8e(),D6a=d8e();vP=JWn.exports={};var N6a=vP.re=[],P6a=vP.safeRe=[],Ui=vP.src=[],ji=vP.t={},k6a=0,Kar="[a-zA-Z0-9-]",Q6a=[["\\s",1],["\\d",x6a],[Kar,M6a]],L6a=r=>{for(let[t,n]of Q6a)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},pa=(r,t,n)=>{let i=L6a(t),o=k6a++;D6a(r,o,t),ji[r]=o,Ui[o]=t,N6a[o]=new RegExp(t,n?"g":void 0),P6a[o]=new RegExp(i,n?"g":void 0)};pa("NUMERICIDENTIFIER","0|[1-9]\\d*");pa("NUMERICIDENTIFIERLOOSE","\\d+");pa("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Kar}*`);pa("MAINVERSION",`(${Ui[ji.NUMERICIDENTIFIER]})\\.(${Ui[ji.NUMERICIDENTIFIER]})\\.(${Ui[ji.NUMERICIDENTIFIER]})`);pa("MAINVERSIONLOOSE",`(${Ui[ji.NUMERICIDENTIFIERLOOSE]})\\.(${Ui[ji.NUMERICIDENTIFIERLOOSE]})\\.(${Ui[ji.NUMERICIDENTIFIERLOOSE]})`);pa("PRERELEASEIDENTIFIER",`(?:${Ui[ji.NUMERICIDENTIFIER]}|${Ui[ji.NONNUMERICIDENTIFIER]})`);pa("PRERELEASEIDENTIFIERLOOSE",`(?:${Ui[ji.NUMERICIDENTIFIERLOOSE]}|${Ui[ji.NONNUMERICIDENTIFIER]})`);pa("PRERELEASE",`(?:-(${Ui[ji.PRERELEASEIDENTIFIER]}(?:\\.${Ui[ji.PRERELEASEIDENTIFIER]})*))`);pa("PRERELEASELOOSE",`(?:-?(${Ui[ji.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Ui[ji.PRERELEASEIDENTIFIERLOOSE]})*))`);pa("BUILDIDENTIFIER",`${Kar}+`);pa("BUILD",`(?:\\+(${Ui[ji.BUILDIDENTIFIER]}(?:\\.${Ui[ji.BUILDIDENTIFIER]})*))`);pa("FULLPLAIN",`v?${Ui[ji.MAINVERSION]}${Ui[ji.PRERELEASE]}?${Ui[ji.BUILD]}?`);pa("FULL",`^${Ui[ji.FULLPLAIN]}$`);pa("LOOSEPLAIN",`[v=\\s]*${Ui[ji.MAINVERSIONLOOSE]}${Ui[ji.PRERELEASELOOSE]}?${Ui[ji.BUILD]}?`);pa("LOOSE",`^${Ui[ji.LOOSEPLAIN]}$`);pa("GTLT","((?:<|>)?=?)");pa("XRANGEIDENTIFIERLOOSE",`${Ui[ji.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);pa("XRANGEIDENTIFIER",`${Ui[ji.NUMERICIDENTIFIER]}|x|X|\\*`);pa("XRANGEPLAIN",`[v=\\s]*(${Ui[ji.XRANGEIDENTIFIER]})(?:\\.(${Ui[ji.XRANGEIDENTIFIER]})(?:\\.(${Ui[ji.XRANGEIDENTIFIER]})(?:${Ui[ji.PRERELEASE]})?${Ui[ji.BUILD]}?)?)?`);pa("XRANGEPLAINLOOSE",`[v=\\s]*(${Ui[ji.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Ui[ji.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Ui[ji.XRANGEIDENTIFIERLOOSE]})(?:${Ui[ji.PRERELEASELOOSE]})?${Ui[ji.BUILD]}?)?)?`);pa("XRANGE",`^${Ui[ji.GTLT]}\\s*${Ui[ji.XRANGEPLAIN]}$`);pa("XRANGELOOSE",`^${Ui[ji.GTLT]}\\s*${Ui[ji.XRANGEPLAINLOOSE]}$`);pa("COERCE",`(^|[^\\d])(\\d{1,${Har}})(?:\\.(\\d{1,${Har}}))?(?:\\.(\\d{1,${Har}}))?(?:$|[^\\d])`);pa("COERCERTL",Ui[ji.COERCE],!0);pa("LONETILDE","(?:~>?)");pa("TILDETRIM",`(\\s*)${Ui[ji.LONETILDE]}\\s+`,!0);vP.tildeTrimReplace="$1~";pa("TILDE",`^${Ui[ji.LONETILDE]}${Ui[ji.XRANGEPLAIN]}$`);pa("TILDELOOSE",`^${Ui[ji.LONETILDE]}${Ui[ji.XRANGEPLAINLOOSE]}$`);pa("LONECARET","(?:\\^)");pa("CARETTRIM",`(\\s*)${Ui[ji.LONECARET]}\\s+`,!0);vP.caretTrimReplace="$1^";pa("CARET",`^${Ui[ji.LONECARET]}${Ui[ji.XRANGEPLAIN]}$`);pa("CARETLOOSE",`^${Ui[ji.LONECARET]}${Ui[ji.XRANGEPLAINLOOSE]}$`);pa("COMPARATORLOOSE",`^${Ui[ji.GTLT]}\\s*(${Ui[ji.LOOSEPLAIN]})$|^$`);pa("COMPARATOR",`^${Ui[ji.GTLT]}\\s*(${Ui[ji.FULLPLAIN]})$|^$`);pa("COMPARATORTRIM",`(\\s*)${Ui[ji.GTLT]}\\s*(${Ui[ji.LOOSEPLAIN]}|${Ui[ji.XRANGEPLAIN]})`,!0);vP.comparatorTrimReplace="$1$2$3";pa("HYPHENRANGE",`^\\s*(${Ui[ji.XRANGEPLAIN]})\\s+-\\s+(${Ui[ji.XRANGEPLAIN]})\\s*$`);pa("HYPHENRANGELOOSE",`^\\s*(${Ui[ji.XRANGEPLAINLOOSE]})\\s+-\\s+(${Ui[ji.XRANGEPLAINLOOSE]})\\s*$`);pa("STAR","(<|>)?=?\\s*\\*");pa("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");pa("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Bst=I((VZ0,XWn)=>{var F6a=Object.freeze({loose:!0}),z6a=Object.freeze({}),q6a=r=>r?typeof r!="object"?F6a:r:z6a;XWn.exports=q6a});var Yar=I((HZ0,eGn)=>{var $Wn=/^[0-9]+$/,ZWn=(r,t)=>{let n=$Wn.test(r),i=$Wn.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},U6a=(r,t)=>ZWn(t,r);eGn.exports={compareIdentifiers:ZWn,rcompareIdentifiers:U6a}});var $2=I((KZ0,iGn)=>{var Rst=d8e(),{MAX_LENGTH:tGn,MAX_SAFE_INTEGER:Mst}=u8e(),{safeRe:rGn,t:nGn}=y1e(),j6a=Bst(),{compareIdentifiers:E1e}=Yar(),Jar=class r{constructor(t,n){if(n=j6a(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>tGn)throw new TypeError(`version is longer than ${tGn} characters`);Rst("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?rGn[nGn.LOOSE]:rGn[nGn.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>Mst||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Mst||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Mst||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<Mst)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(Rst("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)),E1e(this.major,t.major)||E1e(this.minor,t.minor)||E1e(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(Rst("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 E1e(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(Rst("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 E1e(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]),E1e(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}};iGn.exports=Jar});var fte=I((YZ0,sGn)=>{var oGn=$2(),W6a=(r,t,n=!1)=>{if(r instanceof oGn)return r;try{return new oGn(r,t)}catch(i){if(!n)return null;throw i}};sGn.exports=W6a});var lGn=I((JZ0,aGn)=>{var G6a=fte(),V6a=(r,t)=>{let n=G6a(r,t);return n?n.version:null};aGn.exports=V6a});var uGn=I((XZ0,cGn)=>{var H6a=fte(),K6a=(r,t)=>{let n=H6a(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};cGn.exports=K6a});var AGn=I(($Z0,pGn)=>{var dGn=$2(),Y6a=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new dGn(r instanceof dGn?r.version:r,n).inc(t,i,o).version}catch{return null}};pGn.exports=Y6a});var gGn=I((ZZ0,hGn)=>{var fGn=fte(),J6a=(r,t)=>{let n=fGn(r,null,!0),i=fGn(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,l=s?i:n,u=!!a.prerelease.length;if(!!l.prerelease.length&&!u)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";let d=u?"pre":"";return n.major!==i.major?d+"major":n.minor!==i.minor?d+"minor":n.patch!==i.patch?d+"patch":"prerelease"};hGn.exports=J6a});var yGn=I((eed,mGn)=>{var X6a=$2(),$6a=(r,t)=>new X6a(r,t).major;mGn.exports=$6a});var bGn=I((ted,EGn)=>{var Z6a=$2(),eTa=(r,t)=>new Z6a(r,t).minor;EGn.exports=eTa});var IGn=I((red,CGn)=>{var tTa=$2(),rTa=(r,t)=>new tTa(r,t).patch;CGn.exports=rTa});var SGn=I((ned,vGn)=>{var nTa=fte(),iTa=(r,t)=>{let n=nTa(r,t);return n&&n.prerelease.length?n.prerelease:null};vGn.exports=iTa});var pO=I((ied,wGn)=>{var OGn=$2(),oTa=(r,t,n)=>new OGn(r,n).compare(new OGn(t,n));wGn.exports=oTa});var TGn=I((oed,_Gn)=>{var sTa=pO(),aTa=(r,t,n)=>sTa(t,r,n);_Gn.exports=aTa});var RGn=I((sed,BGn)=>{var lTa=pO(),cTa=(r,t)=>lTa(r,t,!0);BGn.exports=cTa});var xst=I((aed,xGn)=>{var MGn=$2(),uTa=(r,t,n)=>{let i=new MGn(r,n),o=new MGn(t,n);return i.compare(o)||i.compareBuild(o)};xGn.exports=uTa});var NGn=I((led,DGn)=>{var dTa=xst(),pTa=(r,t)=>r.sort((n,i)=>dTa(n,i,t));DGn.exports=pTa});var kGn=I((ced,PGn)=>{var ATa=xst(),fTa=(r,t)=>r.sort((n,i)=>ATa(i,n,t));PGn.exports=fTa});var p8e=I((ued,QGn)=>{var hTa=pO(),gTa=(r,t,n)=>hTa(r,t,n)>0;QGn.exports=gTa});var Dst=I((ded,LGn)=>{var mTa=pO(),yTa=(r,t,n)=>mTa(r,t,n)<0;LGn.exports=yTa});var Xar=I((ped,FGn)=>{var ETa=pO(),bTa=(r,t,n)=>ETa(r,t,n)===0;FGn.exports=bTa});var $ar=I((Aed,zGn)=>{var CTa=pO(),ITa=(r,t,n)=>CTa(r,t,n)!==0;zGn.exports=ITa});var Nst=I((fed,qGn)=>{var vTa=pO(),STa=(r,t,n)=>vTa(r,t,n)>=0;qGn.exports=STa});var Pst=I((hed,UGn)=>{var OTa=pO(),wTa=(r,t,n)=>OTa(r,t,n)<=0;UGn.exports=wTa});var Zar=I((ged,jGn)=>{var _Ta=Xar(),TTa=$ar(),BTa=p8e(),RTa=Nst(),MTa=Dst(),xTa=Pst(),DTa=(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 _Ta(r,n,i);case"!=":return TTa(r,n,i);case">":return BTa(r,n,i);case">=":return RTa(r,n,i);case"<":return MTa(r,n,i);case"<=":return xTa(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};jGn.exports=DTa});var GGn=I((med,WGn)=>{var NTa=$2(),PTa=fte(),{safeRe:kst,t:Qst}=y1e(),kTa=(r,t)=>{if(r instanceof NTa)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(kst[Qst.COERCE]);else{let i;for(;(i=kst[Qst.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),kst[Qst.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;kst[Qst.COERCERTL].lastIndex=-1}return n===null?null:PTa(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};WGn.exports=kTa});var HGn=I((yed,VGn)=>{"use strict";VGn.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var elr=I((Eed,KGn)=>{"use strict";KGn.exports=lc;lc.Node=hte;lc.create=lc;function lc(r){var t=this;if(t instanceof lc||(t=new lc),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}lc.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};lc.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++}};lc.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++}};lc.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)LTa(this,arguments[r]);return this.length};lc.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)FTa(this,arguments[r]);return this.length};lc.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}};lc.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}};lc.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};lc.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};lc.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};lc.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};lc.prototype.map=function(r,t){t=t||this;for(var n=new lc,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};lc.prototype.mapReverse=function(r,t){t=t||this;for(var n=new lc,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};lc.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};lc.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};lc.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};lc.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};lc.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 lc;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};lc.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 lc;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};lc.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=QTa(this,o,n[i]);return s};lc.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 QTa(r,t,n){var i=t===r.head?new hte(n,null,t,r):new hte(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function LTa(r,t){r.tail=new hte(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function FTa(r,t){r.head=new hte(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function hte(r,t,n,i){if(!(this instanceof hte))return new hte(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{HGn()(lc)}catch{}});var I1e=I((bed,$Gn)=>{"use strict";var zTa=elr(),gte=Symbol("max"),OP=Symbol("length"),b1e=Symbol("lengthCalculator"),f8e=Symbol("allowStale"),mte=Symbol("maxAge"),SP=Symbol("dispose"),YGn=Symbol("noDisposeOnSet"),Kh=Symbol("lruList"),i6=Symbol("cache"),XGn=Symbol("updateAgeOnGet"),tlr=()=>1,nlr=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[gte]=t.max||1/0,i=t.length||tlr;if(this[b1e]=typeof i!="function"?tlr:i,this[f8e]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[mte]=t.maxAge||0,this[SP]=t.dispose,this[YGn]=t.noDisposeOnSet||!1,this[XGn]=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[gte]=t||1/0,A8e(this)}get max(){return this[gte]}set allowStale(t){this[f8e]=!!t}get allowStale(){return this[f8e]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[mte]=t,A8e(this)}get maxAge(){return this[mte]}set lengthCalculator(t){typeof t!="function"&&(t=tlr),t!==this[b1e]&&(this[b1e]=t,this[OP]=0,this[Kh].forEach(n=>{n.length=this[b1e](n.value,n.key),this[OP]+=n.length})),A8e(this)}get lengthCalculator(){return this[b1e]}get length(){return this[OP]}get itemCount(){return this[Kh].length}rforEach(t,n){n=n||this;for(let i=this[Kh].tail;i!==null;){let o=i.prev;JGn(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[Kh].head;i!==null;){let o=i.next;JGn(this,t,i,n),i=o}}keys(){return this[Kh].toArray().map(t=>t.key)}values(){return this[Kh].toArray().map(t=>t.value)}reset(){this[SP]&&this[Kh]&&this[Kh].length&&this[Kh].forEach(t=>this[SP](t.key,t.value)),this[i6]=new Map,this[Kh]=new zTa,this[OP]=0}dump(){return this[Kh].map(t=>Lst(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[Kh]}set(t,n,i){if(i=i||this[mte],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[b1e](n,t);if(this[i6].has(t)){if(s>this[gte])return C1e(this,this[i6].get(t)),!1;let u=this[i6].get(t).value;return this[SP]&&(this[YGn]||this[SP](t,u.value)),u.now=o,u.maxAge=i,u.value=n,this[OP]+=s-u.length,u.length=s,this.get(t),A8e(this),!0}let a=new ilr(t,n,s,o,i);return a.length>this[gte]?(this[SP]&&this[SP](t,n),!1):(this[OP]+=a.length,this[Kh].unshift(a),this[i6].set(t,this[Kh].head),A8e(this),!0)}has(t){if(!this[i6].has(t))return!1;let n=this[i6].get(t).value;return!Lst(this,n)}get(t){return rlr(this,t,!0)}peek(t){return rlr(this,t,!1)}pop(){let t=this[Kh].tail;return t?(C1e(this,t),t.value):null}del(t){C1e(this,this[i6].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[i6].forEach((t,n)=>rlr(this,n,!1))}},rlr=(r,t,n)=>{let i=r[i6].get(t);if(i){let o=i.value;if(Lst(r,o)){if(C1e(r,i),!r[f8e])return}else n&&(r[XGn]&&(i.value.now=Date.now()),r[Kh].unshiftNode(i));return o.value}},Lst=(r,t)=>{if(!t||!t.maxAge&&!r[mte])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[mte]&&n>r[mte]},A8e=r=>{if(r[OP]>r[gte])for(let t=r[Kh].tail;r[OP]>r[gte]&&t!==null;){let n=t.prev;C1e(r,t),t=n}},C1e=(r,t)=>{if(t){let n=t.value;r[SP]&&r[SP](n.key,n.value),r[OP]-=n.length,r[i6].delete(n.key),r[Kh].removeNode(t)}},ilr=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},JGn=(r,t,n,i)=>{let o=n.value;Lst(r,o)&&(C1e(r,n),r[f8e]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};$Gn.exports=nlr});var AO=I((Ced,rVn)=>{var olr=class r{constructor(t,n){if(n=UTa(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof slr)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=>!eVn(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&&YTa(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&&HTa)|(this.options.loose&&KTa))+":"+t,o=ZGn.get(i);if(o)return o;let s=this.options.loose,a=s?Bb[N3.HYPHENRANGELOOSE]:Bb[N3.HYPHENRANGE];t=t.replace(a,oBa(this.options.includePrerelease)),Ad("hyphen replace",t),t=t.replace(Bb[N3.COMPARATORTRIM],WTa),Ad("comparator trim",t),t=t.replace(Bb[N3.TILDETRIM],GTa),Ad("tilde trim",t),t=t.replace(Bb[N3.CARETTRIM],VTa),Ad("caret trim",t);let l=t.split(" ").map(p=>JTa(p,this.options)).join(" ").split(/\s+/).map(p=>iBa(p,this.options));s&&(l=l.filter(p=>(Ad("loose invalid filter",p,this.options),!!p.match(Bb[N3.COMPARATORLOOSE])))),Ad("range list",l);let u=new Map,c=l.map(p=>new slr(p,this.options));for(let p of c){if(eVn(p))return[p];u.set(p.value,p)}u.size>1&&u.has("")&&u.delete("");let d=[...u.values()];return ZGn.set(i,d),d}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>tVn(i,n)&&t.set.some(o=>tVn(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 jTa(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(sBa(this.set[n],t,this.options))return!0;return!1}};rVn.exports=olr;var qTa=I1e(),ZGn=new qTa({max:1e3}),UTa=Bst(),slr=h8e(),Ad=d8e(),jTa=$2(),{safeRe:Bb,t:N3,comparatorTrimReplace:WTa,tildeTrimReplace:GTa,caretTrimReplace:VTa}=y1e(),{FLAG_INCLUDE_PRERELEASE:HTa,FLAG_LOOSE:KTa}=u8e(),eVn=r=>r.value==="<0.0.0-0",YTa=r=>r.value==="",tVn=(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},JTa=(r,t)=>(Ad("comp",r,t),r=ZTa(r,t),Ad("caret",r),r=XTa(r,t),Ad("tildes",r),r=tBa(r,t),Ad("xrange",r),r=nBa(r,t),Ad("stars",r),r),P3=r=>!r||r.toLowerCase()==="x"||r==="*",XTa=(r,t)=>r.trim().split(/\s+/).map(n=>$Ta(n,t)).join(" "),$Ta=(r,t)=>{let n=t.loose?Bb[N3.TILDELOOSE]:Bb[N3.TILDE];return r.replace(n,(i,o,s,a,l)=>{Ad("tilde",r,i,o,s,a,l);let u;return P3(o)?u="":P3(s)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:P3(a)?u=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:l?(Ad("replaceTilde pr",l),u=`>=${o}.${s}.${a}-${l} <${o}.${+s+1}.0-0`):u=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,Ad("tilde return",u),u})},ZTa=(r,t)=>r.trim().split(/\s+/).map(n=>eBa(n,t)).join(" "),eBa=(r,t)=>{Ad("caret",r,t);let n=t.loose?Bb[N3.CARETLOOSE]:Bb[N3.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,l,u)=>{Ad("caret",r,o,s,a,l,u);let c;return P3(s)?c="":P3(a)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:P3(l)?s==="0"?c=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:u?(Ad("replaceCaret pr",u),s==="0"?a==="0"?c=`>=${s}.${a}.${l}-${u} <${s}.${a}.${+l+1}-0`:c=`>=${s}.${a}.${l}-${u} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${l}-${u} <${+s+1}.0.0-0`):(Ad("no pr"),s==="0"?a==="0"?c=`>=${s}.${a}.${l}${i} <${s}.${a}.${+l+1}-0`:c=`>=${s}.${a}.${l}${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${l} <${+s+1}.0.0-0`),Ad("caret return",c),c})},tBa=(r,t)=>(Ad("replaceXRanges",r,t),r.split(/\s+/).map(n=>rBa(n,t)).join(" ")),rBa=(r,t)=>{r=r.trim();let n=t.loose?Bb[N3.XRANGELOOSE]:Bb[N3.XRANGE];return r.replace(n,(i,o,s,a,l,u)=>{Ad("xRange",r,i,o,s,a,l,u);let c=P3(s),d=c||P3(a),p=d||P3(l),A=p;return o==="="&&A&&(o=""),u=t.includePrerelease?"-0":"",c?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&A?(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==="<"&&(u="-0"),i=`${o+s}.${a}.${l}${u}`):d?i=`>=${s}.0.0${u} <${+s+1}.0.0-0`:p&&(i=`>=${s}.${a}.0${u} <${s}.${+a+1}.0-0`),Ad("xRange return",i),i})},nBa=(r,t)=>(Ad("replaceStars",r,t),r.trim().replace(Bb[N3.STAR],"")),iBa=(r,t)=>(Ad("replaceGTE0",r,t),r.trim().replace(Bb[t.includePrerelease?N3.GTE0PRE:N3.GTE0],"")),oBa=r=>(t,n,i,o,s,a,l,u,c,d,p,A,f)=>(P3(i)?n="":P3(o)?n=`>=${i}.0.0${r?"-0":""}`:P3(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,P3(c)?u="":P3(d)?u=`<${+c+1}.0.0-0`:P3(p)?u=`<${c}.${+d+1}.0-0`:A?u=`<=${c}.${d}.${p}-${A}`:r?u=`<${c}.${d}.${+p+1}-0`:u=`<=${u}`,`${n} ${u}`.trim()),sBa=(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(Ad(r[i].semver),r[i].semver!==slr.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 h8e=I((Ied,lVn)=>{var g8e=Symbol("SemVer ANY"),clr=class r{static get ANY(){return g8e}constructor(t,n){if(n=nVn(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),llr("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===g8e?this.value="":this.value=this.operator+this.semver.version,llr("comp",this)}parse(t){let n=this.options.loose?iVn[oVn.COMPARATORLOOSE]:iVn[oVn.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 sVn(i[2],this.options.loose):this.semver=g8e}toString(){return this.value}test(t){if(llr("Comparator.test",t,this.options.loose),this.semver===g8e||t===g8e)return!0;if(typeof t=="string")try{t=new sVn(t,this.options)}catch{return!1}return alr(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 aVn(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new aVn(this.value,n).test(t.semver):(n=nVn(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("=")||alr(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||alr(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};lVn.exports=clr;var nVn=Bst(),{safeRe:iVn,t:oVn}=y1e(),alr=Zar(),llr=d8e(),sVn=$2(),aVn=AO()});var m8e=I((ved,cVn)=>{var aBa=AO(),lBa=(r,t,n)=>{try{t=new aBa(t,n)}catch{return!1}return t.test(r)};cVn.exports=lBa});var dVn=I((Sed,uVn)=>{var cBa=AO(),uBa=(r,t)=>new cBa(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));uVn.exports=uBa});var AVn=I((Oed,pVn)=>{var dBa=$2(),pBa=AO(),ABa=(r,t,n)=>{let i=null,o=null,s=null;try{s=new pBa(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new dBa(i,n))}),i};pVn.exports=ABa});var hVn=I((wed,fVn)=>{var fBa=$2(),hBa=AO(),gBa=(r,t,n)=>{let i=null,o=null,s=null;try{s=new hBa(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new fBa(i,n))}),i};fVn.exports=gBa});var yVn=I((_ed,mVn)=>{var ulr=$2(),mBa=AO(),gVn=p8e(),yBa=(r,t)=>{r=new mBa(r,t);let n=new ulr("0.0.0");if(r.test(n)||(n=new ulr("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 ulr(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||gVn(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||gVn(n,s))&&(n=s)}return n&&r.test(n)?n:null};mVn.exports=yBa});var bVn=I((Ted,EVn)=>{var EBa=AO(),bBa=(r,t)=>{try{return new EBa(r,t).range||"*"}catch{return null}};EVn.exports=bBa});var Fst=I((Bed,SVn)=>{var CBa=$2(),vVn=h8e(),{ANY:IBa}=vVn,vBa=AO(),SBa=m8e(),CVn=p8e(),IVn=Dst(),OBa=Pst(),wBa=Nst(),_Ba=(r,t,n,i)=>{r=new CBa(r,i),t=new vBa(t,i);let o,s,a,l,u;switch(n){case">":o=CVn,s=OBa,a=IVn,l=">",u=">=";break;case"<":o=IVn,s=wBa,a=CVn,l="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(SBa(r,t,i))return!1;for(let c=0;c<t.set.length;++c){let d=t.set[c],p=null,A=null;if(d.forEach(f=>{f.semver===IBa&&(f=new vVn(">=0.0.0")),p=p||f,A=A||f,o(f.semver,p.semver,i)?p=f:a(f.semver,A.semver,i)&&(A=f)}),p.operator===l||p.operator===u||(!A.operator||A.operator===l)&&s(r,A.semver))return!1;if(A.operator===u&&a(r,A.semver))return!1}return!0};SVn.exports=_Ba});var wVn=I((Red,OVn)=>{var TBa=Fst(),BBa=(r,t,n)=>TBa(r,t,">",n);OVn.exports=BBa});var TVn=I((Med,_Vn)=>{var RBa=Fst(),MBa=(r,t,n)=>RBa(r,t,"<",n);_Vn.exports=MBa});var MVn=I((xed,RVn)=>{var BVn=AO(),xBa=(r,t,n)=>(r=new BVn(r,n),t=new BVn(t,n),r.intersects(t,n));RVn.exports=xBa});var DVn=I((Ded,xVn)=>{var DBa=m8e(),NBa=pO();xVn.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((d,p)=>NBa(d,p,n));for(let d of a)DBa(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 u=l.join(" || "),c=typeof t.raw=="string"?t.raw:String(t);return u.length<c.length?u:t}});var FVn=I((Ned,LVn)=>{var NVn=AO(),plr=h8e(),{ANY:dlr}=plr,y8e=m8e(),Alr=pO(),PBa=(r,t,n={})=>{if(r===t)return!0;r=new NVn(r,n),t=new NVn(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=QBa(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},kBa=[new plr(">=0.0.0-0")],PVn=[new plr(">=0.0.0")],QBa=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===dlr){if(t.length===1&&t[0].semver===dlr)return!0;n.includePrerelease?r=kBa:r=PVn}if(t.length===1&&t[0].semver===dlr){if(n.includePrerelease)return!0;t=PVn}let i=new Set,o,s;for(let f of r)f.operator===">"||f.operator===">="?o=kVn(o,f,n):f.operator==="<"||f.operator==="<="?s=QVn(s,f,n):i.add(f.semver);if(i.size>1)return null;let a;if(o&&s){if(a=Alr(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let f of i){if(o&&!y8e(f,String(o),n)||s&&!y8e(f,String(s),n))return null;for(let h of t)if(!y8e(f,String(h),n))return!1;return!0}let l,u,c,d,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,A=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 f of t){if(d=d||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",o){if(A&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===A.major&&f.semver.minor===A.minor&&f.semver.patch===A.patch&&(A=!1),f.operator===">"||f.operator===">="){if(l=kVn(o,f,n),l===f&&l!==o)return!1}else if(o.operator===">="&&!y8e(o.semver,String(f),n))return!1}if(s){if(p&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch&&(p=!1),f.operator==="<"||f.operator==="<="){if(u=QVn(s,f,n),u===f&&u!==s)return!1}else if(s.operator==="<="&&!y8e(s.semver,String(f),n))return!1}if(!f.operator&&(s||o)&&a!==0)return!1}return!(o&&c&&!s&&a!==0||s&&d&&!o&&a!==0||A||p)},kVn=(r,t,n)=>{if(!r)return t;let i=Alr(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},QVn=(r,t,n)=>{if(!r)return t;let i=Alr(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};LVn.exports=PBa});var E8e=I((Ped,UVn)=>{var flr=y1e(),zVn=u8e(),LBa=$2(),qVn=Yar(),FBa=fte(),zBa=lGn(),qBa=uGn(),UBa=AGn(),jBa=gGn(),WBa=yGn(),GBa=bGn(),VBa=IGn(),HBa=SGn(),KBa=pO(),YBa=TGn(),JBa=RGn(),XBa=xst(),$Ba=NGn(),ZBa=kGn(),eRa=p8e(),tRa=Dst(),rRa=Xar(),nRa=$ar(),iRa=Nst(),oRa=Pst(),sRa=Zar(),aRa=GGn(),lRa=h8e(),cRa=AO(),uRa=m8e(),dRa=dVn(),pRa=AVn(),ARa=hVn(),fRa=yVn(),hRa=bVn(),gRa=Fst(),mRa=wVn(),yRa=TVn(),ERa=MVn(),bRa=DVn(),CRa=FVn();UVn.exports={parse:FBa,valid:zBa,clean:qBa,inc:UBa,diff:jBa,major:WBa,minor:GBa,patch:VBa,prerelease:HBa,compare:KBa,rcompare:YBa,compareLoose:JBa,compareBuild:XBa,sort:$Ba,rsort:ZBa,gt:eRa,lt:tRa,eq:rRa,neq:nRa,gte:iRa,lte:oRa,cmp:sRa,coerce:aRa,Comparator:lRa,Range:cRa,satisfies:uRa,toComparators:dRa,maxSatisfying:pRa,minSatisfying:ARa,minVersion:fRa,validRange:hRa,outside:gRa,gtr:mRa,ltr:yRa,intersects:ERa,simplifyRange:bRa,subset:CRa,SemVer:LBa,re:flr.re,src:flr.src,tokens:flr.t,SEMVER_SPEC_VERSION:zVn.SEMVER_SPEC_VERSION,RELEASE_TYPES:zVn.RELEASE_TYPES,compareIdentifiers:qVn.compareIdentifiers,rcompareIdentifiers:qVn.rcompareIdentifiers}});var b8e,IRa,ked,vRa,fO,v1e=be(()=>{"use strict";b8e=yt(uO()),IRa=yt(E8e()),ked=(0,b8e.Record)({version:b8e.String,hash:b8e.String}),vRa=()=>({version:"7.23.0-rc.1",hash:"68077490ced4d3a44d810dee1f071dfdc3925a94"}),fO=vRa()});var uv,jVn,C8e,zst=be(()=>{"use strict";v1e();jVn=r=>{uv=r},C8e=r=>({coalesceSoftwareVersion:fO?.version||"",service:r,env:process.env.REACT_APP_OWNER??"",reactAppCoalesceDev:process.env.REACT_APP_COALESCE_DEV??""})});var WVn,GVn,dv,hlr,VVn,HVn,KVn,I8e,glr,qst,ORa,mlr,S1e,v8e,Ust,ylr,YVn,O1e=be(()=>{"use strict";WVn=yt(C7()),GVn=yt(KXe()),dv=yt(BZ());dte();ist();zst();nl();r6();qt();hlr=null,VVn=r=>{hlr=r},HVn={emerg:"error",assert:"warn",alert:"warn",error:"warn",warn:"warn",app:"info",info:"info",debug:"debug"},KVn={emerg:"emerg",assert:"alert",alert:"alert",error:"error",app:"info",info:"info",warn:"warn",debug:"debug"},I8e=class extends WVn.default{baseContext;constructor(t){super(t),this.baseContext=C8e(uv)}log(t,n){hlr&&hlr.log({...t,level:KVn[t.level]},{...this.baseContext,...wb},HVn[t.level]),n()}},qst=r=>{let t=C8e(r);glr={host:"http-intake.logs.datadoghq.com",path:`/v1/input/pub04bd017317b60c96b62874179d82ff97?ddtags=env:${t.env},coalesceSoftwareVersion:${t.coalesceSoftwareVersion}&ddsource=nodejs&service=${r}`,ssl:!0}},ORa=!1,mlr=()=>dv.format.combine(dv.format.timestamp(),dv.format.colorize({colors:nst.COLORS}),dv.format.printf(r=>{let t=[{key:"orgID",prefix:"org"},{key:"workspaceID",prefix:"env"},{key:"userID",prefix:"user"},{key:"runID",prefix:"run"},{key:"nodeID",prefix:"node"},{key:"kubernetesJobUuid",prefix:"k8s-job"},{key:"planID",prefix:"plan"}],n=process.env.JEST_WORKER_ID?`[SHARD:${process.env.JEST_WORKER_ID}]`:"",i=t.map(({key:o,prefix:s})=>r[o]?`|(${s}:${r[o]})`:"").join("");return`|${r.timestamp}|${n}[${r.loggingArea}]${i}|)|${r.level}:${r.message}`})),S1e=r=>new dv.transports.Console({format:process.env.CONSOLE_JSON_LOGS?dv.format.combine(dv.format.timestamp(),dv.format.json()):mlr(),level:r.level,silent:ORa}),v8e=class extends GVn.Http{running=0;rejectLogCalls=!1;constructor(){let t={batch:!1,...glr,format:dv.format.combine(mlr(),dv.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:KVn[t.level],status:HVn[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 Ye("should not be reachable")};this.close&&this.close(),await Hh(t,"Close took too long",n())}},Ust=()=>new v8e,ylr=()=>new dv.transports.File({filename:process.env.JEST_WORKER_ID?`test-shard-${process.env.JEST_WORKER_ID}.log`:"test.log",dirname:"./test-logs",format:mlr(),level:rst.debug}),YVn=r=>{let t=[];return t.push(S1e(r)),glr&&t.push(Ust()),Rl().isTest&&t.push(ylr()),[new I8e,...t]}});var JVn,Elr,blr,wRa,_Ra,S8e,Clr=be(()=>{"use strict";JVn=yt(BZ());zst();dte();r8e();O1e();nl();Elr=r=>r.includes("production")?"production":r.includes("staging")?"staging":r.includes("qa")?"qa":"development",blr=()=>{if(od()){let r=process.env.RUNTIME_ENVIRONMENT||"development";return o_n("coa")?B_()?Elr(r):void 0:Elr(r)}else{let r;try{r=self.ENVIRONMENT}catch{}return typeof r=="string"?Elr(r):void 0}},wRa=()=>{let r=Rl();if(r.isTest)return{};let t=blr();return r.isNode?{firebaseEnv:t}:{windowInfo:{frontendURLHost:self.location.host},firebaseEnv:t}},_Ra=r=>{let t=C8e(uv);return{appEnv:wRa(),loggingArea:r,...t}},S8e=r=>{let t=lv[r];if(!t)throw new Error(`Logging area "${r}" is not a valid LoggingAreas key`);return t.logger||(t.logger=JVn.createLogger({levels:nst.LEVELS,defaultMeta:_Ra(r),level:t.level,transports:YVn(t)})),t.logger}});var jst,Wst,Ilr,Gst,wP,XVn=be(()=>{"use strict";No();jst=yt(BZ());r8e();O1e();nl();Clr();dte();f1();Wst=(r,t)=>{let n=r.toUpperCase(),i=[];if(n in lv||i.push(`invalid logging area '${n}'`),rst[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=S8e(n),s=o.transports.filter(l=>l instanceof jst.transports.Console),a=o.transports;s.length||(a=[...a,S1e(lv[n])]),a.filter(l=>l instanceof jst.transports.Console)[0].level=t,o.configure({...o,transports:o.transports})},Ilr=()=>{Object.keys(lv).forEach(r=>{Wst(r,"debug")})},Gst=(r,t)=>{for(let n in r){let i=n,o=S8e(i);r[i].defaultMeta={...o.defaultMeta,...r[i].defaultMeta,...t};let s=r[i].transports||o.transports,a;if(Rl().isTest&&s.length>0){let l=s[s.length-1];l instanceof jst.transports.File&&(a=l,s=o.transports.slice(0,-1),s.push(ylr()))}o.configure({...o,...r[i],transports:s,level:r[i].level||o.level}),a&&a.close&&a.close()}},wP=r=>{let t=kp(lv,(n,i)=>({}));Gst(t,r)}});function O8e(r,t){return function(){return r.apply(t,arguments)}}var vlr=be(()=>{"use strict"});function BRa(r){return r!==null&&!w8e(r)&&r.constructor!==null&&!w8e(r.constructor)&&pv(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}function RRa(r){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&eHn(r.buffer),t}function _8e(r,t,{allOwnKeys:n=!1}={}){if(r===null||typeof r>"u")return;let i,o;if(typeof r!="object"&&(r=[r]),w1e(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 rHn(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 Olr(){let{caseless:r}=nHn(this)&&this||{},t={},n=(i,o)=>{let s=r&&rHn(t,o)||o;Vst(t[s])&&Vst(i)?t[s]=Olr(t[s],i):Vst(i)?t[s]=Olr({},i):w1e(i)?t[s]=i.slice():t[s]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&_8e(arguments[i],n);return t}function lMa(r){return!!(r&&pv(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}var TRa,wlr,Hst,o6,Kst,w1e,w8e,eHn,MRa,pv,tHn,Yst,xRa,Vst,DRa,NRa,PRa,kRa,QRa,LRa,FRa,zRa,qRa,URa,jRa,WRa,yte,nHn,GRa,VRa,HRa,KRa,YRa,JRa,XRa,$Ra,ZRa,eMa,tMa,$Vn,rMa,iHn,nMa,iMa,oMa,sMa,Slr,ZVn,oHn,aMa,cMa,uMa,dMa,sHn,pMa,Bt,Eu=be(()=>{"use strict";vlr();({toString:TRa}=Object.prototype),{getPrototypeOf:wlr}=Object,Hst=(r=>t=>{let n=TRa.call(t);return r[n]||(r[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),o6=r=>(r=r.toLowerCase(),t=>Hst(t)===r),Kst=r=>t=>typeof t===r,{isArray:w1e}=Array,w8e=Kst("undefined");eHn=o6("ArrayBuffer");MRa=Kst("string"),pv=Kst("function"),tHn=Kst("number"),Yst=r=>r!==null&&typeof r=="object",xRa=r=>r===!0||r===!1,Vst=r=>{if(Hst(r)!=="object")return!1;let t=wlr(r);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},DRa=o6("Date"),NRa=o6("File"),PRa=o6("Blob"),kRa=o6("FileList"),QRa=r=>Yst(r)&&pv(r.pipe),LRa=r=>{let t;return r&&(typeof FormData=="function"&&r instanceof FormData||pv(r.append)&&((t=Hst(r))==="formdata"||t==="object"&&pv(r.toString)&&r.toString()==="[object FormData]"))},FRa=o6("URLSearchParams"),[zRa,qRa,URa,jRa]=["ReadableStream","Request","Response","Headers"].map(o6),WRa=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");yte=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nHn=r=>!w8e(r)&&r!==yte;GRa=(r,t,n,{allOwnKeys:i}={})=>(_8e(t,(o,s)=>{n&&pv(o)?r[s]=O8e(o,n):r[s]=o},{allOwnKeys:i}),r),VRa=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),HRa=(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)},KRa=(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&&wlr(r)}while(r&&(!n||n(r,t))&&r!==Object.prototype);return t},YRa=(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},JRa=r=>{if(!r)return null;if(w1e(r))return r;let t=r.length;if(!tHn(t))return null;let n=new Array(t);for(;t-- >0;)n[t]=r[t];return n},XRa=(r=>t=>r&&t instanceof r)(typeof Uint8Array<"u"&&wlr(Uint8Array)),$Ra=(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])}},ZRa=(r,t)=>{let n,i=[];for(;(n=r.exec(t))!==null;)i.push(n);return i},eMa=o6("HTMLFormElement"),tMa=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),$Vn=(({hasOwnProperty:r})=>(t,n)=>r.call(t,n))(Object.prototype),rMa=o6("RegExp"),iHn=(r,t)=>{let n=Object.getOwnPropertyDescriptors(r),i={};_8e(n,(o,s)=>{let a;(a=t(o,s,r))!==!1&&(i[s]=a||o)}),Object.defineProperties(r,i)},nMa=r=>{iHn(r,(t,n)=>{if(pv(r)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let i=r[n];if(pv(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+"'")})}})},iMa=(r,t)=>{let n={},i=o=>{o.forEach(s=>{n[s]=!0})};return w1e(r)?i(r):i(String(r).split(t)),n},oMa=()=>{},sMa=(r,t)=>r!=null&&Number.isFinite(r=+r)?r:t,Slr="abcdefghijklmnopqrstuvwxyz",ZVn="0123456789",oHn={DIGIT:ZVn,ALPHA:Slr,ALPHA_DIGIT:Slr+Slr.toUpperCase()+ZVn},aMa=(r=16,t=oHn.ALPHA_DIGIT)=>{let n="",{length:i}=t;for(;r--;)n+=t[Math.random()*i|0];return n};cMa=r=>{let t=new Array(10),n=(i,o)=>{if(Yst(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;let s=w1e(i)?[]:{};return _8e(i,(a,l)=>{let u=n(a,o+1);!w8e(u)&&(s[l]=u)}),t[o]=void 0,s}}return i};return n(r,0)},uMa=o6("AsyncFunction"),dMa=r=>r&&(Yst(r)||pv(r))&&pv(r.then)&&pv(r.catch),sHn=((r,t)=>r?setImmediate:t?((n,i)=>(yte.addEventListener("message",({source:o,data:s})=>{o===yte&&s===n&&i.length&&i.shift()()},!1),o=>{i.push(o),yte.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",pv(yte.postMessage)),pMa=typeof queueMicrotask<"u"?queueMicrotask.bind(yte):typeof process<"u"&&process.nextTick||sHn,Bt={isArray:w1e,isArrayBuffer:eHn,isBuffer:BRa,isFormData:LRa,isArrayBufferView:RRa,isString:MRa,isNumber:tHn,isBoolean:xRa,isObject:Yst,isPlainObject:Vst,isReadableStream:zRa,isRequest:qRa,isResponse:URa,isHeaders:jRa,isUndefined:w8e,isDate:DRa,isFile:NRa,isBlob:PRa,isRegExp:rMa,isFunction:pv,isStream:QRa,isURLSearchParams:FRa,isTypedArray:XRa,isFileList:kRa,forEach:_8e,merge:Olr,extend:GRa,trim:WRa,stripBOM:VRa,inherits:HRa,toFlatObject:KRa,kindOf:Hst,kindOfTest:o6,endsWith:YRa,toArray:JRa,forEachEntry:$Ra,matchAll:ZRa,isHTMLForm:eMa,hasOwnProperty:$Vn,hasOwnProp:$Vn,reduceDescriptors:iHn,freezeMethods:nMa,toObjectSet:iMa,toCamelCase:tMa,noop:oMa,toFiniteNumber:sMa,findKey:rHn,global:yte,isContextDefined:nHn,ALPHABET:oHn,generateString:aMa,isSpecCompliantForm:lMa,toJSONObject:cMa,isAsyncFn:uMa,isThenable:dMa,setImmediate:sHn,asap:pMa}});function _1e(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 aHn,lHn,$n,Av=be(()=>{"use strict";Eu();Bt.inherits(_1e,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:Bt.toJSONObject(this.config),code:this.code,status:this.status}}});aHn=_1e.prototype,lHn={};["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=>{lHn[r]={value:r}});Object.defineProperties(_1e,lHn);Object.defineProperty(aHn,"isAxiosError",{value:!0});_1e.from=(r,t,n,i,o,s)=>{let a=Object.create(aHn);return Bt.toFlatObject(r,a,function(u){return u!==Error.prototype},l=>l!=="isAxiosError"),_1e.call(a,r.message,t,n,i,o),a.cause=r,a.name=r.name,s&&Object.assign(a,s),a};$n=_1e});var cHn,Jst,_lr=be(()=>{cHn=yt(bTe(),1),Jst=cHn.default});function Tlr(r){return Bt.isPlainObject(r)||Bt.isArray(r)}function dHn(r){return Bt.endsWith(r,"[]")?r.slice(0,-2):r}function uHn(r,t,n){return r?r.concat(t).map(function(o,s){return o=dHn(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function AMa(r){return Bt.isArray(r)&&!r.some(Tlr)}function hMa(r,t,n){if(!Bt.isObject(r))throw new TypeError("target must be an object");t=t||new(Jst||FormData),n=Bt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,C){return!Bt.isUndefined(C[y])});let i=n.metaTokens,o=n.visitor||d,s=n.dots,a=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&Bt.isSpecCompliantForm(t);if(!Bt.isFunction(o))throw new TypeError("visitor must be a function");function c(h){if(h===null)return"";if(Bt.isDate(h))return h.toISOString();if(!u&&Bt.isBlob(h))throw new $n("Blob is not supported. Use a Buffer instead.");return Bt.isArrayBuffer(h)||Bt.isTypedArray(h)?u&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function d(h,y,C){let O=h;if(h&&!C&&typeof h=="object"){if(Bt.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(Bt.isArray(h)&&AMa(h)||(Bt.isFileList(h)||Bt.endsWith(y,"[]"))&&(O=Bt.toArray(h)))return y=dHn(y),O.forEach(function(T,R){!(Bt.isUndefined(T)||T===null)&&t.append(a===!0?uHn([y],R,s):a===null?y:y+"[]",c(T))}),!1}return Tlr(h)?!0:(t.append(uHn(C,y,s),c(h)),!1)}let p=[],A=Object.assign(fMa,{defaultVisitor:d,convertValue:c,isVisitable:Tlr});function f(h,y){if(!Bt.isUndefined(h)){if(p.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(h),Bt.forEach(h,function(O,w){(!(Bt.isUndefined(O)||O===null)&&o.call(t,O,Bt.isString(w)?w.trim():w,y,A))===!0&&f(O,y?y.concat(w):[w])}),p.pop()}}if(!Bt.isObject(r))throw new TypeError("data must be an object");return f(r),t}var fMa,iU,T8e=be(()=>{"use strict";Eu();Av();_lr();fMa=Bt.toFlatObject(Bt,{},null,function(t){return/^is[A-Z]/.test(t)});iU=hMa});function pHn(r){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function AHn(r,t){this._pairs=[],r&&iU(r,this,t)}var fHn,hHn,gHn=be(()=>{"use strict";T8e();fHn=AHn.prototype;fHn.append=function(t,n){this._pairs.push([t,n])};fHn.toString=function(t){let n=t?function(i){return t.call(this,i,pHn)}:pHn;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};hHn=AHn});function gMa(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ete(r,t,n){if(!t)return r;let i=n&&n.encode||gMa,o=n&&n.serialize,s;if(o?s=o(t,n):s=Bt.isURLSearchParams(t)?t.toString():new hHn(t,n).toString(i),s){let a=r.indexOf("#");a!==-1&&(r=r.slice(0,a)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}var Xst=be(()=>{"use strict";Eu();gHn()});var Blr,Rlr,mHn=be(()=>{"use strict";Eu();Blr=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){Bt.forEach(this.handlers,function(i){i!==null&&t(i)})}},Rlr=Blr});var T1e,$st=be(()=>{"use strict";T1e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var yHn,EHn,bHn=be(()=>{"use strict";yHn=yt(require("url"),1),EHn=yHn.default.URLSearchParams});var CHn,IHn=be(()=>{bHn();_lr();CHn={isNode:!0,classes:{URLSearchParams:EHn,FormData:Jst,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]}});var Dlr={};o3(Dlr,{hasBrowserEnv:()=>xlr,hasStandardBrowserEnv:()=>mMa,hasStandardBrowserWebWorkerEnv:()=>yMa,navigator:()=>Mlr,origin:()=>EMa});var xlr,Mlr,mMa,yMa,EMa,vHn=be(()=>{xlr=typeof window<"u"&&typeof document<"u",Mlr=typeof navigator=="object"&&navigator||void 0,mMa=xlr&&(!Mlr||["ReactNative","NativeScript","NS"].indexOf(Mlr.product)<0),yMa=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",EMa=xlr&&window.location.href||"http://localhost"});var Gu,RM=be(()=>{IHn();vHn();Gu={...Dlr,...CHn}});function Nlr(r,t){return iU(r,new Gu.classes.URLSearchParams,Object.assign({visitor:function(n,i,o,s){return Gu.isNode&&Bt.isBuffer(n)?(this.append(i,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}var SHn=be(()=>{"use strict";Eu();T8e();RM()});function bMa(r){return Bt.matchAll(/\w+|\[(\w*)]/g,r).map(t=>t[0]==="[]"?"":t[1]||t[0])}function CMa(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 IMa(r){function t(n,i,o,s){let a=n[s++];if(a==="__proto__")return!0;let l=Number.isFinite(+a),u=s>=n.length;return a=!a&&Bt.isArray(o)?o.length:a,u?(Bt.hasOwnProp(o,a)?o[a]=[o[a],i]:o[a]=i,!l):((!o[a]||!Bt.isObject(o[a]))&&(o[a]=[]),t(n,i,o[a],s)&&Bt.isArray(o[a])&&(o[a]=CMa(o[a])),!l)}if(Bt.isFormData(r)&&Bt.isFunction(r.entries)){let n={};return Bt.forEachEntry(r,(i,o)=>{t(bMa(i),o,n,0)}),n}return null}var Zst,Plr=be(()=>{"use strict";Eu();Zst=IMa});function vMa(r,t,n){if(Bt.isString(r))try{return(t||JSON.parse)(r),Bt.trim(r)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(r)}var klr,B1e,eat=be(()=>{"use strict";Eu();Av();$st();T8e();SHn();RM();Plr();klr={transitional:T1e,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){let i=n.getContentType()||"",o=i.indexOf("application/json")>-1,s=Bt.isObject(t);if(s&&Bt.isHTMLForm(t)&&(t=new FormData(t)),Bt.isFormData(t))return o?JSON.stringify(Zst(t)):t;if(Bt.isArrayBuffer(t)||Bt.isBuffer(t)||Bt.isStream(t)||Bt.isFile(t)||Bt.isBlob(t)||Bt.isReadableStream(t))return t;if(Bt.isArrayBufferView(t))return t.buffer;if(Bt.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 Nlr(t,this.formSerializer).toString();if((l=Bt.isFileList(t))||i.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return iU(l?{"files[]":t}:t,u&&new u,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),vMa(t)):t}],transformResponse:[function(t){let n=this.transitional||klr.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(Bt.isResponse(t)||Bt.isReadableStream(t))return t;if(t&&Bt.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"?$n.from(l,$n.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:Gu.classes.FormData,Blob:Gu.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Bt.forEach(["delete","get","head","post","put","patch"],r=>{klr.headers[r]={}});B1e=klr});var SMa,OHn,wHn=be(()=>{"use strict";Eu();SMa=Bt.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"]),OHn=r=>{let t={},n,i,o;return r&&r.split(`
|
|
127
|
+
Value: `,n),new Xq(n,[{path:"",message:"value triggered unknown runtypes error"}])}}createValidationFailedResult(n,i){let o=[],s=(a,l)=>{for(let[u,c]of Object.entries(l)){let d=a.concat(u);typeof c=="string"?o.push({path:d.join("."),message:c}):s(d,c)}};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 Xq(i,o)}},Ob=(r,t)=>new gar(r,t)});var Jwa,Xwa,yar,Ht,Gjn=be(()=>{"use strict";No();qt();f1();est();pr();Jwa=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,Xwa=r=>SGt(r.issues.map(t=>Jwa(t))),yar=class extends a1e{constructor(n,i){super(n);this.zodType=i;if(!i)throw new Ye(`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=mGt(o.unionErrors,a=>Xwa(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 Xq(n,o)}catch(i){let o=i instanceof _.ZodError?[i.flatten(),i.issues]:[];return ua().error(`ZodValidator: Unable to validate ${this.name} value`,"error: ",i,"value: ",n,...o),new Xq(n,[{path:"",message:"value triggered unknown Zod error"}])}}},Ht=(r,t)=>new yar(r,t)});var l1e=be(()=>{"use strict";mar();est();Gjn()});var rst,nst,Kjn,dte=be(()=>{"use strict";rst={emerg:"emerg",info:"info",error:"error",debug:"debug",assert:"assert",warn:"warn",alert:"alert",app:"app"},nst={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"}},Kjn=["Authorization","Token","Password","Secret","idToken","id_token","clientID","clientSecret","apiKey","snowflakeKeyPairKey","snowflakeKeyPairPass","keyPairKey","keyPairPass","key"]});var Tar,lv,r8e=be(()=>{"use strict";Tar=["ACTUAL_STATE","ADVANCED_DEPLOY","APP","AUTH","BULK_WRITE","CLEANUP_TOOL","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","AI_COPILOT"],lv={...Object.fromEntries(Tar.map(r=>[r,{level:"info"}]))}});var c1e,u1e,wb,ist=be(()=>{"use strict";c1e=(r,t,n,i,o)=>({orgID:r,workspaceID:t,userID:n,runID:i,nodeID:o}),u1e=(r,t)=>{r.runID=t},wb={}});var Jjn=I(Yjn=>{"use strict";Object.defineProperty(Yjn,"__esModule",{value:!0})});var Bar=I(ost=>{"use strict";Object.defineProperty(ost,"__esModule",{value:!0});ost.Failcode=void 0;ost.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 p1e=I(d1e=>{"use strict";var e_a=d1e&&d1e.__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(d1e,"__esModule",{value:!0});d1e.ValidationError=void 0;var t_a=function(r){e_a(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);d1e.ValidationError=t_a});var n8e=I(Rar=>{"use strict";Object.defineProperty(Rar,"__esModule",{value:!0});var sst=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||sst(r)(t.underlying);case"union":return t.alternatives.map(sst(r)).join(" | ");case"intersect":return t.intersectees.map(sst(r)).join(" & ");default:break}return"`${".concat(cv(!1,r)(t),"}`")}},ast=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,"}"):ast(r)(t.underlying);case"union":if(t.alternatives.length===1){var n=t.alternatives[0];return ast(r)(n.reflect)}break;case"intersect":if(t.intersectees.length===1){var n=t.intersectees[0];return ast(r)(n.reflect)}break;default:break}return"${".concat(cv(!1,r)(t),"}")}},cv=function(r,t){return function(n){var i=function(c){return r?"(".concat(c,")"):c};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(c){return c===""})){var s=n.runtypes[0];return sst(t)(s.reflect)}var a=!1,l=n.strings.reduce(function(c,d,p){var A=c+d,f=n.runtypes[p];if(f){var h=ast(t)(f.reflect);return!a&&h.startsWith("$")&&(a=!0),A+h}else return A},"");return a?"`".concat(l,"`"):'"'.concat(l,'"')}case"array":return"".concat(Xjn(n)).concat(cv(!0,t)(n.element),"[]");case"dictionary":return"{ [_: ".concat(n.key,"]: ").concat(cv(!1,t)(n.value)," }");case"record":{var u=Object.keys(n.fields);return u.length?"{ ".concat(u.map(function(c){return"".concat(Xjn(n)).concat(c).concat(r_a(n,c),": ").concat(n.fields[c].tag==="optional"?cv(!1,t)(n.fields[c].underlying):cv(!1,t)(n.fields[c]),";")}).join(" ")," }"):"{}"}case"tuple":return"[".concat(n.components.map(cv(!1,t)).join(", "),"]");case"union":return i("".concat(n.alternatives.map(cv(!0,t)).join(" | ")));case"intersect":return i("".concat(n.intersectees.map(cv(!0,t)).join(" & ")));case"optional":return cv(r,t)(n.underlying)+" | undefined";case"constraint":return n.name||cv(r,t)(n.underlying);case"instanceof":return n.ctor.name;case"brand":return cv(r,t)(n.entity)}}finally{t.delete(n)}throw Error("impossible")}};Rar.default=cv(!1,new Set);function r_a(r,t){var n=r.isPartial,i=r.fields;return n||t!==void 0&&i[t].tag==="optional"?"?":""}function Xjn(r){var t=r.isReadonly;return t?"readonly ":""}});var rp=I(yu=>{"use strict";var Mar=yu&&yu.__assign||function(){return Mar=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},Mar.apply(this,arguments)};Object.defineProperty(yu,"__esModule",{value:!0});yu.FAILURE=yu.SUCCESS=yu.enumerableKeysOf=yu.typeOf=yu.hasKey=void 0;var _M=Bar(),pte=n8e();function n_a(r,t){return typeof t=="object"&&t!==null&&r in t}yu.hasKey=n_a;var i_a=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};yu.typeOf=i_a;var o_a=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}):[]};yu.enumerableKeysOf=o_a;function s_a(r){return{success:!0,value:r}}yu.SUCCESS=s_a;yu.FAILURE=Object.assign(function(r,t,n){return Mar({success:!1,code:r,message:t},n?{details:n}:{})},{TYPE_INCORRECT:function(r,t){var n="Expected ".concat(r.tag==="template"?"string ".concat((0,pte.default)(r)):(0,pte.default)(r),", but was ").concat((0,yu.typeOf)(t));return(0,yu.FAILURE)(_M.Failcode.TYPE_INCORRECT,n)},VALUE_INCORRECT:function(r,t,n){return(0,yu.FAILURE)(_M.Failcode.VALUE_INCORRECT,"Expected ".concat(r," ").concat(String(t),", but was ").concat(String(n)))},KEY_INCORRECT:function(r,t,n){return(0,yu.FAILURE)(_M.Failcode.KEY_INCORRECT,"Expected ".concat((0,pte.default)(r)," key to be ").concat((0,pte.default)(t),", but was ").concat((0,yu.typeOf)(n)))},CONTENT_INCORRECT:function(r,t){var n="Expected ".concat((0,pte.default)(r),", but was incompatible");return(0,yu.FAILURE)(_M.Failcode.CONTENT_INCORRECT,n,t)},ARGUMENT_INCORRECT:function(r){return(0,yu.FAILURE)(_M.Failcode.ARGUMENT_INCORRECT,r)},RETURN_INCORRECT:function(r){return(0,yu.FAILURE)(_M.Failcode.RETURN_INCORRECT,r)},CONSTRAINT_FAILED:function(r,t){var n=t?": ".concat(t):"";return(0,yu.FAILURE)(_M.Failcode.CONSTRAINT_FAILED,"Failed constraint check for ".concat((0,pte.default)(r)).concat(n))},PROPERTY_MISSING:function(r){var t="Expected ".concat((0,pte.default)(r),", but was missing");return(0,yu.FAILURE)(_M.Failcode.PROPERTY_MISSING,t)},PROPERTY_PRESENT:function(r){var t="Expected nothing, but was ".concat((0,yu.typeOf)(r));return(0,yu.FAILURE)(_M.Failcode.PROPERTY_PRESENT,t)},NOTHING_EXPECTED:function(r){var t="Expected nothing, but was ".concat((0,yu.typeOf)(r));return(0,yu.FAILURE)(_M.Failcode.NOTHING_EXPECTED,t)}})});var $jn=I($q=>{"use strict";var a_a=$q&&$q.__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},l_a=$q&&$q.__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($q,"__esModule",{value:!0});$q.Contract=void 0;var c_a=p1e(),u_a=rp();function d_a(){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 u="Expected ".concat(i.length," arguments but only received ").concat(a.length),c=u_a.FAILURE.ARGUMENT_INCORRECT(u);throw new c_a.ValidationError(c)}for(var d=0;d<i.length;d++)i[d].check(a[d]);return o.check(s.apply(void 0,l_a([],a_a(a),!1)))}}}}$q.Contract=d_a});var tWn=I(Zq=>{"use strict";var p_a=Zq&&Zq.__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},A_a=Zq&&Zq.__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(Zq,"__esModule",{value:!0});Zq.AsyncContract=void 0;var Zjn=p1e(),eWn=rp();function f_a(){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 u="Expected ".concat(i.length," arguments but only received ").concat(a.length),c=eWn.FAILURE.ARGUMENT_INCORRECT(u);throw new Zjn.ValidationError(c)}for(var d=0;d<i.length;d++)i[d].check(a[d]);var p=s.apply(void 0,A_a([],p_a(a),!1));if(!(p instanceof Promise)){var u="Expected function to return a promise, but instead got ".concat(p),c=eWn.FAILURE.RETURN_INCORRECT(u);throw new Zjn.ValidationError(c)}return p.then(o.check)}}}}Zq.AsyncContract=f_a});var rWn=I(TM=>{"use strict";var h_a=TM&&TM.__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.")},g_a=TM&&TM.__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(TM,"__esModule",{value:!0});TM.when=TM.match=void 0;function m_a(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];return function(n){var i,o;try{for(var s=h_a(r),a=s.next();!a.done;a=s.next()){var l=g_a(a.value,2),u=l[0],c=l[1];if(u.guard(n))return c(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")}}TM.match=m_a;function y_a(r,t){return[r,t]}TM.when=y_a});var I1=I(tU=>{"use strict";Object.defineProperty(tU,"__esModule",{value:!0});tU.innerValidate=tU.create=tU.isRuntype=void 0;var eU=uO(),E_a=n8e(),b_a=p1e(),nWn=rp(),iWn=Symbol(),C_a=function(r){return(0,nWn.hasKey)(iWn,r)};tU.isRuntype=C_a;function I_a(r,t){return t[iWn]=!0,t.check=n,t.assert=n,t._innerValidate=function(p,A){return A.has(p,t)?(0,nWn.SUCCESS)(p):r(p,A)},t.validate=function(p){return t._innerValidate(p,S_a())},t.guard=i,t.Or=o,t.And=s,t.optional=a,t.nullable=l,t.withConstraint=u,t.withGuard=c,t.withBrand=d,t.reflect=t,t.toString=function(){return"Runtype<".concat((0,E_a.default)(t),">")},t;function n(p){var A=t.validate(p);if(A.success)return A.value;throw new b_a.ValidationError(A)}function i(p){return t.validate(p).success}function o(p){return(0,eU.Union)(t,p)}function s(p){return(0,eU.Intersect)(t,p)}function a(){return(0,eU.Optional)(t)}function l(){return(0,eU.Union)(t,eU.Null)}function u(p,A){return(0,eU.Constraint)(t,p,A)}function c(p,A){return(0,eU.Constraint)(t,p,A)}function d(p){return(0,eU.Brand)(p,t)}}tU.create=I_a;function v_a(r,t,n){return r._innerValidate(t,n)}tU.innerValidate=v_a;function S_a(){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 cst=I(lst=>{"use strict";Object.defineProperty(lst,"__esModule",{value:!0});lst.Unknown=void 0;var O_a=I1(),w_a=rp(),__a={tag:"unknown"};lst.Unknown=(0,O_a.create)(function(r){return(0,w_a.SUCCESS)(r)},__a)});var oWn=I(ust=>{"use strict";Object.defineProperty(ust,"__esModule",{value:!0});ust.Never=void 0;var T_a=I1(),B_a=rp(),R_a={tag:"never"};ust.Never=(0,T_a.create)(B_a.FAILURE.NOTHING_EXPECTED,R_a)});var sWn=I(dst=>{"use strict";Object.defineProperty(dst,"__esModule",{value:!0});dst.Void=void 0;var M_a=cst();dst.Void=M_a.Unknown});var xar=I(A1e=>{"use strict";var pst=A1e&&A1e.__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(A1e,"__esModule",{value:!0});A1e.Union=void 0;var Ast=I1(),i8e=rp();function x_a(){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,Ast.create)(function(o,s){var a,l,u,c,d,p,A,f;if(typeof o!="object"||o===null){try{for(var h=pst(r),y=h.next();!y.done;y=h.next()){var C=y.value;if((0,Ast.innerValidate)(C,o,s).success)return(0,i8e.SUCCESS)(o)}}catch(Y){a={error:Y}}finally{try{y&&!y.done&&(l=h.return)&&l.call(h)}finally{if(a)throw a.error}}return i8e.FAILURE.TYPE_INCORRECT(i,o)}var O={};try{for(var w=pst(r),T=w.next();!T.done;T=w.next()){var C=T.value;if(C.reflect.tag==="record"){var R=function(j){var k=C.reflect.fields[j];k.tag==="literal"&&(O[j]?O[j].every(function(X){return X!==k.value})&&O[j].push(k.value):O[j]=[k.value])};for(var P in C.reflect.fields)R(P)}}}catch(Y){u={error:Y}}finally{try{T&&!T.done&&(c=w.return)&&c.call(w)}finally{if(u)throw u.error}}for(var P in O)if(O[P].length===r.length)try{for(var z=(d=void 0,pst(r)),q=z.next();!q.done;q=z.next()){var C=q.value;if(C.reflect.tag==="record"){var H=C.reflect.fields[P];if(H.tag==="literal"&&(0,i8e.hasKey)(P,o)&&o[P]===H.value)return(0,Ast.innerValidate)(C,o,s)}}}catch(j){d={error:j}}finally{try{q&&!q.done&&(p=z.return)&&p.call(z)}finally{if(d)throw d.error}}try{for(var V=pst(r),U=V.next();!U.done;U=V.next()){var Q=U.value;if((0,Ast.innerValidate)(Q,o,s).success)return(0,i8e.SUCCESS)(o)}}catch(Y){A={error:Y}}finally{try{U&&!U.done&&(f=V.return)&&f.call(V)}finally{if(A)throw A.error}}return i8e.FAILURE.TYPE_INCORRECT(i,o)},i)}A1e.Union=x_a});var Par=I(_b=>{"use strict";Object.defineProperty(_b,"__esModule",{value:!0});_b.Nullish=_b.Null=_b.Undefined=_b.Literal=_b.literal=void 0;var D_a=I1(),aWn=rp(),N_a=xar();function Dar(r){return Array.isArray(r)?String(r.map(String)):typeof r=="bigint"?String(r)+"n":String(r)}_b.literal=Dar;function Nar(r){var t={tag:"literal",value:r};return(0,D_a.create)(function(n){return n===r?(0,aWn.SUCCESS)(n):aWn.FAILURE.VALUE_INCORRECT("literal","`".concat(Dar(r),"`"),"`".concat(Dar(n),"`"))},t)}_b.Literal=Nar;_b.Undefined=Nar(void 0);_b.Null=Nar(null);_b.Nullish=(0,N_a.Union)(_b.Null,_b.Undefined)});var pWn=I(BM=>{"use strict";var rU=BM&&BM.__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},kar=BM&&BM.__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))},lWn=BM&&BM.__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(BM,"__esModule",{value:!0});BM.Template=void 0;var fst=I1(),cWn=n8e(),IP=rp(),dWn=Par(),Qar=function(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},P_a=function(r){if(0<r.length&&Array.isArray(r[0])){var t=rU(r),n=t[0],i=t.slice(1);return[Array.from(n),i]}else{var o=r,n=o.reduce(function(l,u){return(0,fst.isRuntype)(u)?l.push(""):l.push(l.pop()+String(u)),l},[""]),i=o.filter(fst.isRuntype);return[n,i]}},k_a=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,kar([n,1],rU(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],u=a.slice(1,-1),c=a[a.length-1];r.splice.apply(r,kar(kar([n,2,r[n]+l],rU(u),!1),[c+r[n+1]],!1))}break}case"union":{var d=t[n];if(d.alternatives.length===1)try{var p=a8e(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 A=t[n];if(A.intersectees.length===1)try{var f=a8e(A);t.splice(n,1);var o=String(f.value);r.splice(n,2,r[n]+o+r[n+1]);break}catch{n++;break}else{n++;break}}default:n++;break}},Q_a=function(r){var t=rU(P_a(r),2),n=t[0],i=t[1];return k_a(n,i),[n,i]},a8e=function(r){switch(r.reflect.tag){case"literal":return r;case"brand":return a8e(r.reflect.entity);case"union":if(r.reflect.alternatives.length===1)return a8e(r.reflect.alternatives[0]);break;case"intersect":if(r.reflect.intersectees.length===1)return a8e(r.reflect.intersectees[0]);break;default:break}throw void 0},uWn=function(r){return r},Lar={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"]},o8e=function(r){switch(r.tag){case"literal":{var t=rU(Lar[(0,IP.typeOf)(r.value)]||[uWn],1),n=t[0];return n}case"brand":return o8e(r.entity);case"constraint":return o8e(r.underlying);case"union":return r.alternatives.map(o8e);case"intersect":return r.intersectees.map(o8e);default:var i=rU(Lar[r.tag]||[uWn],1),o=i[0];return o}},Far=function(r,t){return function(n){var i,o,s,a,l=o8e(r);if(Array.isArray(l))switch(r.tag){case"union":try{for(var u=lWn(r.alternatives),c=u.next();!c.done;c=u.next()){var d=c.value,p=Far(d.reflect,t)(n);if(p.success)return p}}catch(C){i={error:C}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return IP.FAILURE.TYPE_INCORRECT(r,n);case"intersect":try{for(var A=lWn(r.intersectees),f=A.next();!f.done;f=A.next()){var h=f.value,p=Far(h.reflect,t)(n);if(!p.success)return p}}catch(C){s={error:C}}finally{try{f&&!f.done&&(a=A.return)&&a.call(A)}finally{if(s)throw s.error}}return(0,IP.SUCCESS)(n);default:throw Error("impossible")}else{var y=l,p=(0,fst.innerValidate)(r,y(n),t);return!p.success&&p.code==="VALUE_INCORRECT"&&r.tag==="literal"?IP.FAILURE.VALUE_INCORRECT("literal",'"'.concat((0,dWn.literal)(r.value),'"'),'"'.concat(n,'"')):p}}},s8e=function(r){switch(r.tag){case"literal":return Qar(String(r.value));case"brand":return s8e(r.entity);case"constraint":return s8e(r.underlying);case"union":return r.alternatives.map(s8e).join("|");case"template":return r.strings.map(Qar).reduce(function(i,o,s){var a=i+o,l=r.runtypes[s];return l?a+"(?:".concat(s8e(l.reflect),")"):a},"");default:var t=rU(Lar[r.tag]||[void 0,".*"]),n=t.slice(1);return n.join("|")}},L_a=function(r){var t=r.strings.map(Qar).reduce(function(n,i,o){var s=n+i,a=r.runtypes[o];return a?s+"(".concat(s8e(a.reflect),")"):s},"");return new RegExp("^".concat(t,"$"),"su")};function F_a(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n=rU(Q_a(r),2),i=n[0],o=n[1],s={tag:"template",strings:i,runtypes:o},a=L_a(s),l=function(u,c){var d=u.match(a);if(d){for(var p=d.slice(1),A=0;A<o.length;A++){var f=o[A],h=p[A],y=Far(f.reflect,c)(h);if(!y.success)return y}return(0,IP.SUCCESS)(u)}else return IP.FAILURE.VALUE_INCORRECT("string","".concat((0,cWn.default)(s)),'"'.concat((0,dWn.literal)(u),'"'))};return(0,fst.create)(function(u,c){if(typeof u!="string")return IP.FAILURE.TYPE_INCORRECT(s,u);var d=l(u,c);if(d.success)return(0,IP.SUCCESS)(u);var p=IP.FAILURE.VALUE_INCORRECT("string","".concat((0,cWn.default)(s)),'"'.concat(u,'"'));return p.message!==d.message&&(p.message+=" (inner: ".concat(d.message,")")),p},s)}BM.Template=F_a});var hWn=I(hst=>{"use strict";Object.defineProperty(hst,"__esModule",{value:!0});hst.Boolean=void 0;var z_a=I1(),AWn=rp(),fWn={tag:"boolean"};hst.Boolean=(0,z_a.create)(function(r){return typeof r=="boolean"?(0,AWn.SUCCESS)(r):AWn.FAILURE.TYPE_INCORRECT(fWn,r)},fWn)});var yWn=I(gst=>{"use strict";Object.defineProperty(gst,"__esModule",{value:!0});gst.Number=void 0;var q_a=I1(),gWn=rp(),mWn={tag:"number"};gst.Number=(0,q_a.create)(function(r){return typeof r=="number"?(0,gWn.SUCCESS)(r):gWn.FAILURE.TYPE_INCORRECT(mWn,r)},mWn)});var CWn=I(mst=>{"use strict";Object.defineProperty(mst,"__esModule",{value:!0});mst.BigInt=void 0;var U_a=I1(),EWn=rp(),bWn={tag:"bigint"};mst.BigInt=(0,U_a.create)(function(r){return typeof r=="bigint"?(0,EWn.SUCCESS)(r):EWn.FAILURE.TYPE_INCORRECT(bWn,r)},bWn)});var zar=I(yst=>{"use strict";Object.defineProperty(yst,"__esModule",{value:!0});yst.String=void 0;var j_a=I1(),IWn=rp(),vWn={tag:"string"};yst.String=(0,j_a.create)(function(r){return typeof r=="string"?(0,IWn.SUCCESS)(r):IWn.FAILURE.TYPE_INCORRECT(vWn,r)},vWn)});var _Wn=I(Est=>{"use strict";Object.defineProperty(Est,"__esModule",{value:!0});Est.Symbol=void 0;var wWn=I1(),l8e=rp(),W_a=function(r){var t={tag:"symbol",key:r};return(0,wWn.create)(function(n){if(typeof n!="symbol")return l8e.FAILURE.TYPE_INCORRECT(t,n);var i=globalThis.Symbol.keyFor(n);return i!==r?l8e.FAILURE.VALUE_INCORRECT("symbol key",OWn(r),OWn(i)):(0,l8e.SUCCESS)(n)},t)},SWn={tag:"symbol"};Est.Symbol=(0,wWn.create)(function(r){return typeof r=="symbol"?(0,l8e.SUCCESS)(r):l8e.FAILURE.TYPE_INCORRECT(SWn,r)},Object.assign(W_a,SWn));var OWn=function(r){return r===void 0?"undefined":'"'.concat(r,'"')}});var RWn=I(bst=>{"use strict";Object.defineProperty(bst,"__esModule",{value:!0});bst.Array=void 0;var TWn=I1(),c8e=rp();function BWn(r,t){var n={tag:"array",isReadonly:t,element:r};return V_a((0,TWn.create)(function(i,o){if(!Array.isArray(i))return c8e.FAILURE.TYPE_INCORRECT(n,i);var s=(0,c8e.enumerableKeysOf)(i),a=s.map(function(u){return(0,TWn.innerValidate)(r,i[u],o)}),l=s.reduce(function(u,c){var d=a[c];return d.success||(u[c]=d.details||d.message),u},[]);return(0,c8e.enumerableKeysOf)(l).length!==0?c8e.FAILURE.CONTENT_INCORRECT(n,l):(0,c8e.SUCCESS)(i)},n))}function G_a(r){return BWn(r,!1)}bst.Array=G_a;function V_a(r){return r.asReadonly=t,r;function t(){return BWn(r.element,!0)}}});var xWn=I(Cst=>{"use strict";Object.defineProperty(Cst,"__esModule",{value:!0});Cst.Tuple=void 0;var MWn=I1(),f1e=rp();function H_a(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"tuple",components:r};return(0,MWn.create)(function(i,o){if(!Array.isArray(i))return f1e.FAILURE.TYPE_INCORRECT(n,i);if(i.length!==r.length)return f1e.FAILURE.CONSTRAINT_FAILED(n,"Expected length ".concat(r.length,", but was ").concat(i.length));var s=(0,f1e.enumerableKeysOf)(i),a=s.map(function(u){return(0,MWn.innerValidate)(r[u],i[u],o)}),l=s.reduce(function(u,c){var d=a[c];return d.success||(u[c]=d.details||d.message),u},[]);return(0,f1e.enumerableKeysOf)(l).length!==0?f1e.FAILURE.CONTENT_INCORRECT(n,l):(0,f1e.SUCCESS)(i)},n)}Cst.Tuple=H_a});var NWn=I(dO=>{"use strict";var qar=dO&&dO.__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},Uar=dO&&dO.__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(dO,"__esModule",{value:!0});dO.Partial=dO.Record=dO.InternalRecord=void 0;var DWn=I1(),Tb=rp();function nU(r,t,n){var i={tag:"record",isPartial:t,isReadonly:n,fields:r};return J_a((0,DWn.create)(function(o,s){if(o==null)return Tb.FAILURE.TYPE_INCORRECT(i,o);var a=(0,Tb.enumerableKeysOf)(r);if(a.length!==0&&typeof o!="object")return Tb.FAILURE.TYPE_INCORRECT(i,o);var l=Uar([],qar(new Set(Uar(Uar([],qar(a),!1),qar((0,Tb.enumerableKeysOf)(o)),!1))),!1),u=l.reduce(function(d,p){var A=(0,Tb.hasKey)(p,r),f=(0,Tb.hasKey)(p,o);if(A){var h=r[p],y=t||h.reflect.tag==="optional";if(f){var C=o[p];y&&C===void 0?d[p]=(0,Tb.SUCCESS)(C):d[p]=(0,DWn.innerValidate)(h,C,s)}else y?d[p]=(0,Tb.SUCCESS)(void 0):d[p]=Tb.FAILURE.PROPERTY_MISSING(h.reflect)}else if(f){var C=o[p];d[p]=(0,Tb.SUCCESS)(C)}else throw new Error("impossible");return d},{}),c=l.reduce(function(d,p){var A=u[p];return A.success||(d[p]=A.details||A.message),d},{});return(0,Tb.enumerableKeysOf)(c).length!==0?Tb.FAILURE.CONTENT_INCORRECT(i,c):(0,Tb.SUCCESS)(o)},i))}dO.InternalRecord=nU;function K_a(r){return nU(r,!1,!1)}dO.Record=K_a;function Y_a(r){return nU(r,!0,!1)}dO.Partial=Y_a;function J_a(r){return r.asPartial=t,r.asReadonly=n,r.pick=i,r.omit=o,r.extend=s,r;function t(){return nU(r.fields,!0,r.isReadonly)}function n(){return nU(r.fields,r.isPartial,!0)}function i(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u={};return a.forEach(function(c){u[c]=r.fields[c]}),nU(u,r.isPartial,r.isReadonly)}function o(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];var u={},c=(0,Tb.enumerableKeysOf)(r.fields);return c.forEach(function(d){a.includes(d)||(u[d]=r.fields[d])}),nU(u,r.isPartial,r.isReadonly)}function s(a){return nU(Object.assign({},r.fields,a),r.isPartial,r.isReadonly)}}});var War=I(h1e=>{"use strict";Object.defineProperty(h1e,"__esModule",{value:!0});h1e.Guard=h1e.Constraint=void 0;var X_a=I1(),jar=rp(),$_a=cst();function Z_a(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,X_a.create)(function(a){var l=r.validate(a);if(!l.success)return l;var u=t(l.value);return typeof u=="string"?jar.FAILURE.CONSTRAINT_FAILED(s,u):u?(0,jar.SUCCESS)(l.value):jar.FAILURE.CONSTRAINT_FAILED(s)},s)}h1e.Constraint=Z_a;var e6a=function(r,t){return $_a.Unknown.withGuard(r,t)};h1e.Guard=e6a});var kWn=I(Ist=>{"use strict";Object.defineProperty(Ist,"__esModule",{value:!0});Ist.Dictionary=void 0;var PWn=I1(),Gar=zar(),t6a=War(),r6a=n8e(),Ate=rp(),n6a=(0,t6a.Constraint)(Gar.String,function(r){return!isNaN(+r)},{name:"number"});function i6a(r,t){var n=t===void 0||t==="string"?Gar.String:t==="number"?n6a:t,i=(0,r6a.default)(n),o={tag:"dictionary",key:i,value:r};return(0,PWn.create)(function(s,a){if(s==null||typeof s!="object"||Object.getPrototypeOf(s)!==Object.prototype&&(!Array.isArray(s)||i==="string"))return Ate.FAILURE.TYPE_INCORRECT(o,s);var l=/^(?:NaN|-?\d+(?:\.\d+)?)$/,u=(0,Ate.enumerableKeysOf)(s),c=u.reduce(function(p,A){var f=typeof A=="string"&&l.test(A),h=f?globalThis.Number(A):A;return(f?!n.guard(h)&&!n.guard(A):!n.guard(h))?p[A]=Ate.FAILURE.KEY_INCORRECT(o,n.reflect,h):p[A]=(0,PWn.innerValidate)(r,s[A],a),p},{}),d=u.reduce(function(p,A){var f=c[A];return f.success||(p[A]=f.details||f.message),p},{});return(0,Ate.enumerableKeysOf)(d).length!==0?Ate.FAILURE.CONTENT_INCORRECT(o,d):(0,Ate.SUCCESS)(s)},o)}Ist.Dictionary=i6a});var LWn=I(g1e=>{"use strict";var o6a=g1e&&g1e.__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(g1e,"__esModule",{value:!0});g1e.Intersect=void 0;var QWn=I1(),s6a=rp();function a6a(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var n={tag:"intersect",intersectees:r};return(0,QWn.create)(function(i,o){var s,a;try{for(var l=o6a(r),u=l.next();!u.done;u=l.next()){var c=u.value,d=(0,QWn.innerValidate)(c,i,o);if(!d.success)return d}}catch(p){s={error:p}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(s)throw s.error}}return(0,s6a.SUCCESS)(i)},n)}g1e.Intersect=a6a});var FWn=I(vst=>{"use strict";Object.defineProperty(vst,"__esModule",{value:!0});vst.Optional=void 0;var l6a=I1(),c6a=rp();function u6a(r){var t={tag:"optional",underlying:r};return(0,l6a.create)(function(n){return n===void 0?(0,c6a.SUCCESS)(n):r.validate(n)},t)}vst.Optional=u6a});var UWn=I(Sst=>{"use strict";Object.defineProperty(Sst,"__esModule",{value:!0});Sst.Function=void 0;var d6a=I1(),zWn=rp(),qWn={tag:"function"};Sst.Function=(0,d6a.create)(function(r){return typeof r=="function"?(0,zWn.SUCCESS)(r):zWn.FAILURE.TYPE_INCORRECT(qWn,r)},qWn)});var WWn=I(Ost=>{"use strict";Object.defineProperty(Ost,"__esModule",{value:!0});Ost.InstanceOf=void 0;var p6a=I1(),jWn=rp();function A6a(r){var t={tag:"instanceof",ctor:r};return(0,p6a.create)(function(n){return n instanceof r?(0,jWn.SUCCESS)(n):jWn.FAILURE.TYPE_INCORRECT(t,n)},t)}Ost.InstanceOf=A6a});var GWn=I(wst=>{"use strict";Object.defineProperty(wst,"__esModule",{value:!0});wst.Lazy=void 0;var f6a=I1();function h6a(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,f6a.create)(function(o){return i().validate(o)},t)}wst.Lazy=h6a});var VWn=I(_st=>{"use strict";Object.defineProperty(_st,"__esModule",{value:!0});_st.Brand=void 0;var g6a=I1();function m6a(r,t){var n={tag:"brand",brand:r,entity:t};return(0,g6a.create)(function(i){return t.validate(i)},n)}_st.Brand=m6a});var HWn=I(m1e=>{"use strict";Object.defineProperty(m1e,"__esModule",{value:!0});m1e.checked=m1e.check=void 0;var y6a=p1e(),E6a=rp(),Var=new WeakMap;function b6a(r,t,n){var i=Var.get(r)||new Map;Var.set(r,i);var o=i.get(t)||[];i.set(t,o),o.push(n)}m1e.check=b6a;function C6a(r,t,n){var i=Var.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 I6a(){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=C6a(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 u=[],c=0;c<arguments.length;c++)u[c]=arguments[c];return r.forEach(function(d,p){var A=l[p],f=d.validate(u[A]);if(!f.success){var h="".concat(a,", argument #").concat(A,": ").concat(f.message),y=E6a.FAILURE.ARGUMENT_INCORRECT(h);throw new y6a.ValidationError(y)}}),s.apply(this,u)}}}m1e.checked=I6a});var uO=I(Ms=>{"use strict";var v6a=Ms&&Ms.__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]}),Wu=Ms&&Ms.__exportStar||function(r,t){for(var n in r)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&v6a(t,r,n)};Object.defineProperty(Ms,"__esModule",{value:!0});Ms.InstanceOf=Ms.Nullish=Ms.Null=Ms.Undefined=Ms.Literal=void 0;Wu(Jjn(),Ms);Wu(Bar(),Ms);Wu($jn(),Ms);Wu(tWn(),Ms);Wu(rWn(),Ms);Wu(p1e(),Ms);Wu(cst(),Ms);Wu(oWn(),Ms);Wu(sWn(),Ms);var Tst=Par();Object.defineProperty(Ms,"Literal",{enumerable:!0,get:function(){return Tst.Literal}});Object.defineProperty(Ms,"Undefined",{enumerable:!0,get:function(){return Tst.Undefined}});Object.defineProperty(Ms,"Null",{enumerable:!0,get:function(){return Tst.Null}});Object.defineProperty(Ms,"Nullish",{enumerable:!0,get:function(){return Tst.Nullish}});Wu(pWn(),Ms);Wu(hWn(),Ms);Wu(yWn(),Ms);Wu(CWn(),Ms);Wu(zar(),Ms);Wu(_Wn(),Ms);Wu(RWn(),Ms);Wu(xWn(),Ms);Wu(NWn(),Ms);Wu(kWn(),Ms);Wu(xar(),Ms);Wu(LWn(),Ms);Wu(FWn(),Ms);Wu(UWn(),Ms);var S6a=WWn();Object.defineProperty(Ms,"InstanceOf",{enumerable:!0,get:function(){return S6a.InstanceOf}});Wu(GWn(),Ms);Wu(War(),Ms);Wu(VWn(),Ms);Wu(HWn(),Ms)});var u8e=I((WZ0,KWn)=>{var O6a="2.0.0",w6a=Number.MAX_SAFE_INTEGER||9007199254740991,_6a=16,T6a=250,B6a=["major","premajor","minor","preminor","patch","prepatch","prerelease"];KWn.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:_6a,MAX_SAFE_BUILD_LENGTH:T6a,MAX_SAFE_INTEGER:w6a,RELEASE_TYPES:B6a,SEMVER_SPEC_VERSION:O6a,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var d8e=I((GZ0,YWn)=>{var R6a=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};YWn.exports=R6a});var y1e=I((vP,JWn)=>{var{MAX_SAFE_COMPONENT_LENGTH:Har,MAX_SAFE_BUILD_LENGTH:M6a,MAX_LENGTH:x6a}=u8e(),D6a=d8e();vP=JWn.exports={};var N6a=vP.re=[],P6a=vP.safeRe=[],Ui=vP.src=[],ji=vP.t={},k6a=0,Kar="[a-zA-Z0-9-]",Q6a=[["\\s",1],["\\d",x6a],[Kar,M6a]],L6a=r=>{for(let[t,n]of Q6a)r=r.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return r},pa=(r,t,n)=>{let i=L6a(t),o=k6a++;D6a(r,o,t),ji[r]=o,Ui[o]=t,N6a[o]=new RegExp(t,n?"g":void 0),P6a[o]=new RegExp(i,n?"g":void 0)};pa("NUMERICIDENTIFIER","0|[1-9]\\d*");pa("NUMERICIDENTIFIERLOOSE","\\d+");pa("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Kar}*`);pa("MAINVERSION",`(${Ui[ji.NUMERICIDENTIFIER]})\\.(${Ui[ji.NUMERICIDENTIFIER]})\\.(${Ui[ji.NUMERICIDENTIFIER]})`);pa("MAINVERSIONLOOSE",`(${Ui[ji.NUMERICIDENTIFIERLOOSE]})\\.(${Ui[ji.NUMERICIDENTIFIERLOOSE]})\\.(${Ui[ji.NUMERICIDENTIFIERLOOSE]})`);pa("PRERELEASEIDENTIFIER",`(?:${Ui[ji.NUMERICIDENTIFIER]}|${Ui[ji.NONNUMERICIDENTIFIER]})`);pa("PRERELEASEIDENTIFIERLOOSE",`(?:${Ui[ji.NUMERICIDENTIFIERLOOSE]}|${Ui[ji.NONNUMERICIDENTIFIER]})`);pa("PRERELEASE",`(?:-(${Ui[ji.PRERELEASEIDENTIFIER]}(?:\\.${Ui[ji.PRERELEASEIDENTIFIER]})*))`);pa("PRERELEASELOOSE",`(?:-?(${Ui[ji.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Ui[ji.PRERELEASEIDENTIFIERLOOSE]})*))`);pa("BUILDIDENTIFIER",`${Kar}+`);pa("BUILD",`(?:\\+(${Ui[ji.BUILDIDENTIFIER]}(?:\\.${Ui[ji.BUILDIDENTIFIER]})*))`);pa("FULLPLAIN",`v?${Ui[ji.MAINVERSION]}${Ui[ji.PRERELEASE]}?${Ui[ji.BUILD]}?`);pa("FULL",`^${Ui[ji.FULLPLAIN]}$`);pa("LOOSEPLAIN",`[v=\\s]*${Ui[ji.MAINVERSIONLOOSE]}${Ui[ji.PRERELEASELOOSE]}?${Ui[ji.BUILD]}?`);pa("LOOSE",`^${Ui[ji.LOOSEPLAIN]}$`);pa("GTLT","((?:<|>)?=?)");pa("XRANGEIDENTIFIERLOOSE",`${Ui[ji.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);pa("XRANGEIDENTIFIER",`${Ui[ji.NUMERICIDENTIFIER]}|x|X|\\*`);pa("XRANGEPLAIN",`[v=\\s]*(${Ui[ji.XRANGEIDENTIFIER]})(?:\\.(${Ui[ji.XRANGEIDENTIFIER]})(?:\\.(${Ui[ji.XRANGEIDENTIFIER]})(?:${Ui[ji.PRERELEASE]})?${Ui[ji.BUILD]}?)?)?`);pa("XRANGEPLAINLOOSE",`[v=\\s]*(${Ui[ji.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Ui[ji.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Ui[ji.XRANGEIDENTIFIERLOOSE]})(?:${Ui[ji.PRERELEASELOOSE]})?${Ui[ji.BUILD]}?)?)?`);pa("XRANGE",`^${Ui[ji.GTLT]}\\s*${Ui[ji.XRANGEPLAIN]}$`);pa("XRANGELOOSE",`^${Ui[ji.GTLT]}\\s*${Ui[ji.XRANGEPLAINLOOSE]}$`);pa("COERCE",`(^|[^\\d])(\\d{1,${Har}})(?:\\.(\\d{1,${Har}}))?(?:\\.(\\d{1,${Har}}))?(?:$|[^\\d])`);pa("COERCERTL",Ui[ji.COERCE],!0);pa("LONETILDE","(?:~>?)");pa("TILDETRIM",`(\\s*)${Ui[ji.LONETILDE]}\\s+`,!0);vP.tildeTrimReplace="$1~";pa("TILDE",`^${Ui[ji.LONETILDE]}${Ui[ji.XRANGEPLAIN]}$`);pa("TILDELOOSE",`^${Ui[ji.LONETILDE]}${Ui[ji.XRANGEPLAINLOOSE]}$`);pa("LONECARET","(?:\\^)");pa("CARETTRIM",`(\\s*)${Ui[ji.LONECARET]}\\s+`,!0);vP.caretTrimReplace="$1^";pa("CARET",`^${Ui[ji.LONECARET]}${Ui[ji.XRANGEPLAIN]}$`);pa("CARETLOOSE",`^${Ui[ji.LONECARET]}${Ui[ji.XRANGEPLAINLOOSE]}$`);pa("COMPARATORLOOSE",`^${Ui[ji.GTLT]}\\s*(${Ui[ji.LOOSEPLAIN]})$|^$`);pa("COMPARATOR",`^${Ui[ji.GTLT]}\\s*(${Ui[ji.FULLPLAIN]})$|^$`);pa("COMPARATORTRIM",`(\\s*)${Ui[ji.GTLT]}\\s*(${Ui[ji.LOOSEPLAIN]}|${Ui[ji.XRANGEPLAIN]})`,!0);vP.comparatorTrimReplace="$1$2$3";pa("HYPHENRANGE",`^\\s*(${Ui[ji.XRANGEPLAIN]})\\s+-\\s+(${Ui[ji.XRANGEPLAIN]})\\s*$`);pa("HYPHENRANGELOOSE",`^\\s*(${Ui[ji.XRANGEPLAINLOOSE]})\\s+-\\s+(${Ui[ji.XRANGEPLAINLOOSE]})\\s*$`);pa("STAR","(<|>)?=?\\s*\\*");pa("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");pa("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Bst=I((VZ0,XWn)=>{var F6a=Object.freeze({loose:!0}),z6a=Object.freeze({}),q6a=r=>r?typeof r!="object"?F6a:r:z6a;XWn.exports=q6a});var Yar=I((HZ0,eGn)=>{var $Wn=/^[0-9]+$/,ZWn=(r,t)=>{let n=$Wn.test(r),i=$Wn.test(t);return n&&i&&(r=+r,t=+t),r===t?0:n&&!i?-1:i&&!n?1:r<t?-1:1},U6a=(r,t)=>ZWn(t,r);eGn.exports={compareIdentifiers:ZWn,rcompareIdentifiers:U6a}});var $2=I((KZ0,iGn)=>{var Rst=d8e(),{MAX_LENGTH:tGn,MAX_SAFE_INTEGER:Mst}=u8e(),{safeRe:rGn,t:nGn}=y1e(),j6a=Bst(),{compareIdentifiers:E1e}=Yar(),Jar=class r{constructor(t,n){if(n=j6a(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>tGn)throw new TypeError(`version is longer than ${tGn} characters`);Rst("SemVer",t,n),this.options=n,this.loose=!!n.loose,this.includePrerelease=!!n.includePrerelease;let i=t.trim().match(n.loose?rGn[nGn.LOOSE]:rGn[nGn.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>Mst||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Mst||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Mst||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<Mst)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(Rst("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)),E1e(this.major,t.major)||E1e(this.minor,t.minor)||E1e(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(Rst("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 E1e(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(Rst("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 E1e(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]),E1e(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}};iGn.exports=Jar});var fte=I((YZ0,sGn)=>{var oGn=$2(),W6a=(r,t,n=!1)=>{if(r instanceof oGn)return r;try{return new oGn(r,t)}catch(i){if(!n)return null;throw i}};sGn.exports=W6a});var lGn=I((JZ0,aGn)=>{var G6a=fte(),V6a=(r,t)=>{let n=G6a(r,t);return n?n.version:null};aGn.exports=V6a});var uGn=I((XZ0,cGn)=>{var H6a=fte(),K6a=(r,t)=>{let n=H6a(r.trim().replace(/^[=v]+/,""),t);return n?n.version:null};cGn.exports=K6a});var AGn=I(($Z0,pGn)=>{var dGn=$2(),Y6a=(r,t,n,i,o)=>{typeof n=="string"&&(o=i,i=n,n=void 0);try{return new dGn(r instanceof dGn?r.version:r,n).inc(t,i,o).version}catch{return null}};pGn.exports=Y6a});var gGn=I((ZZ0,hGn)=>{var fGn=fte(),J6a=(r,t)=>{let n=fGn(r,null,!0),i=fGn(t,null,!0),o=n.compare(i);if(o===0)return null;let s=o>0,a=s?n:i,l=s?i:n,u=!!a.prerelease.length;if(!!l.prerelease.length&&!u)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";let d=u?"pre":"";return n.major!==i.major?d+"major":n.minor!==i.minor?d+"minor":n.patch!==i.patch?d+"patch":"prerelease"};hGn.exports=J6a});var yGn=I((eed,mGn)=>{var X6a=$2(),$6a=(r,t)=>new X6a(r,t).major;mGn.exports=$6a});var bGn=I((ted,EGn)=>{var Z6a=$2(),eTa=(r,t)=>new Z6a(r,t).minor;EGn.exports=eTa});var IGn=I((red,CGn)=>{var tTa=$2(),rTa=(r,t)=>new tTa(r,t).patch;CGn.exports=rTa});var SGn=I((ned,vGn)=>{var nTa=fte(),iTa=(r,t)=>{let n=nTa(r,t);return n&&n.prerelease.length?n.prerelease:null};vGn.exports=iTa});var pO=I((ied,wGn)=>{var OGn=$2(),oTa=(r,t,n)=>new OGn(r,n).compare(new OGn(t,n));wGn.exports=oTa});var TGn=I((oed,_Gn)=>{var sTa=pO(),aTa=(r,t,n)=>sTa(t,r,n);_Gn.exports=aTa});var RGn=I((sed,BGn)=>{var lTa=pO(),cTa=(r,t)=>lTa(r,t,!0);BGn.exports=cTa});var xst=I((aed,xGn)=>{var MGn=$2(),uTa=(r,t,n)=>{let i=new MGn(r,n),o=new MGn(t,n);return i.compare(o)||i.compareBuild(o)};xGn.exports=uTa});var NGn=I((led,DGn)=>{var dTa=xst(),pTa=(r,t)=>r.sort((n,i)=>dTa(n,i,t));DGn.exports=pTa});var kGn=I((ced,PGn)=>{var ATa=xst(),fTa=(r,t)=>r.sort((n,i)=>ATa(i,n,t));PGn.exports=fTa});var p8e=I((ued,QGn)=>{var hTa=pO(),gTa=(r,t,n)=>hTa(r,t,n)>0;QGn.exports=gTa});var Dst=I((ded,LGn)=>{var mTa=pO(),yTa=(r,t,n)=>mTa(r,t,n)<0;LGn.exports=yTa});var Xar=I((ped,FGn)=>{var ETa=pO(),bTa=(r,t,n)=>ETa(r,t,n)===0;FGn.exports=bTa});var $ar=I((Aed,zGn)=>{var CTa=pO(),ITa=(r,t,n)=>CTa(r,t,n)!==0;zGn.exports=ITa});var Nst=I((fed,qGn)=>{var vTa=pO(),STa=(r,t,n)=>vTa(r,t,n)>=0;qGn.exports=STa});var Pst=I((hed,UGn)=>{var OTa=pO(),wTa=(r,t,n)=>OTa(r,t,n)<=0;UGn.exports=wTa});var Zar=I((ged,jGn)=>{var _Ta=Xar(),TTa=$ar(),BTa=p8e(),RTa=Nst(),MTa=Dst(),xTa=Pst(),DTa=(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 _Ta(r,n,i);case"!=":return TTa(r,n,i);case">":return BTa(r,n,i);case">=":return RTa(r,n,i);case"<":return MTa(r,n,i);case"<=":return xTa(r,n,i);default:throw new TypeError(`Invalid operator: ${t}`)}};jGn.exports=DTa});var GGn=I((med,WGn)=>{var NTa=$2(),PTa=fte(),{safeRe:kst,t:Qst}=y1e(),kTa=(r,t)=>{if(r instanceof NTa)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(kst[Qst.COERCE]);else{let i;for(;(i=kst[Qst.COERCERTL].exec(r))&&(!n||n.index+n[0].length!==r.length);)(!n||i.index+i[0].length!==n.index+n[0].length)&&(n=i),kst[Qst.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;kst[Qst.COERCERTL].lastIndex=-1}return n===null?null:PTa(`${n[2]}.${n[3]||"0"}.${n[4]||"0"}`,t)};WGn.exports=kTa});var HGn=I((yed,VGn)=>{"use strict";VGn.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}});var elr=I((Eed,KGn)=>{"use strict";KGn.exports=lc;lc.Node=hte;lc.create=lc;function lc(r){var t=this;if(t instanceof lc||(t=new lc),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}lc.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};lc.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++}};lc.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++}};lc.prototype.push=function(){for(var r=0,t=arguments.length;r<t;r++)LTa(this,arguments[r]);return this.length};lc.prototype.unshift=function(){for(var r=0,t=arguments.length;r<t;r++)FTa(this,arguments[r]);return this.length};lc.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}};lc.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}};lc.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};lc.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};lc.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};lc.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};lc.prototype.map=function(r,t){t=t||this;for(var n=new lc,i=this.head;i!==null;)n.push(r.call(t,i.value,this)),i=i.next;return n};lc.prototype.mapReverse=function(r,t){t=t||this;for(var n=new lc,i=this.tail;i!==null;)n.push(r.call(t,i.value,this)),i=i.prev;return n};lc.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};lc.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};lc.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};lc.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};lc.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 lc;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};lc.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 lc;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};lc.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=QTa(this,o,n[i]);return s};lc.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 QTa(r,t,n){var i=t===r.head?new hte(n,null,t,r):new hte(n,t,t.next,r);return i.next===null&&(r.tail=i),i.prev===null&&(r.head=i),r.length++,i}function LTa(r,t){r.tail=new hte(t,r.tail,null,r),r.head||(r.head=r.tail),r.length++}function FTa(r,t){r.head=new hte(t,null,r.head,r),r.tail||(r.tail=r.head),r.length++}function hte(r,t,n,i){if(!(this instanceof hte))return new hte(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{HGn()(lc)}catch{}});var I1e=I((bed,$Gn)=>{"use strict";var zTa=elr(),gte=Symbol("max"),OP=Symbol("length"),b1e=Symbol("lengthCalculator"),f8e=Symbol("allowStale"),mte=Symbol("maxAge"),SP=Symbol("dispose"),YGn=Symbol("noDisposeOnSet"),Kh=Symbol("lruList"),i6=Symbol("cache"),XGn=Symbol("updateAgeOnGet"),tlr=()=>1,nlr=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[gte]=t.max||1/0,i=t.length||tlr;if(this[b1e]=typeof i!="function"?tlr:i,this[f8e]=t.stale||!1,t.maxAge&&typeof t.maxAge!="number")throw new TypeError("maxAge must be a number");this[mte]=t.maxAge||0,this[SP]=t.dispose,this[YGn]=t.noDisposeOnSet||!1,this[XGn]=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[gte]=t||1/0,A8e(this)}get max(){return this[gte]}set allowStale(t){this[f8e]=!!t}get allowStale(){return this[f8e]}set maxAge(t){if(typeof t!="number")throw new TypeError("maxAge must be a non-negative number");this[mte]=t,A8e(this)}get maxAge(){return this[mte]}set lengthCalculator(t){typeof t!="function"&&(t=tlr),t!==this[b1e]&&(this[b1e]=t,this[OP]=0,this[Kh].forEach(n=>{n.length=this[b1e](n.value,n.key),this[OP]+=n.length})),A8e(this)}get lengthCalculator(){return this[b1e]}get length(){return this[OP]}get itemCount(){return this[Kh].length}rforEach(t,n){n=n||this;for(let i=this[Kh].tail;i!==null;){let o=i.prev;JGn(this,t,i,n),i=o}}forEach(t,n){n=n||this;for(let i=this[Kh].head;i!==null;){let o=i.next;JGn(this,t,i,n),i=o}}keys(){return this[Kh].toArray().map(t=>t.key)}values(){return this[Kh].toArray().map(t=>t.value)}reset(){this[SP]&&this[Kh]&&this[Kh].length&&this[Kh].forEach(t=>this[SP](t.key,t.value)),this[i6]=new Map,this[Kh]=new zTa,this[OP]=0}dump(){return this[Kh].map(t=>Lst(this,t)?!1:{k:t.key,v:t.value,e:t.now+(t.maxAge||0)}).toArray().filter(t=>t)}dumpLru(){return this[Kh]}set(t,n,i){if(i=i||this[mte],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let o=i?Date.now():0,s=this[b1e](n,t);if(this[i6].has(t)){if(s>this[gte])return C1e(this,this[i6].get(t)),!1;let u=this[i6].get(t).value;return this[SP]&&(this[YGn]||this[SP](t,u.value)),u.now=o,u.maxAge=i,u.value=n,this[OP]+=s-u.length,u.length=s,this.get(t),A8e(this),!0}let a=new ilr(t,n,s,o,i);return a.length>this[gte]?(this[SP]&&this[SP](t,n),!1):(this[OP]+=a.length,this[Kh].unshift(a),this[i6].set(t,this[Kh].head),A8e(this),!0)}has(t){if(!this[i6].has(t))return!1;let n=this[i6].get(t).value;return!Lst(this,n)}get(t){return rlr(this,t,!0)}peek(t){return rlr(this,t,!1)}pop(){let t=this[Kh].tail;return t?(C1e(this,t),t.value):null}del(t){C1e(this,this[i6].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[i6].forEach((t,n)=>rlr(this,n,!1))}},rlr=(r,t,n)=>{let i=r[i6].get(t);if(i){let o=i.value;if(Lst(r,o)){if(C1e(r,i),!r[f8e])return}else n&&(r[XGn]&&(i.value.now=Date.now()),r[Kh].unshiftNode(i));return o.value}},Lst=(r,t)=>{if(!t||!t.maxAge&&!r[mte])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:r[mte]&&n>r[mte]},A8e=r=>{if(r[OP]>r[gte])for(let t=r[Kh].tail;r[OP]>r[gte]&&t!==null;){let n=t.prev;C1e(r,t),t=n}},C1e=(r,t)=>{if(t){let n=t.value;r[SP]&&r[SP](n.key,n.value),r[OP]-=n.length,r[i6].delete(n.key),r[Kh].removeNode(t)}},ilr=class{constructor(t,n,i,o,s){this.key=t,this.value=n,this.length=i,this.now=o,this.maxAge=s||0}},JGn=(r,t,n,i)=>{let o=n.value;Lst(r,o)&&(C1e(r,n),r[f8e]||(o=void 0)),o&&t.call(i,o.value,o.key,r)};$Gn.exports=nlr});var AO=I((Ced,rVn)=>{var olr=class r{constructor(t,n){if(n=UTa(n),t instanceof r)return t.loose===!!n.loose&&t.includePrerelease===!!n.includePrerelease?t:new r(t.raw,n);if(t instanceof slr)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=>!eVn(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&&YTa(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&&HTa)|(this.options.loose&&KTa))+":"+t,o=ZGn.get(i);if(o)return o;let s=this.options.loose,a=s?Bb[N3.HYPHENRANGELOOSE]:Bb[N3.HYPHENRANGE];t=t.replace(a,oBa(this.options.includePrerelease)),Ad("hyphen replace",t),t=t.replace(Bb[N3.COMPARATORTRIM],WTa),Ad("comparator trim",t),t=t.replace(Bb[N3.TILDETRIM],GTa),Ad("tilde trim",t),t=t.replace(Bb[N3.CARETTRIM],VTa),Ad("caret trim",t);let l=t.split(" ").map(p=>JTa(p,this.options)).join(" ").split(/\s+/).map(p=>iBa(p,this.options));s&&(l=l.filter(p=>(Ad("loose invalid filter",p,this.options),!!p.match(Bb[N3.COMPARATORLOOSE])))),Ad("range list",l);let u=new Map,c=l.map(p=>new slr(p,this.options));for(let p of c){if(eVn(p))return[p];u.set(p.value,p)}u.size>1&&u.has("")&&u.delete("");let d=[...u.values()];return ZGn.set(i,d),d}intersects(t,n){if(!(t instanceof r))throw new TypeError("a Range is required");return this.set.some(i=>tVn(i,n)&&t.set.some(o=>tVn(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 jTa(t,this.options)}catch{return!1}for(let n=0;n<this.set.length;n++)if(sBa(this.set[n],t,this.options))return!0;return!1}};rVn.exports=olr;var qTa=I1e(),ZGn=new qTa({max:1e3}),UTa=Bst(),slr=h8e(),Ad=d8e(),jTa=$2(),{safeRe:Bb,t:N3,comparatorTrimReplace:WTa,tildeTrimReplace:GTa,caretTrimReplace:VTa}=y1e(),{FLAG_INCLUDE_PRERELEASE:HTa,FLAG_LOOSE:KTa}=u8e(),eVn=r=>r.value==="<0.0.0-0",YTa=r=>r.value==="",tVn=(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},JTa=(r,t)=>(Ad("comp",r,t),r=ZTa(r,t),Ad("caret",r),r=XTa(r,t),Ad("tildes",r),r=tBa(r,t),Ad("xrange",r),r=nBa(r,t),Ad("stars",r),r),P3=r=>!r||r.toLowerCase()==="x"||r==="*",XTa=(r,t)=>r.trim().split(/\s+/).map(n=>$Ta(n,t)).join(" "),$Ta=(r,t)=>{let n=t.loose?Bb[N3.TILDELOOSE]:Bb[N3.TILDE];return r.replace(n,(i,o,s,a,l)=>{Ad("tilde",r,i,o,s,a,l);let u;return P3(o)?u="":P3(s)?u=`>=${o}.0.0 <${+o+1}.0.0-0`:P3(a)?u=`>=${o}.${s}.0 <${o}.${+s+1}.0-0`:l?(Ad("replaceTilde pr",l),u=`>=${o}.${s}.${a}-${l} <${o}.${+s+1}.0-0`):u=`>=${o}.${s}.${a} <${o}.${+s+1}.0-0`,Ad("tilde return",u),u})},ZTa=(r,t)=>r.trim().split(/\s+/).map(n=>eBa(n,t)).join(" "),eBa=(r,t)=>{Ad("caret",r,t);let n=t.loose?Bb[N3.CARETLOOSE]:Bb[N3.CARET],i=t.includePrerelease?"-0":"";return r.replace(n,(o,s,a,l,u)=>{Ad("caret",r,o,s,a,l,u);let c;return P3(s)?c="":P3(a)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:P3(l)?s==="0"?c=`>=${s}.${a}.0${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.0${i} <${+s+1}.0.0-0`:u?(Ad("replaceCaret pr",u),s==="0"?a==="0"?c=`>=${s}.${a}.${l}-${u} <${s}.${a}.${+l+1}-0`:c=`>=${s}.${a}.${l}-${u} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${l}-${u} <${+s+1}.0.0-0`):(Ad("no pr"),s==="0"?a==="0"?c=`>=${s}.${a}.${l}${i} <${s}.${a}.${+l+1}-0`:c=`>=${s}.${a}.${l}${i} <${s}.${+a+1}.0-0`:c=`>=${s}.${a}.${l} <${+s+1}.0.0-0`),Ad("caret return",c),c})},tBa=(r,t)=>(Ad("replaceXRanges",r,t),r.split(/\s+/).map(n=>rBa(n,t)).join(" ")),rBa=(r,t)=>{r=r.trim();let n=t.loose?Bb[N3.XRANGELOOSE]:Bb[N3.XRANGE];return r.replace(n,(i,o,s,a,l,u)=>{Ad("xRange",r,i,o,s,a,l,u);let c=P3(s),d=c||P3(a),p=d||P3(l),A=p;return o==="="&&A&&(o=""),u=t.includePrerelease?"-0":"",c?o===">"||o==="<"?i="<0.0.0-0":i="*":o&&A?(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==="<"&&(u="-0"),i=`${o+s}.${a}.${l}${u}`):d?i=`>=${s}.0.0${u} <${+s+1}.0.0-0`:p&&(i=`>=${s}.${a}.0${u} <${s}.${+a+1}.0-0`),Ad("xRange return",i),i})},nBa=(r,t)=>(Ad("replaceStars",r,t),r.trim().replace(Bb[N3.STAR],"")),iBa=(r,t)=>(Ad("replaceGTE0",r,t),r.trim().replace(Bb[t.includePrerelease?N3.GTE0PRE:N3.GTE0],"")),oBa=r=>(t,n,i,o,s,a,l,u,c,d,p,A,f)=>(P3(i)?n="":P3(o)?n=`>=${i}.0.0${r?"-0":""}`:P3(s)?n=`>=${i}.${o}.0${r?"-0":""}`:a?n=`>=${n}`:n=`>=${n}${r?"-0":""}`,P3(c)?u="":P3(d)?u=`<${+c+1}.0.0-0`:P3(p)?u=`<${c}.${+d+1}.0-0`:A?u=`<=${c}.${d}.${p}-${A}`:r?u=`<${c}.${d}.${+p+1}-0`:u=`<=${u}`,`${n} ${u}`.trim()),sBa=(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(Ad(r[i].semver),r[i].semver!==slr.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 h8e=I((Ied,lVn)=>{var g8e=Symbol("SemVer ANY"),clr=class r{static get ANY(){return g8e}constructor(t,n){if(n=nVn(n),t instanceof r){if(t.loose===!!n.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),llr("comparator",t,n),this.options=n,this.loose=!!n.loose,this.parse(t),this.semver===g8e?this.value="":this.value=this.operator+this.semver.version,llr("comp",this)}parse(t){let n=this.options.loose?iVn[oVn.COMPARATORLOOSE]:iVn[oVn.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 sVn(i[2],this.options.loose):this.semver=g8e}toString(){return this.value}test(t){if(llr("Comparator.test",t,this.options.loose),this.semver===g8e||t===g8e)return!0;if(typeof t=="string")try{t=new sVn(t,this.options)}catch{return!1}return alr(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 aVn(t.value,n).test(this.value):t.operator===""?t.value===""?!0:new aVn(this.value,n).test(t.semver):(n=nVn(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("=")||alr(this.semver,"<",t.semver,n)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||alr(this.semver,">",t.semver,n)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};lVn.exports=clr;var nVn=Bst(),{safeRe:iVn,t:oVn}=y1e(),alr=Zar(),llr=d8e(),sVn=$2(),aVn=AO()});var m8e=I((ved,cVn)=>{var aBa=AO(),lBa=(r,t,n)=>{try{t=new aBa(t,n)}catch{return!1}return t.test(r)};cVn.exports=lBa});var dVn=I((Sed,uVn)=>{var cBa=AO(),uBa=(r,t)=>new cBa(r,t).set.map(n=>n.map(i=>i.value).join(" ").trim().split(" "));uVn.exports=uBa});var AVn=I((Oed,pVn)=>{var dBa=$2(),pBa=AO(),ABa=(r,t,n)=>{let i=null,o=null,s=null;try{s=new pBa(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===-1)&&(i=a,o=new dBa(i,n))}),i};pVn.exports=ABa});var hVn=I((wed,fVn)=>{var fBa=$2(),hBa=AO(),gBa=(r,t,n)=>{let i=null,o=null,s=null;try{s=new hBa(t,n)}catch{return null}return r.forEach(a=>{s.test(a)&&(!i||o.compare(a)===1)&&(i=a,o=new fBa(i,n))}),i};fVn.exports=gBa});var yVn=I((_ed,mVn)=>{var ulr=$2(),mBa=AO(),gVn=p8e(),yBa=(r,t)=>{r=new mBa(r,t);let n=new ulr("0.0.0");if(r.test(n)||(n=new ulr("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 ulr(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||gVn(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!n||gVn(n,s))&&(n=s)}return n&&r.test(n)?n:null};mVn.exports=yBa});var bVn=I((Ted,EVn)=>{var EBa=AO(),bBa=(r,t)=>{try{return new EBa(r,t).range||"*"}catch{return null}};EVn.exports=bBa});var Fst=I((Bed,SVn)=>{var CBa=$2(),vVn=h8e(),{ANY:IBa}=vVn,vBa=AO(),SBa=m8e(),CVn=p8e(),IVn=Dst(),OBa=Pst(),wBa=Nst(),_Ba=(r,t,n,i)=>{r=new CBa(r,i),t=new vBa(t,i);let o,s,a,l,u;switch(n){case">":o=CVn,s=OBa,a=IVn,l=">",u=">=";break;case"<":o=IVn,s=wBa,a=CVn,l="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(SBa(r,t,i))return!1;for(let c=0;c<t.set.length;++c){let d=t.set[c],p=null,A=null;if(d.forEach(f=>{f.semver===IBa&&(f=new vVn(">=0.0.0")),p=p||f,A=A||f,o(f.semver,p.semver,i)?p=f:a(f.semver,A.semver,i)&&(A=f)}),p.operator===l||p.operator===u||(!A.operator||A.operator===l)&&s(r,A.semver))return!1;if(A.operator===u&&a(r,A.semver))return!1}return!0};SVn.exports=_Ba});var wVn=I((Red,OVn)=>{var TBa=Fst(),BBa=(r,t,n)=>TBa(r,t,">",n);OVn.exports=BBa});var TVn=I((Med,_Vn)=>{var RBa=Fst(),MBa=(r,t,n)=>RBa(r,t,"<",n);_Vn.exports=MBa});var MVn=I((xed,RVn)=>{var BVn=AO(),xBa=(r,t,n)=>(r=new BVn(r,n),t=new BVn(t,n),r.intersects(t,n));RVn.exports=xBa});var DVn=I((Ded,xVn)=>{var DBa=m8e(),NBa=pO();xVn.exports=(r,t,n)=>{let i=[],o=null,s=null,a=r.sort((d,p)=>NBa(d,p,n));for(let d of a)DBa(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 u=l.join(" || "),c=typeof t.raw=="string"?t.raw:String(t);return u.length<c.length?u:t}});var FVn=I((Ned,LVn)=>{var NVn=AO(),plr=h8e(),{ANY:dlr}=plr,y8e=m8e(),Alr=pO(),PBa=(r,t,n={})=>{if(r===t)return!0;r=new NVn(r,n),t=new NVn(t,n);let i=!1;e:for(let o of r.set){for(let s of t.set){let a=QBa(o,s,n);if(i=i||a!==null,a)continue e}if(i)return!1}return!0},kBa=[new plr(">=0.0.0-0")],PVn=[new plr(">=0.0.0")],QBa=(r,t,n)=>{if(r===t)return!0;if(r.length===1&&r[0].semver===dlr){if(t.length===1&&t[0].semver===dlr)return!0;n.includePrerelease?r=kBa:r=PVn}if(t.length===1&&t[0].semver===dlr){if(n.includePrerelease)return!0;t=PVn}let i=new Set,o,s;for(let f of r)f.operator===">"||f.operator===">="?o=kVn(o,f,n):f.operator==="<"||f.operator==="<="?s=QVn(s,f,n):i.add(f.semver);if(i.size>1)return null;let a;if(o&&s){if(a=Alr(o.semver,s.semver,n),a>0)return null;if(a===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let f of i){if(o&&!y8e(f,String(o),n)||s&&!y8e(f,String(s),n))return null;for(let h of t)if(!y8e(f,String(h),n))return!1;return!0}let l,u,c,d,p=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1,A=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 f of t){if(d=d||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",o){if(A&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===A.major&&f.semver.minor===A.minor&&f.semver.patch===A.patch&&(A=!1),f.operator===">"||f.operator===">="){if(l=kVn(o,f,n),l===f&&l!==o)return!1}else if(o.operator===">="&&!y8e(o.semver,String(f),n))return!1}if(s){if(p&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch&&(p=!1),f.operator==="<"||f.operator==="<="){if(u=QVn(s,f,n),u===f&&u!==s)return!1}else if(s.operator==="<="&&!y8e(s.semver,String(f),n))return!1}if(!f.operator&&(s||o)&&a!==0)return!1}return!(o&&c&&!s&&a!==0||s&&d&&!o&&a!==0||A||p)},kVn=(r,t,n)=>{if(!r)return t;let i=Alr(r.semver,t.semver,n);return i>0?r:i<0||t.operator===">"&&r.operator===">="?t:r},QVn=(r,t,n)=>{if(!r)return t;let i=Alr(r.semver,t.semver,n);return i<0?r:i>0||t.operator==="<"&&r.operator==="<="?t:r};LVn.exports=PBa});var E8e=I((Ped,UVn)=>{var flr=y1e(),zVn=u8e(),LBa=$2(),qVn=Yar(),FBa=fte(),zBa=lGn(),qBa=uGn(),UBa=AGn(),jBa=gGn(),WBa=yGn(),GBa=bGn(),VBa=IGn(),HBa=SGn(),KBa=pO(),YBa=TGn(),JBa=RGn(),XBa=xst(),$Ba=NGn(),ZBa=kGn(),eRa=p8e(),tRa=Dst(),rRa=Xar(),nRa=$ar(),iRa=Nst(),oRa=Pst(),sRa=Zar(),aRa=GGn(),lRa=h8e(),cRa=AO(),uRa=m8e(),dRa=dVn(),pRa=AVn(),ARa=hVn(),fRa=yVn(),hRa=bVn(),gRa=Fst(),mRa=wVn(),yRa=TVn(),ERa=MVn(),bRa=DVn(),CRa=FVn();UVn.exports={parse:FBa,valid:zBa,clean:qBa,inc:UBa,diff:jBa,major:WBa,minor:GBa,patch:VBa,prerelease:HBa,compare:KBa,rcompare:YBa,compareLoose:JBa,compareBuild:XBa,sort:$Ba,rsort:ZBa,gt:eRa,lt:tRa,eq:rRa,neq:nRa,gte:iRa,lte:oRa,cmp:sRa,coerce:aRa,Comparator:lRa,Range:cRa,satisfies:uRa,toComparators:dRa,maxSatisfying:pRa,minSatisfying:ARa,minVersion:fRa,validRange:hRa,outside:gRa,gtr:mRa,ltr:yRa,intersects:ERa,simplifyRange:bRa,subset:CRa,SemVer:LBa,re:flr.re,src:flr.src,tokens:flr.t,SEMVER_SPEC_VERSION:zVn.SEMVER_SPEC_VERSION,RELEASE_TYPES:zVn.RELEASE_TYPES,compareIdentifiers:qVn.compareIdentifiers,rcompareIdentifiers:qVn.rcompareIdentifiers}});var b8e,IRa,ked,vRa,fO,v1e=be(()=>{"use strict";b8e=yt(uO()),IRa=yt(E8e()),ked=(0,b8e.Record)({version:b8e.String,hash:b8e.String}),vRa=()=>({version:"7.23.2",hash:"6653fd5f6ee32abbc640888a1ae898ede1614c89"}),fO=vRa()});var uv,jVn,C8e,zst=be(()=>{"use strict";v1e();jVn=r=>{uv=r},C8e=r=>({coalesceSoftwareVersion:fO?.version||"",service:r,env:process.env.REACT_APP_OWNER??"",reactAppCoalesceDev:process.env.REACT_APP_COALESCE_DEV??""})});var WVn,GVn,dv,hlr,VVn,HVn,KVn,I8e,glr,qst,ORa,mlr,S1e,v8e,Ust,ylr,YVn,O1e=be(()=>{"use strict";WVn=yt(C7()),GVn=yt(KXe()),dv=yt(BZ());dte();ist();zst();nl();r6();qt();hlr=null,VVn=r=>{hlr=r},HVn={emerg:"error",assert:"warn",alert:"warn",error:"warn",warn:"warn",app:"info",info:"info",debug:"debug"},KVn={emerg:"emerg",assert:"alert",alert:"alert",error:"error",app:"info",info:"info",warn:"warn",debug:"debug"},I8e=class extends WVn.default{baseContext;constructor(t){super(t),this.baseContext=C8e(uv)}log(t,n){hlr&&hlr.log({...t,level:KVn[t.level]},{...this.baseContext,...wb},HVn[t.level]),n()}},qst=r=>{let t=C8e(r);glr={host:"http-intake.logs.datadoghq.com",path:`/v1/input/pub04bd017317b60c96b62874179d82ff97?ddtags=env:${t.env},coalesceSoftwareVersion:${t.coalesceSoftwareVersion}&ddsource=nodejs&service=${r}`,ssl:!0}},ORa=!1,mlr=()=>dv.format.combine(dv.format.timestamp(),dv.format.colorize({colors:nst.COLORS}),dv.format.printf(r=>{let t=[{key:"orgID",prefix:"org"},{key:"workspaceID",prefix:"env"},{key:"userID",prefix:"user"},{key:"runID",prefix:"run"},{key:"nodeID",prefix:"node"},{key:"kubernetesJobUuid",prefix:"k8s-job"},{key:"planID",prefix:"plan"}],n=process.env.JEST_WORKER_ID?`[SHARD:${process.env.JEST_WORKER_ID}]`:"",i=t.map(({key:o,prefix:s})=>r[o]?`|(${s}:${r[o]})`:"").join("");return`|${r.timestamp}|${n}[${r.loggingArea}]${i}|)|${r.level}:${r.message}`})),S1e=r=>new dv.transports.Console({format:process.env.CONSOLE_JSON_LOGS?dv.format.combine(dv.format.timestamp(),dv.format.json()):mlr(),level:r.level,silent:ORa}),v8e=class extends GVn.Http{running=0;rejectLogCalls=!1;constructor(){let t={batch:!1,...glr,format:dv.format.combine(mlr(),dv.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:KVn[t.level],status:HVn[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 Ye("should not be reachable")};this.close&&this.close(),await Hh(t,"Close took too long",n())}},Ust=()=>new v8e,ylr=()=>new dv.transports.File({filename:process.env.JEST_WORKER_ID?`test-shard-${process.env.JEST_WORKER_ID}.log`:"test.log",dirname:"./test-logs",format:mlr(),level:rst.debug}),YVn=r=>{let t=[];return t.push(S1e(r)),glr&&t.push(Ust()),Rl().isTest&&t.push(ylr()),[new I8e,...t]}});var JVn,Elr,blr,wRa,_Ra,S8e,Clr=be(()=>{"use strict";JVn=yt(BZ());zst();dte();r8e();O1e();nl();Elr=r=>r.includes("production")?"production":r.includes("staging")?"staging":r.includes("qa")?"qa":"development",blr=()=>{if(od()){let r=process.env.RUNTIME_ENVIRONMENT||"development";return o_n("coa")?B_()?Elr(r):void 0:Elr(r)}else{let r;try{r=self.ENVIRONMENT}catch{}return typeof r=="string"?Elr(r):void 0}},wRa=()=>{let r=Rl();if(r.isTest)return{};let t=blr();return r.isNode?{firebaseEnv:t}:{windowInfo:{frontendURLHost:self.location.host},firebaseEnv:t}},_Ra=r=>{let t=C8e(uv);return{appEnv:wRa(),loggingArea:r,...t}},S8e=r=>{let t=lv[r];if(!t)throw new Error(`Logging area "${r}" is not a valid LoggingAreas key`);return t.logger||(t.logger=JVn.createLogger({levels:nst.LEVELS,defaultMeta:_Ra(r),level:t.level,transports:YVn(t)})),t.logger}});var jst,Wst,Ilr,Gst,wP,XVn=be(()=>{"use strict";No();jst=yt(BZ());r8e();O1e();nl();Clr();dte();f1();Wst=(r,t)=>{let n=r.toUpperCase(),i=[];if(n in lv||i.push(`invalid logging area '${n}'`),rst[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=S8e(n),s=o.transports.filter(l=>l instanceof jst.transports.Console),a=o.transports;s.length||(a=[...a,S1e(lv[n])]),a.filter(l=>l instanceof jst.transports.Console)[0].level=t,o.configure({...o,transports:o.transports})},Ilr=()=>{Object.keys(lv).forEach(r=>{Wst(r,"debug")})},Gst=(r,t)=>{for(let n in r){let i=n,o=S8e(i);r[i].defaultMeta={...o.defaultMeta,...r[i].defaultMeta,...t};let s=r[i].transports||o.transports,a;if(Rl().isTest&&s.length>0){let l=s[s.length-1];l instanceof jst.transports.File&&(a=l,s=o.transports.slice(0,-1),s.push(ylr()))}o.configure({...o,...r[i],transports:s,level:r[i].level||o.level}),a&&a.close&&a.close()}},wP=r=>{let t=kp(lv,(n,i)=>({}));Gst(t,r)}});function O8e(r,t){return function(){return r.apply(t,arguments)}}var vlr=be(()=>{"use strict"});function BRa(r){return r!==null&&!w8e(r)&&r.constructor!==null&&!w8e(r.constructor)&&pv(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}function RRa(r){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&eHn(r.buffer),t}function _8e(r,t,{allOwnKeys:n=!1}={}){if(r===null||typeof r>"u")return;let i,o;if(typeof r!="object"&&(r=[r]),w1e(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 rHn(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 Olr(){let{caseless:r}=nHn(this)&&this||{},t={},n=(i,o)=>{let s=r&&rHn(t,o)||o;Vst(t[s])&&Vst(i)?t[s]=Olr(t[s],i):Vst(i)?t[s]=Olr({},i):w1e(i)?t[s]=i.slice():t[s]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&_8e(arguments[i],n);return t}function lMa(r){return!!(r&&pv(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}var TRa,wlr,Hst,o6,Kst,w1e,w8e,eHn,MRa,pv,tHn,Yst,xRa,Vst,DRa,NRa,PRa,kRa,QRa,LRa,FRa,zRa,qRa,URa,jRa,WRa,yte,nHn,GRa,VRa,HRa,KRa,YRa,JRa,XRa,$Ra,ZRa,eMa,tMa,$Vn,rMa,iHn,nMa,iMa,oMa,sMa,Slr,ZVn,oHn,aMa,cMa,uMa,dMa,sHn,pMa,Bt,Eu=be(()=>{"use strict";vlr();({toString:TRa}=Object.prototype),{getPrototypeOf:wlr}=Object,Hst=(r=>t=>{let n=TRa.call(t);return r[n]||(r[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),o6=r=>(r=r.toLowerCase(),t=>Hst(t)===r),Kst=r=>t=>typeof t===r,{isArray:w1e}=Array,w8e=Kst("undefined");eHn=o6("ArrayBuffer");MRa=Kst("string"),pv=Kst("function"),tHn=Kst("number"),Yst=r=>r!==null&&typeof r=="object",xRa=r=>r===!0||r===!1,Vst=r=>{if(Hst(r)!=="object")return!1;let t=wlr(r);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},DRa=o6("Date"),NRa=o6("File"),PRa=o6("Blob"),kRa=o6("FileList"),QRa=r=>Yst(r)&&pv(r.pipe),LRa=r=>{let t;return r&&(typeof FormData=="function"&&r instanceof FormData||pv(r.append)&&((t=Hst(r))==="formdata"||t==="object"&&pv(r.toString)&&r.toString()==="[object FormData]"))},FRa=o6("URLSearchParams"),[zRa,qRa,URa,jRa]=["ReadableStream","Request","Response","Headers"].map(o6),WRa=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");yte=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,nHn=r=>!w8e(r)&&r!==yte;GRa=(r,t,n,{allOwnKeys:i}={})=>(_8e(t,(o,s)=>{n&&pv(o)?r[s]=O8e(o,n):r[s]=o},{allOwnKeys:i}),r),VRa=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),HRa=(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)},KRa=(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&&wlr(r)}while(r&&(!n||n(r,t))&&r!==Object.prototype);return t},YRa=(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},JRa=r=>{if(!r)return null;if(w1e(r))return r;let t=r.length;if(!tHn(t))return null;let n=new Array(t);for(;t-- >0;)n[t]=r[t];return n},XRa=(r=>t=>r&&t instanceof r)(typeof Uint8Array<"u"&&wlr(Uint8Array)),$Ra=(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])}},ZRa=(r,t)=>{let n,i=[];for(;(n=r.exec(t))!==null;)i.push(n);return i},eMa=o6("HTMLFormElement"),tMa=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),$Vn=(({hasOwnProperty:r})=>(t,n)=>r.call(t,n))(Object.prototype),rMa=o6("RegExp"),iHn=(r,t)=>{let n=Object.getOwnPropertyDescriptors(r),i={};_8e(n,(o,s)=>{let a;(a=t(o,s,r))!==!1&&(i[s]=a||o)}),Object.defineProperties(r,i)},nMa=r=>{iHn(r,(t,n)=>{if(pv(r)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;let i=r[n];if(pv(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+"'")})}})},iMa=(r,t)=>{let n={},i=o=>{o.forEach(s=>{n[s]=!0})};return w1e(r)?i(r):i(String(r).split(t)),n},oMa=()=>{},sMa=(r,t)=>r!=null&&Number.isFinite(r=+r)?r:t,Slr="abcdefghijklmnopqrstuvwxyz",ZVn="0123456789",oHn={DIGIT:ZVn,ALPHA:Slr,ALPHA_DIGIT:Slr+Slr.toUpperCase()+ZVn},aMa=(r=16,t=oHn.ALPHA_DIGIT)=>{let n="",{length:i}=t;for(;r--;)n+=t[Math.random()*i|0];return n};cMa=r=>{let t=new Array(10),n=(i,o)=>{if(Yst(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;let s=w1e(i)?[]:{};return _8e(i,(a,l)=>{let u=n(a,o+1);!w8e(u)&&(s[l]=u)}),t[o]=void 0,s}}return i};return n(r,0)},uMa=o6("AsyncFunction"),dMa=r=>r&&(Yst(r)||pv(r))&&pv(r.then)&&pv(r.catch),sHn=((r,t)=>r?setImmediate:t?((n,i)=>(yte.addEventListener("message",({source:o,data:s})=>{o===yte&&s===n&&i.length&&i.shift()()},!1),o=>{i.push(o),yte.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",pv(yte.postMessage)),pMa=typeof queueMicrotask<"u"?queueMicrotask.bind(yte):typeof process<"u"&&process.nextTick||sHn,Bt={isArray:w1e,isArrayBuffer:eHn,isBuffer:BRa,isFormData:LRa,isArrayBufferView:RRa,isString:MRa,isNumber:tHn,isBoolean:xRa,isObject:Yst,isPlainObject:Vst,isReadableStream:zRa,isRequest:qRa,isResponse:URa,isHeaders:jRa,isUndefined:w8e,isDate:DRa,isFile:NRa,isBlob:PRa,isRegExp:rMa,isFunction:pv,isStream:QRa,isURLSearchParams:FRa,isTypedArray:XRa,isFileList:kRa,forEach:_8e,merge:Olr,extend:GRa,trim:WRa,stripBOM:VRa,inherits:HRa,toFlatObject:KRa,kindOf:Hst,kindOfTest:o6,endsWith:YRa,toArray:JRa,forEachEntry:$Ra,matchAll:ZRa,isHTMLForm:eMa,hasOwnProperty:$Vn,hasOwnProp:$Vn,reduceDescriptors:iHn,freezeMethods:nMa,toObjectSet:iMa,toCamelCase:tMa,noop:oMa,toFiniteNumber:sMa,findKey:rHn,global:yte,isContextDefined:nHn,ALPHABET:oHn,generateString:aMa,isSpecCompliantForm:lMa,toJSONObject:cMa,isAsyncFn:uMa,isThenable:dMa,setImmediate:sHn,asap:pMa}});function _1e(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 aHn,lHn,$n,Av=be(()=>{"use strict";Eu();Bt.inherits(_1e,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:Bt.toJSONObject(this.config),code:this.code,status:this.status}}});aHn=_1e.prototype,lHn={};["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=>{lHn[r]={value:r}});Object.defineProperties(_1e,lHn);Object.defineProperty(aHn,"isAxiosError",{value:!0});_1e.from=(r,t,n,i,o,s)=>{let a=Object.create(aHn);return Bt.toFlatObject(r,a,function(u){return u!==Error.prototype},l=>l!=="isAxiosError"),_1e.call(a,r.message,t,n,i,o),a.cause=r,a.name=r.name,s&&Object.assign(a,s),a};$n=_1e});var cHn,Jst,_lr=be(()=>{cHn=yt(bTe(),1),Jst=cHn.default});function Tlr(r){return Bt.isPlainObject(r)||Bt.isArray(r)}function dHn(r){return Bt.endsWith(r,"[]")?r.slice(0,-2):r}function uHn(r,t,n){return r?r.concat(t).map(function(o,s){return o=dHn(o),!n&&s?"["+o+"]":o}).join(n?".":""):t}function AMa(r){return Bt.isArray(r)&&!r.some(Tlr)}function hMa(r,t,n){if(!Bt.isObject(r))throw new TypeError("target must be an object");t=t||new(Jst||FormData),n=Bt.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,C){return!Bt.isUndefined(C[y])});let i=n.metaTokens,o=n.visitor||d,s=n.dots,a=n.indexes,u=(n.Blob||typeof Blob<"u"&&Blob)&&Bt.isSpecCompliantForm(t);if(!Bt.isFunction(o))throw new TypeError("visitor must be a function");function c(h){if(h===null)return"";if(Bt.isDate(h))return h.toISOString();if(!u&&Bt.isBlob(h))throw new $n("Blob is not supported. Use a Buffer instead.");return Bt.isArrayBuffer(h)||Bt.isTypedArray(h)?u&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function d(h,y,C){let O=h;if(h&&!C&&typeof h=="object"){if(Bt.endsWith(y,"{}"))y=i?y:y.slice(0,-2),h=JSON.stringify(h);else if(Bt.isArray(h)&&AMa(h)||(Bt.isFileList(h)||Bt.endsWith(y,"[]"))&&(O=Bt.toArray(h)))return y=dHn(y),O.forEach(function(T,R){!(Bt.isUndefined(T)||T===null)&&t.append(a===!0?uHn([y],R,s):a===null?y:y+"[]",c(T))}),!1}return Tlr(h)?!0:(t.append(uHn(C,y,s),c(h)),!1)}let p=[],A=Object.assign(fMa,{defaultVisitor:d,convertValue:c,isVisitable:Tlr});function f(h,y){if(!Bt.isUndefined(h)){if(p.indexOf(h)!==-1)throw Error("Circular reference detected in "+y.join("."));p.push(h),Bt.forEach(h,function(O,w){(!(Bt.isUndefined(O)||O===null)&&o.call(t,O,Bt.isString(w)?w.trim():w,y,A))===!0&&f(O,y?y.concat(w):[w])}),p.pop()}}if(!Bt.isObject(r))throw new TypeError("data must be an object");return f(r),t}var fMa,iU,T8e=be(()=>{"use strict";Eu();Av();_lr();fMa=Bt.toFlatObject(Bt,{},null,function(t){return/^is[A-Z]/.test(t)});iU=hMa});function pHn(r){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function AHn(r,t){this._pairs=[],r&&iU(r,this,t)}var fHn,hHn,gHn=be(()=>{"use strict";T8e();fHn=AHn.prototype;fHn.append=function(t,n){this._pairs.push([t,n])};fHn.toString=function(t){let n=t?function(i){return t.call(this,i,pHn)}:pHn;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};hHn=AHn});function gMa(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ete(r,t,n){if(!t)return r;let i=n&&n.encode||gMa,o=n&&n.serialize,s;if(o?s=o(t,n):s=Bt.isURLSearchParams(t)?t.toString():new hHn(t,n).toString(i),s){let a=r.indexOf("#");a!==-1&&(r=r.slice(0,a)),r+=(r.indexOf("?")===-1?"?":"&")+s}return r}var Xst=be(()=>{"use strict";Eu();gHn()});var Blr,Rlr,mHn=be(()=>{"use strict";Eu();Blr=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){Bt.forEach(this.handlers,function(i){i!==null&&t(i)})}},Rlr=Blr});var T1e,$st=be(()=>{"use strict";T1e={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var yHn,EHn,bHn=be(()=>{"use strict";yHn=yt(require("url"),1),EHn=yHn.default.URLSearchParams});var CHn,IHn=be(()=>{bHn();_lr();CHn={isNode:!0,classes:{URLSearchParams:EHn,FormData:Jst,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]}});var Dlr={};o3(Dlr,{hasBrowserEnv:()=>xlr,hasStandardBrowserEnv:()=>mMa,hasStandardBrowserWebWorkerEnv:()=>yMa,navigator:()=>Mlr,origin:()=>EMa});var xlr,Mlr,mMa,yMa,EMa,vHn=be(()=>{xlr=typeof window<"u"&&typeof document<"u",Mlr=typeof navigator=="object"&&navigator||void 0,mMa=xlr&&(!Mlr||["ReactNative","NativeScript","NS"].indexOf(Mlr.product)<0),yMa=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",EMa=xlr&&window.location.href||"http://localhost"});var Gu,RM=be(()=>{IHn();vHn();Gu={...Dlr,...CHn}});function Nlr(r,t){return iU(r,new Gu.classes.URLSearchParams,Object.assign({visitor:function(n,i,o,s){return Gu.isNode&&Bt.isBuffer(n)?(this.append(i,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}var SHn=be(()=>{"use strict";Eu();T8e();RM()});function bMa(r){return Bt.matchAll(/\w+|\[(\w*)]/g,r).map(t=>t[0]==="[]"?"":t[1]||t[0])}function CMa(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 IMa(r){function t(n,i,o,s){let a=n[s++];if(a==="__proto__")return!0;let l=Number.isFinite(+a),u=s>=n.length;return a=!a&&Bt.isArray(o)?o.length:a,u?(Bt.hasOwnProp(o,a)?o[a]=[o[a],i]:o[a]=i,!l):((!o[a]||!Bt.isObject(o[a]))&&(o[a]=[]),t(n,i,o[a],s)&&Bt.isArray(o[a])&&(o[a]=CMa(o[a])),!l)}if(Bt.isFormData(r)&&Bt.isFunction(r.entries)){let n={};return Bt.forEachEntry(r,(i,o)=>{t(bMa(i),o,n,0)}),n}return null}var Zst,Plr=be(()=>{"use strict";Eu();Zst=IMa});function vMa(r,t,n){if(Bt.isString(r))try{return(t||JSON.parse)(r),Bt.trim(r)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(r)}var klr,B1e,eat=be(()=>{"use strict";Eu();Av();$st();T8e();SHn();RM();Plr();klr={transitional:T1e,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){let i=n.getContentType()||"",o=i.indexOf("application/json")>-1,s=Bt.isObject(t);if(s&&Bt.isHTMLForm(t)&&(t=new FormData(t)),Bt.isFormData(t))return o?JSON.stringify(Zst(t)):t;if(Bt.isArrayBuffer(t)||Bt.isBuffer(t)||Bt.isStream(t)||Bt.isFile(t)||Bt.isBlob(t)||Bt.isReadableStream(t))return t;if(Bt.isArrayBufferView(t))return t.buffer;if(Bt.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 Nlr(t,this.formSerializer).toString();if((l=Bt.isFileList(t))||i.indexOf("multipart/form-data")>-1){let u=this.env&&this.env.FormData;return iU(l?{"files[]":t}:t,u&&new u,this.formSerializer)}}return s||o?(n.setContentType("application/json",!1),vMa(t)):t}],transformResponse:[function(t){let n=this.transitional||klr.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(Bt.isResponse(t)||Bt.isReadableStream(t))return t;if(t&&Bt.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"?$n.from(l,$n.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:Gu.classes.FormData,Blob:Gu.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Bt.forEach(["delete","get","head","post","put","patch"],r=>{klr.headers[r]={}});B1e=klr});var SMa,OHn,wHn=be(()=>{"use strict";Eu();SMa=Bt.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"]),OHn=r=>{let t={},n,i,o;return r&&r.split(`
|
|
128
128
|
`).forEach(function(a){o=a.indexOf(":"),n=a.substring(0,o).trim().toLowerCase(),i=a.substring(o+1).trim(),!(!n||t[n]&&SMa[n])&&(n==="set-cookie"?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)}),t}});function B8e(r){return r&&String(r).trim().toLowerCase()}function tat(r){return r===!1||r==null?r:Bt.isArray(r)?r.map(tat):String(r)}function OMa(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 Qlr(r,t,n,i,o){if(Bt.isFunction(i))return i.call(this,t,n);if(o&&(t=n),!!Bt.isString(t)){if(Bt.isString(i))return t.indexOf(i)!==-1;if(Bt.isRegExp(i))return i.test(t)}}function _Ma(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,i)=>n.toUpperCase()+i)}function TMa(r,t){let n=Bt.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 _Hn,wMa,R1e,zp,MM=be(()=>{"use strict";Eu();wHn();_Hn=Symbol("internals");wMa=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());R1e=class{constructor(t){t&&this.set(t)}set(t,n,i){let o=this;function s(l,u,c){let d=B8e(u);if(!d)throw new Error("header name must be a non-empty string");let p=Bt.findKey(o,d);(!p||o[p]===void 0||c===!0||c===void 0&&o[p]!==!1)&&(o[p||u]=tat(l))}let a=(l,u)=>Bt.forEach(l,(c,d)=>s(c,d,u));if(Bt.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(Bt.isString(t)&&(t=t.trim())&&!wMa(t))a(OHn(t),n);else if(Bt.isHeaders(t))for(let[l,u]of t.entries())s(u,l,i);else t!=null&&s(n,t,i);return this}get(t,n){if(t=B8e(t),t){let i=Bt.findKey(this,t);if(i){let o=this[i];if(!n)return o;if(n===!0)return OMa(o);if(Bt.isFunction(n))return n.call(this,o,i);if(Bt.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=B8e(t),t){let i=Bt.findKey(this,t);return!!(i&&this[i]!==void 0&&(!n||Qlr(this,this[i],i,n)))}return!1}delete(t,n){let i=this,o=!1;function s(a){if(a=B8e(a),a){let l=Bt.findKey(i,a);l&&(!n||Qlr(i,i[l],l,n))&&(delete i[l],o=!0)}}return Bt.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||Qlr(this,this[s],s,t,!0))&&(delete this[s],o=!0)}return o}normalize(t){let n=this,i={};return Bt.forEach(this,(o,s)=>{let a=Bt.findKey(i,s);if(a){n[a]=tat(o),delete n[s];return}let l=t?_Ma(s):String(s).trim();l!==s&&delete n[s],n[l]=tat(o),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let n=Object.create(null);return Bt.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=t&&Bt.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(`
|
|
129
129
|
`)}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[_Hn]=this[_Hn]={accessors:{}}).accessors,o=this.prototype;function s(a){let l=B8e(a);i[l]||(TMa(o,a),i[l]=!0)}return Bt.isArray(t)?t.forEach(s):s(t),this}};R1e.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Bt.reduceDescriptors(R1e.prototype,({value:r},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>r,set(i){this[n]=i}}});Bt.freezeMethods(R1e);zp=R1e});function R8e(r,t){let n=this||B1e,i=t||n,o=zp.from(i.headers),s=i.data;return Bt.forEach(r,function(l){s=l.call(n,s,o.normalize(),t?t.status:void 0)}),o.normalize(),s}var THn=be(()=>{"use strict";Eu();eat();MM()});function M8e(r){return!!(r&&r.__CANCEL__)}var Llr=be(()=>{"use strict"});function BHn(r,t,n){$n.call(this,r??"canceled",$n.ERR_CANCELED,t,n),this.name="CanceledError"}var fv,bte=be(()=>{"use strict";Av();Eu();Bt.inherits(BHn,$n,{__CANCEL__:!0});fv=BHn});function xM(r,t,n){let i=n.config.validateStatus;!n.status||!i||i(n.status)?r(n):t(new $n("Request failed with status code "+n.status,[$n.ERR_BAD_REQUEST,$n.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}var rat=be(()=>{"use strict";Av()});function Flr(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}var RHn=be(()=>{"use strict"});function zlr(r,t){return t?r.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):r}var MHn=be(()=>{"use strict"});function Cte(r,t){return r&&!Flr(t)?zlr(r,t):t}var nat=be(()=>{"use strict";RHn();MHn()});var Ite,iat=be(()=>{Ite="1.7.7"});function x8e(r){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return t&&t[1]||""}var qlr=be(()=>{"use strict"});function Ulr(r,t,n){let i=n&&n.Blob||Gu.classes.Blob,o=x8e(r);if(t===void 0&&i&&(t=!0),o==="data"){r=o.length?r.slice(o.length+1):r;let s=BMa.exec(r);if(!s)throw new $n("Invalid URL",$n.ERR_INVALID_URL);let a=s[1],l=s[2],u=s[3],c=Buffer.from(decodeURIComponent(u),l?"base64":"utf8");if(t){if(!i)throw new $n("Blob is not supported",$n.ERR_NOT_SUPPORT);return new i([c],{type:a})}return c}throw new $n("Unsupported protocol "+o,$n.ERR_NOT_SUPPORT)}var BMa,xHn=be(()=>{"use strict";Av();qlr();RM();BMa=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/});var DHn,jlr,Wlr,Glr,NHn=be(()=>{"use strict";DHn=yt(require("stream"),1);Eu();jlr=Symbol("internals"),Wlr=class extends DHn.default.Transform{constructor(t){t=Bt.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,o)=>!Bt.isUndefined(o[i])),super({readableHighWaterMark:t.chunkSize});let n=this[jlr]={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[jlr];return n.onReadCallback&&n.onReadCallback(),super._read(t)}_transform(t,n,i){let o=this[jlr],s=o.maxRate,a=this.readableHighWaterMark,l=o.timeWindow,u=1e3/l,c=s/u,d=o.minChunkSize!==!1?Math.max(o.minChunkSize,c*.01):0,p=(f,h)=>{let y=Buffer.byteLength(f);o.bytesSeen+=y,o.bytes+=y,o.isCaptured&&this.emit("progress",o.bytesSeen),this.push(f)?process.nextTick(h):o.onReadCallback=()=>{o.onReadCallback=null,process.nextTick(h)}},A=(f,h)=>{let y=Buffer.byteLength(f),C=null,O=a,w,T=0;if(s){let R=Date.now();(!o.ts||(T=R-o.ts)>=l)&&(o.ts=R,w=c-o.bytes,o.bytes=w<0?-w:0,T=0),w=c-o.bytes}if(s){if(w<=0)return setTimeout(()=>{h(null,f)},l-T);w<O&&(O=w)}O&&y>O&&y-O>d&&(C=f.subarray(O),f=f.subarray(0,O)),p(f,C?()=>{process.nextTick(h,null,C)}:h)};A(t,function f(h,y){if(h)return i(h);y?A(y,f):i(null)})}},Glr=Wlr});var PHn,RMa,oat,Vlr=be(()=>{({asyncIterator:PHn}=Symbol),RMa=async function*(r){r.stream?yield*r.stream():r.arrayBuffer?yield await r.arrayBuffer():r[PHn]?yield*r[PHn]():yield r},oat=RMa});var kHn,QHn,MMa,D8e,oU,xMa,DMa,Hlr,NMa,LHn,FHn=be(()=>{kHn=require("util"),QHn=require("stream");Eu();Vlr();MMa=Bt.ALPHABET.ALPHA_DIGIT+"-_",D8e=new kHn.TextEncoder,oU=`\r
|
|
130
130
|
`,xMa=D8e.encode(oU),DMa=2,Hlr=class{constructor(t,n){let{escapeName:i}=this.constructor,o=Bt.isString(n),s=`Content-Disposition: form-data; name="${i(t)}"${!o&&n.name?`; filename="${i(n.name)}"`:""}${oU}`;o?n=D8e.encode(String(n).replace(/\r?\n|\r\n?/g,oU)):s+=`Content-Type: ${n.type||"application/octet-stream"}${oU}`,this.headers=D8e.encode(s+oU),this.contentLength=o?n.byteLength:n.size,this.size=this.headers.byteLength+this.contentLength+DMa,this.name=t,this.value=n}async*encode(){yield this.headers;let{value:t}=this;Bt.isTypedArray(t)?yield t:yield*oat(t),yield xMa}static escapeName(t){return String(t).replace(/[\r\n"]/g,n=>({"\r":"%0D","\n":"%0A",'"':"%22"})[n])}},NMa=(r,t,n)=>{let{tag:i="form-data-boundary",size:o=25,boundary:s=i+"-"+Bt.generateString(o,MMa)}=n||{};if(!Bt.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=D8e.encode("--"+s+oU),l=D8e.encode("--"+s+"--"+oU+oU),u=l.byteLength,c=Array.from(r.entries()).map(([p,A])=>{let f=new Hlr(p,A);return u+=f.size,f});u+=a.byteLength*c.length,u=Bt.toFiniteNumber(u);let d={"Content-Type":`multipart/form-data; boundary=${s}`};return Number.isFinite(u)&&(d["Content-Length"]=u),t&&t(d),QHn.Readable.from(async function*(){for(let p of c)yield a,yield*p.encode();yield l}())},LHn=NMa});var zHn,Klr,qHn,UHn=be(()=>{"use strict";zHn=yt(require("stream"),1),Klr=class extends zHn.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)}},qHn=Klr});var PMa,jHn,WHn=be(()=>{Eu();PMa=(r,t)=>Bt.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,jHn=PMa});function kMa(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(u){let c=Date.now(),d=i[s];a||(a=c),n[o]=u,i[o]=c;let p=s,A=0;for(;p!==o;)A+=n[p++],p=p%r;if(o=(o+1)%r,o===s&&(s=(s+1)%r),c-a<t)return;let f=d&&c-d;return f?Math.round(A*1e3/f):void 0}}var GHn,VHn=be(()=>{"use strict";GHn=kMa});function QMa(r,t){let n=0,i=1e3/t,o,s,a=(c,d=Date.now())=>{n=d,o=null,s&&(clearTimeout(s),s=null),r.apply(null,c)};return[(...c)=>{let d=Date.now(),p=d-n;p>=i?a(c,d):(o=c,s||(s=setTimeout(()=>{s=null,a(o)},i-p)))},()=>o&&a(o)]}var HHn,KHn=be(()=>{HHn=QMa});var _P,M1e,x1e,sat=be(()=>{VHn();KHn();Eu();_P=(r,t,n=3)=>{let i=0,o=GHn(50,250);return HHn(s=>{let a=s.loaded,l=s.lengthComputable?s.total:void 0,u=a-i,c=o(u),d=a<=l;i=a;let p={loaded:a,total:l,progress:l?a/l:void 0,bytes:u,rate:c||void 0,estimated:c&&l&&d?(l-a)/c:void 0,event:s,lengthComputable:l!=null,[t?"download":"upload"]:!0};r(p)},n)},M1e=(r,t)=>{let n=r!=null;return[i=>t[0]({lengthComputable:n,total:r,loaded:i}),t[1]]},x1e=r=>(...t)=>Bt.asap(()=>r(...t))});function UMa(r,t){r.beforeRedirects.proxy&&r.beforeRedirects.proxy(r),r.beforeRedirects.config&&r.beforeRedirects.config(r,t)}function sKn(r,t,n){let i=t;if(!i&&i!==!1){let o=(0,eKn.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){sKn(s,t,s.href)}}var eKn,tKn,rKn,nKn,iKn,TP,vte,oKn,YHn,LMa,JHn,FMa,zMa,qMa,XHn,$Hn,jMa,WMa,GMa,ZHn,aKn,lKn=be(()=>{"use strict";Eu();rat();nat();Xst();eKn=yt(CTe(),1),tKn=yt(require("http"),1),rKn=yt(require("https"),1),nKn=yt(require("util"),1),iKn=yt(eHt(),1),TP=yt(require("zlib"),1);iat();$st();Av();bte();RM();xHn();vte=yt(require("stream"),1);MM();NHn();oKn=require("events");FHn();Vlr();UHn();WHn();sat();YHn={flush:TP.default.constants.Z_SYNC_FLUSH,finishFlush:TP.default.constants.Z_SYNC_FLUSH},LMa={flush:TP.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:TP.default.constants.BROTLI_OPERATION_FLUSH},JHn=Bt.isFunction(TP.default.createBrotliDecompress),{http:FMa,https:zMa}=iKn.default,qMa=/https:?/,XHn=Gu.protocols.map(r=>r+":"),$Hn=(r,[t,n])=>(r.on("end",n).on("error",n),t);jMa=typeof process<"u"&&Bt.kindOf(process)==="process",WMa=r=>new Promise((t,n)=>{let i,o,s=(u,c)=>{o||(o=!0,i&&i(u,c))},a=u=>{s(u),t(u)},l=u=>{s(u,!0),n(u)};r(a,l,u=>i=u).catch(l)}),GMa=({address:r,family:t})=>{if(!Bt.isString(r))throw TypeError("address must be a string");return{address:r,family:t||(r.indexOf(".")<0?6:4)}},ZHn=(r,t)=>GMa(Bt.isObject(r)?r:{address:r,family:t}),aKn=jMa&&function(t){return WMa(async function(i,o,s){let{data:a,lookup:l,family:u}=t,{responseType:c,responseEncoding:d}=t,p=t.method.toUpperCase(),A,f=!1,h;if(l){let Z=jHn(l,ee=>Bt.isArray(ee)?ee:[ee]);l=(ee,K,ie)=>{Z(ee,K,(le,te,ce)=>{if(le)return ie(le);let Te=Bt.isArray(te)?te.map(De=>ZHn(De)):[ZHn(te,ce)];K.all?ie(le,Te):ie(le,Te[0].address,Te[0].family)})}}let y=new oKn.EventEmitter,C=()=>{t.cancelToken&&t.cancelToken.unsubscribe(O),t.signal&&t.signal.removeEventListener("abort",O),y.removeAllListeners()};s((Z,ee)=>{A=!0,ee&&(f=!0,C())});function O(Z){y.emit("abort",!Z||Z.type?new fv(null,t,h):Z)}y.once("abort",o),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(O),t.signal&&(t.signal.aborted?O():t.signal.addEventListener("abort",O)));let w=Cte(t.baseURL,t.url),T=new URL(w,Gu.hasBrowserEnv?Gu.origin:void 0),R=T.protocol||XHn[0];if(R==="data:"){let Z;if(p!=="GET")return xM(i,o,{status:405,statusText:"method not allowed",headers:{},config:t});try{Z=Ulr(t.url,c==="blob",{Blob:t.env&&t.env.Blob})}catch(ee){throw $n.from(ee,$n.ERR_BAD_REQUEST,t)}return c==="text"?(Z=Z.toString(d),(!d||d==="utf8")&&(Z=Bt.stripBOM(Z))):c==="stream"&&(Z=vte.default.Readable.from(Z)),xM(i,o,{data:Z,status:200,statusText:"OK",headers:new zp,config:t})}if(XHn.indexOf(R)===-1)return o(new $n("Unsupported protocol "+R,$n.ERR_BAD_REQUEST,t));let P=zp.from(t.headers).normalize();P.set("User-Agent","axios/"+Ite,!1);let{onUploadProgress:z,onDownloadProgress:q}=t,H=t.maxRate,V,U;if(Bt.isSpecCompliantForm(a)){let Z=P.getContentType(/boundary=([-_\w\d]{10,70})/i);a=LHn(a,ee=>{P.set(ee)},{tag:`axios-${Ite}-boundary`,boundary:Z&&Z[1]||void 0})}else if(Bt.isFormData(a)&&Bt.isFunction(a.getHeaders)){if(P.set(a.getHeaders()),!P.hasContentLength())try{let Z=await nKn.default.promisify(a.getLength).call(a);Number.isFinite(Z)&&Z>=0&&P.setContentLength(Z)}catch{}}else if(Bt.isBlob(a))a.size&&P.setContentType(a.type||"application/octet-stream"),P.setContentLength(a.size||0),a=vte.default.Readable.from(oat(a));else if(a&&!Bt.isStream(a)){if(!Buffer.isBuffer(a))if(Bt.isArrayBuffer(a))a=Buffer.from(new Uint8Array(a));else if(Bt.isString(a))a=Buffer.from(a,"utf-8");else return o(new $n("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",$n.ERR_BAD_REQUEST,t));if(P.setContentLength(a.length,!1),t.maxBodyLength>-1&&a.length>t.maxBodyLength)return o(new $n("Request body larger than maxBodyLength limit",$n.ERR_BAD_REQUEST,t))}let Q=Bt.toFiniteNumber(P.getContentLength());Bt.isArray(H)?(V=H[0],U=H[1]):V=U=H,a&&(z||V)&&(Bt.isStream(a)||(a=vte.default.Readable.from(a,{objectMode:!1})),a=vte.default.pipeline([a,new Glr({maxRate:Bt.toFiniteNumber(V)})],Bt.noop),z&&a.on("progress",$Hn(a,M1e(Q,_P(x1e(z),!1,3)))));let Y;if(t.auth){let Z=t.auth.username||"",ee=t.auth.password||"";Y=Z+":"+ee}if(!Y&&T.username){let Z=T.username,ee=T.password;Y=Z+":"+ee}Y&&P.delete("authorization");let j;try{j=Ete(T.pathname+T.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Z){let ee=new Error(Z.message);return ee.config=t,ee.url=t.url,ee.exists=!0,o(ee)}P.set("Accept-Encoding","gzip, compress, deflate"+(JHn?", br":""),!1);let k={path:j,method:p,headers:P.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:Y,protocol:R,family:u,beforeRedirect:UMa,beforeRedirects:{}};!Bt.isUndefined(l)&&(k.lookup=l),t.socketPath?k.socketPath=t.socketPath:(k.hostname=T.hostname.startsWith("[")?T.hostname.slice(1,-1):T.hostname,k.port=T.port,sKn(k,t.proxy,R+"//"+T.hostname+(T.port?":"+T.port:"")+k.path));let X,$=qMa.test(k.protocol);if(k.agent=$?t.httpsAgent:t.httpAgent,t.transport?X=t.transport:t.maxRedirects===0?X=$?rKn.default:tKn.default:(t.maxRedirects&&(k.maxRedirects=t.maxRedirects),t.beforeRedirect&&(k.beforeRedirects.config=t.beforeRedirect),X=$?zMa:FMa),t.maxBodyLength>-1?k.maxBodyLength=t.maxBodyLength:k.maxBodyLength=1/0,t.insecureHTTPParser&&(k.insecureHTTPParser=t.insecureHTTPParser),h=X.request(k,function(ee){if(h.destroyed)return;let K=[ee],ie=+ee.headers["content-length"];if(q||U){let De=new Glr({maxRate:Bt.toFiniteNumber(U)});q&&De.on("progress",$Hn(De,M1e(ie,_P(x1e(q),!0,3)))),K.push(De)}let le=ee,te=ee.req||h;if(t.decompress!==!1&&ee.headers["content-encoding"])switch((p==="HEAD"||ee.statusCode===204)&&delete ee.headers["content-encoding"],(ee.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":K.push(TP.default.createUnzip(YHn)),delete ee.headers["content-encoding"];break;case"deflate":K.push(new qHn),K.push(TP.default.createUnzip(YHn)),delete ee.headers["content-encoding"];break;case"br":JHn&&(K.push(TP.default.createBrotliDecompress(LMa)),delete ee.headers["content-encoding"])}le=K.length>1?vte.default.pipeline(K,Bt.noop):K[0];let ce=vte.default.finished(le,()=>{ce(),C()}),Te={status:ee.statusCode,statusText:ee.statusMessage,headers:new zp(ee.headers),config:t,request:te};if(c==="stream")Te.data=le,xM(i,o,Te);else{let De=[],fe=0;le.on("data",function(ke){De.push(ke),fe+=ke.length,t.maxContentLength>-1&&fe>t.maxContentLength&&(f=!0,le.destroy(),o(new $n("maxContentLength size of "+t.maxContentLength+" exceeded",$n.ERR_BAD_RESPONSE,t,te)))}),le.on("aborted",function(){if(f)return;let ke=new $n("maxContentLength size of "+t.maxContentLength+" exceeded",$n.ERR_BAD_RESPONSE,t,te);le.destroy(ke),o(ke)}),le.on("error",function(ke){h.destroyed||o($n.from(ke,null,t,te))}),le.on("end",function(){try{let ke=De.length===1?De[0]:Buffer.concat(De);c!=="arraybuffer"&&(ke=ke.toString(d),(!d||d==="utf8")&&(ke=Bt.stripBOM(ke))),Te.data=ke}catch(ke){return o($n.from(ke,null,t,Te.request,Te))}xM(i,o,Te)})}y.once("abort",De=>{le.destroyed||(le.emit("error",De),le.destroy())})}),y.once("abort",Z=>{o(Z),h.destroy(Z)}),h.on("error",function(ee){o($n.from(ee,null,t,h))}),h.on("socket",function(ee){ee.setKeepAlive(!0,1e3*60)}),t.timeout){let Z=parseInt(t.timeout,10);if(Number.isNaN(Z)){o(new $n("error trying to parse `config.timeout` to int",$n.ERR_BAD_OPTION_VALUE,t,h));return}h.setTimeout(Z,function(){if(A)return;let K=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",ie=t.transitional||T1e;t.timeoutErrorMessage&&(K=t.timeoutErrorMessage),o(new $n(K,ie.clarifyTimeoutError?$n.ETIMEDOUT:$n.ECONNABORTED,t,h)),O()})}if(Bt.isStream(a)){let Z=!1,ee=!1;a.on("end",()=>{Z=!0}),a.once("error",K=>{ee=!0,h.destroy(K)}),a.on("close",()=>{!Z&&!ee&&O(new fv("Request stream has been aborted",t,h))}),a.pipe(h)}else h.end(a)})}});var cKn,uKn=be(()=>{"use strict";Eu();RM();cKn=Gu.hasStandardBrowserEnv?function(){let t=Gu.navigator&&/(msie|trident)/i.test(Gu.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=Bt.isString(a)?o(a):a;return l.protocol===i.protocol&&l.host===i.host}}():function(){return function(){return!0}}()});var dKn,pKn=be(()=>{Eu();RM();dKn=Gu.hasStandardBrowserEnv?{write(r,t,n,i,o,s){let a=[r+"="+encodeURIComponent(t)];Bt.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),Bt.isString(i)&&a.push("path="+i),Bt.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 s6(r,t){t=t||{};let n={};function i(c,d,p){return Bt.isPlainObject(c)&&Bt.isPlainObject(d)?Bt.merge.call({caseless:p},c,d):Bt.isPlainObject(d)?Bt.merge({},d):Bt.isArray(d)?d.slice():d}function o(c,d,p){if(Bt.isUndefined(d)){if(!Bt.isUndefined(c))return i(void 0,c,p)}else return i(c,d,p)}function s(c,d){if(!Bt.isUndefined(d))return i(void 0,d)}function a(c,d){if(Bt.isUndefined(d)){if(!Bt.isUndefined(c))return i(void 0,c)}else return i(void 0,d)}function l(c,d,p){if(p in t)return i(c,d);if(p in r)return i(void 0,c)}let u={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:(c,d)=>o(AKn(c),AKn(d),!0)};return Bt.forEach(Object.keys(Object.assign({},r,t)),function(d){let p=u[d]||o,A=p(r[d],t[d],d);Bt.isUndefined(A)&&p!==l||(n[d]=A)}),n}var AKn,aat=be(()=>{"use strict";Eu();MM();AKn=r=>r instanceof zp?{...r}:r});var lat,Ylr=be(()=>{RM();Eu();uKn();pKn();nat();aat();MM();Xst();lat=r=>{let t=s6({},r),{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:l}=t;t.headers=a=zp.from(a),t.url=Ete(Cte(t.baseURL,t.url),r.params,r.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let u;if(Bt.isFormData(n)){if(Gu.hasStandardBrowserEnv||Gu.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){let[c,...d]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...d].join("; "))}}if(Gu.hasStandardBrowserEnv&&(i&&Bt.isFunction(i)&&(i=i(t)),i||i!==!1&&cKn(t.url))){let c=o&&s&&dKn.read(s);c&&a.set(o,c)}return t}});var VMa,fKn,hKn=be(()=>{Eu();rat();$st();Av();bte();qlr();RM();MM();sat();Ylr();VMa=typeof XMLHttpRequest<"u",fKn=VMa&&function(r){return new Promise(function(n,i){let o=lat(r),s=o.data,a=zp.from(o.headers).normalize(),{responseType:l,onUploadProgress:u,onDownloadProgress:c}=o,d,p,A,f,h;function y(){f&&f(),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 O(){if(!C)return;let T=zp.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),P={data:!l||l==="text"||l==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:T,config:r,request:C};xM(function(q){n(q),y()},function(q){i(q),y()},P),C=null}"onloadend"in C?C.onloadend=O:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(O)},C.onabort=function(){C&&(i(new $n("Request aborted",$n.ECONNABORTED,r,C)),C=null)},C.onerror=function(){i(new $n("Network Error",$n.ERR_NETWORK,r,C)),C=null},C.ontimeout=function(){let R=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",P=o.transitional||T1e;o.timeoutErrorMessage&&(R=o.timeoutErrorMessage),i(new $n(R,P.clarifyTimeoutError?$n.ETIMEDOUT:$n.ECONNABORTED,r,C)),C=null},s===void 0&&a.setContentType(null),"setRequestHeader"in C&&Bt.forEach(a.toJSON(),function(R,P){C.setRequestHeader(P,R)}),Bt.isUndefined(o.withCredentials)||(C.withCredentials=!!o.withCredentials),l&&l!=="json"&&(C.responseType=o.responseType),c&&([A,h]=_P(c,!0),C.addEventListener("progress",A)),u&&C.upload&&([p,f]=_P(u),C.upload.addEventListener("progress",p),C.upload.addEventListener("loadend",f)),(o.cancelToken||o.signal)&&(d=T=>{C&&(i(!T||T.type?new fv(null,r,C):T),C.abort(),C=null)},o.cancelToken&&o.cancelToken.subscribe(d),o.signal&&(o.signal.aborted?d():o.signal.addEventListener("abort",d)));let w=x8e(o.url);if(w&&Gu.protocols.indexOf(w)===-1){i(new $n("Unsupported protocol "+w+":",$n.ERR_BAD_REQUEST,r));return}C.send(s||null)})}});var HMa,gKn,mKn=be(()=>{bte();Av();Eu();HMa=(r,t)=>{let{length:n}=r=r?r.filter(Boolean):[];if(t||n){let i=new AbortController,o,s=function(c){if(!o){o=!0,l();let d=c instanceof Error?c:this.reason;i.abort(d instanceof $n?d:new fv(d instanceof Error?d.message:d))}},a=t&&setTimeout(()=>{a=null,s(new $n(`timeout ${t} of ms exceeded`,$n.ETIMEDOUT))},t),l=()=>{r&&(a&&clearTimeout(a),a=null,r.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),r=null)};r.forEach(c=>c.addEventListener("abort",s));let{signal:u}=i;return u.unsubscribe=()=>Bt.asap(l),u}},gKn=HMa});var KMa,YMa,JMa,Jlr,yKn=be(()=>{KMa=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},YMa=async function*(r,t){for await(let n of JMa(r))yield*KMa(n,t)},JMa=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()}},Jlr=(r,t,n,i)=>{let o=YMa(r,t),s=0,a,l=u=>{a||(a=!0,i&&i(u))};return new ReadableStream({async pull(u){try{let{done:c,value:d}=await o.next();if(c){l(),u.close();return}let p=d.byteLength;if(n){let A=s+=p;n(A)}u.enqueue(new Uint8Array(d))}catch(c){throw l(c),c}},cancel(u){return l(u),o.return()}},{highWaterMark:2})}});var uat,bKn,XMa,CKn,$Ma,EKn,Xlr,cat,ZMa,e8a,IKn,vKn=be(()=>{RM();Eu();Av();mKn();yKn();MM();sat();Ylr();rat();uat=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",bKn=uat&&typeof ReadableStream=="function",XMa=uat&&(typeof TextEncoder=="function"?(r=>t=>r.encode(t))(new TextEncoder):async r=>new Uint8Array(await new Response(r).arrayBuffer())),CKn=(r,...t)=>{try{return!!r(...t)}catch{return!1}},$Ma=bKn&&CKn(()=>{let r=!1,t=new Request(Gu.origin,{body:new ReadableStream,method:"POST",get duplex(){return r=!0,"half"}}).headers.has("Content-Type");return r&&!t}),EKn=64*1024,Xlr=bKn&&CKn(()=>Bt.isReadableStream(new Response("").body)),cat={stream:Xlr&&(r=>r.body)};uat&&(r=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!cat[t]&&(cat[t]=Bt.isFunction(r[t])?n=>n[t]():(n,i)=>{throw new $n(`Response type '${t}' is not supported`,$n.ERR_NOT_SUPPORT,i)})})})(new Response);ZMa=async r=>{if(r==null)return 0;if(Bt.isBlob(r))return r.size;if(Bt.isSpecCompliantForm(r))return(await new Request(Gu.origin,{method:"POST",body:r}).arrayBuffer()).byteLength;if(Bt.isArrayBufferView(r)||Bt.isArrayBuffer(r))return r.byteLength;if(Bt.isURLSearchParams(r)&&(r=r+""),Bt.isString(r))return(await XMa(r)).byteLength},e8a=async(r,t)=>{let n=Bt.toFiniteNumber(r.getContentLength());return n??ZMa(t)},IKn=uat&&(async r=>{let{url:t,method:n,data:i,signal:o,cancelToken:s,timeout:a,onDownloadProgress:l,onUploadProgress:u,responseType:c,headers:d,withCredentials:p="same-origin",fetchOptions:A}=lat(r);c=c?(c+"").toLowerCase():"text";let f=gKn([o,s&&s.toAbortSignal()],a),h,y=f&&f.unsubscribe&&(()=>{f.unsubscribe()}),C;try{if(u&&$Ma&&n!=="get"&&n!=="head"&&(C=await e8a(d,i))!==0){let P=new Request(t,{method:"POST",body:i,duplex:"half"}),z;if(Bt.isFormData(i)&&(z=P.headers.get("content-type"))&&d.setContentType(z),P.body){let[q,H]=M1e(C,_P(x1e(u)));i=Jlr(P.body,EKn,q,H)}}Bt.isString(p)||(p=p?"include":"omit");let O="credentials"in Request.prototype;h=new Request(t,{...A,signal:f,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:i,duplex:"half",credentials:O?p:void 0});let w=await fetch(h),T=Xlr&&(c==="stream"||c==="response");if(Xlr&&(l||T&&y)){let P={};["status","statusText","headers"].forEach(V=>{P[V]=w[V]});let z=Bt.toFiniteNumber(w.headers.get("content-length")),[q,H]=l&&M1e(z,_P(x1e(l),!0))||[];w=new Response(Jlr(w.body,EKn,q,()=>{H&&H(),y&&y()}),P)}c=c||"text";let R=await cat[Bt.findKey(cat,c)||"text"](w,r);return!T&&y&&y(),await new Promise((P,z)=>{xM(P,z,{data:R,headers:zp.from(w.headers),status:w.status,statusText:w.statusText,config:r,request:h})})}catch(O){throw y&&y(),O&&O.name==="TypeError"&&/fetch/i.test(O.message)?Object.assign(new $n("Network Error",$n.ERR_NETWORK,r,h),{cause:O.cause||O}):$n.from(O,O&&O.code,r,h)}})});var $lr,SKn,t8a,dat,Zlr=be(()=>{Eu();lKn();hKn();vKn();Av();$lr={http:aKn,xhr:fKn,fetch:IKn};Bt.forEach($lr,(r,t)=>{if(r){try{Object.defineProperty(r,"name",{value:t})}catch{}Object.defineProperty(r,"adapterName",{value:t})}});SKn=r=>`- ${r}`,t8a=r=>Bt.isFunction(r)||r===null||r===!1,dat={getAdapter:r=>{r=Bt.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,!t8a(n)&&(i=$lr[(a=String(n)).toLowerCase()],i===void 0))throw new $n(`Unknown adapter '${a}'`);if(i)break;o[a||"#"+s]=i}if(!i){let s=Object.entries(o).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build")),a=t?s.length>1?`since :
|
|
@@ -7117,7 +7117,7 @@ The delete attempt failed with this message:
|
|
|
7117
7117
|
|
|
7118
7118
|
`,r.UPLOAD_MISMATCH=`The uploaded data did not match the data from the server.
|
|
7119
7119
|
As a precaution, the file has been deleted.
|
|
7120
|
-
To be sure the content is the same, you should try uploading the file again.`,r.MD5_RESUMED_UPLOAD="MD5 cannot be used with a continued resumable upload as MD5 cannot be extended from an existing value",r.MISSING_RESUME_CRC32C_FINAL_UPLOAD="The CRC32C is missing for the final portion of a resumed upload, which is required for validation. Please provide `resumeCRC32C` if validation is required, or disable `validation`."})(g2||(g2={}));var zN=class r extends EI{constructor(t,n,i={}){var o,s;let a={},l;i.generation!==null&&(typeof i.generation=="string"?l=Number(i.generation):l=i.generation,isNaN(l)||(a.generation=l)),Object.assign(a,i.preconditionOpts);let u=i.userProject||t.userProject;typeof u=="string"&&(a.userProject=u);let c={delete:{reqOpts:{qs:a}},exists:{reqOpts:{qs:a}},get:{reqOpts:{qs:a}},getMetadata:{reqOpts:{qs:a}},setMetadata:{reqOpts:{qs:a}}};if(super({parent:t,baseUrl:"/o",id:encodeURIComponent(n),methods:c}),Bsn.add(this),this.bucket=t,this.storage=t.parent,i.generation!==null){let d;typeof i.generation=="string"?d=Number(i.generation):d=i.generation,isNaN(d)||(this.generation=d)}this.kmsKeyName=i.kmsKeyName,this.userProject=u,this.name=n,i.encryptionKey&&this.setEncryptionKey(i.encryptionKey),this.acl=new jX({request:this.request.bind(this),pathPrefix:"/acl"}),this.crc32cGenerator=i.crc32cGenerator||this.bucket.crc32cGenerator,this.instanceRetryValue=(s=(o=this.storage)===null||o===void 0?void 0:o.retryOptions)===null||s===void 0?void 0:s.autoRetry,this.instancePreconditionOpts=i?.preconditionOpts}get cloudStorageURI(){let t=this.bucket.cloudStorageURI;return t.pathname=this.name,t}shouldRetryBasedOnPreconditionAndIdempotencyStrat(t){var n;return!(t?.ifGenerationMatch===void 0&&((n=this.instancePreconditionOpts)===null||n===void 0?void 0:n.ifGenerationMatch)===void 0&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)}copy(t,n,i){var o,s;let a=new Error(g2.DESTINATION_NO_NAME);if(!t)throw a;let l={};typeof n=="function"?i=n:n&&(l={...n}),i=i||wl.noop;let u,c,d;if(typeof t=="string"){let f=An0.exec(t);f!==null&&f.length===3?(u=this.storage.bucket(f[1]),c=f[2]):(u=this.bucket,c=t)}else if(t instanceof qN)u=t,c=this.name;else if(t instanceof r)u=t.bucket,c=t.name,d=t;else throw a;let p={};this.generation!==void 0&&(p.sourceGeneration=this.generation),l.token!==void 0&&(p.rewriteToken=l.token),l.userProject!==void 0&&(p.userProject=l.userProject,delete l.userProject),l.predefinedAcl!==void 0&&(p.destinationPredefinedAcl=l.predefinedAcl,delete l.predefinedAcl),d=d||u.file(c);let A={};if(this.encryptionKey!==void 0&&(A["x-goog-copy-source-encryption-algorithm"]="AES256",A["x-goog-copy-source-encryption-key"]=this.encryptionKeyBase64,A["x-goog-copy-source-encryption-key-sha256"]=this.encryptionKeyHash),d.encryptionKey!==void 0?this.setEncryptionKey(d.encryptionKey):l.destinationKmsKeyName!==void 0?(p.destinationKmsKeyName=l.destinationKmsKeyName,delete l.destinationKmsKeyName):d.kmsKeyName!==void 0&&(p.destinationKmsKeyName=d.kmsKeyName),p.destinationKmsKeyName){this.kmsKeyName=p.destinationKmsKeyName;let f=this.interceptors.indexOf(this.encryptionKeyInterceptor);f>-1&&this.interceptors.splice(f,1)}this.shouldRetryBasedOnPreconditionAndIdempotencyStrat(l?.preconditionOpts)||(this.storage.retryOptions.autoRetry=!1),((o=l.preconditionOpts)===null||o===void 0?void 0:o.ifGenerationMatch)!==void 0&&(p.ifGenerationMatch=(s=l.preconditionOpts)===null||s===void 0?void 0:s.ifGenerationMatch,delete l.preconditionOpts),this.request({method:"POST",uri:`/rewriteTo/b/${u.name}/o/${encodeURIComponent(d.name)}`,qs:p,json:l,headers:A},(f,h)=>{if(this.storage.retryOptions.autoRetry=this.instanceRetryValue,f){i(f,null,h);return}if(h.rewriteToken){let y={token:h.rewriteToken};p.userProject&&(y.userProject=p.userProject),p.destinationKmsKeyName&&(y.destinationKmsKeyName=p.destinationKmsKeyName),this.copy(d,y,i);return}i(null,d,h)})}createReadStream(t={}){t=Object.assign({decompress:!0},t);let n=typeof t.start=="number"||typeof t.end=="number",i=t.end<0,o,s,a=new SVe,l=!0,u=!1;if(typeof t.validation=="string"){let f=t.validation.toLowerCase().trim();l=f==="crc32c",u=f==="md5"}else t.validation===!1&&(l=!1);let c=!n&&(l||u);if(n){if(typeof t.validation=="string"||t.validation===!0)throw new Error(g2.INVALID_VALIDATION_FILE_RANGE);l=!1,u=!1}let d=f=>{f&&(s?.agent&&s.agent.destroy(),a.destroy(f))},p=(f,h,y)=>{if(f){this.getBufferFromReadable(y).then(P=>{f.message=P.toString("utf8"),a.destroy(f)});return}s=y.request;let C=y.toJSON().headers,O=C["content-encoding"]==="gzip",w={},T=C["x-goog-stored-content-encoding"]==="gzip"&&O||C["x-goog-stored-content-encoding"]==="identity",R=[];if(c&&(typeof C["x-goog-hash"]=="string"&&C["x-goog-hash"].split(",").forEach(P=>{let z=P.indexOf("="),q=P.substring(0,z),H=P.substring(z+1);w[q]=H}),o=new BVe({crc32c:l,md5:u,crc32cGenerator:this.crc32cGenerator,crc32cExpected:w.crc32c,md5Expected:w.md5})),u&&!w.md5){let P=new Qle(g2.MD5_NOT_AVAILABLE);P.code="MD5_NOT_AVAILABLE",a.destroy(P);return}T&&c&&o&&R.push(o),O&&t.decompress&&R.push(mPt.createGunzip()),(0,lwe.pipeline)(y,...R,a,d)},A=()=>{let f={alt:"media"};this.generation&&(f.generation=this.generation),t.userProject&&(f.userProject=t.userProject);let h={"Accept-Encoding":"gzip","Cache-Control":"no-store"};if(n){let C=typeof t.start=="number"?t.start:"0",O=typeof t.end=="number"?t.end:"";h.Range=`bytes=${i?O:`${C}-${O}`}`}let y={uri:"",headers:h,qs:f};t[Vg]&&(y[Vg]=t[Vg]),this.requestStream(y).on("error",C=>{a.destroy(C)}).on("response",C=>{a.emit("response",C),wl.handleResp(null,C,null,p)}).resume()};return a.on("reading",A),a}createResumableUpload(t,n){var i,o;let s=typeof t=="object"?t:{};n=typeof t=="function"?t:n;let a=this.storage.retryOptions;(((i=s?.preconditionOpts)===null||i===void 0?void 0:i.ifGenerationMatch)===void 0&&((o=this.instancePreconditionOpts)===null||o===void 0?void 0:o.ifGenerationMatch)===void 0&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(a.autoRetry=!1),CAs({authClient:this.storage.authClient,apiEndpoint:this.storage.apiEndpoint,bucket:this.bucket.name,customRequestOptions:this.getRequestInterceptors().reduce((l,u)=>u(l),{}),file:this.name,generation:this.generation,key:this.encryptionKey,kmsKeyName:this.kmsKeyName,metadata:s.metadata,offset:s.offset,origin:s.origin,predefinedAcl:s.predefinedAcl,private:s.private,public:s.public,userProject:s.userProject||this.userProject,retryOptions:a,params:s?.preconditionOpts||this.instancePreconditionOpts,universeDomain:this.bucket.storage.universeDomain,[Vg]:s[Vg]},n),this.storage.retryOptions.autoRetry=this.instanceRetryValue}createWriteStream(t={}){var n;if((n=t.metadata)!==null&&n!==void 0||(t.metadata={}),t.contentType&&(t.metadata.contentType=t.contentType),!t.metadata.contentType||t.metadata.contentType==="auto"){let f=NAs.default.getType(this.name);f&&(t.metadata.contentType=f)}let i=t.gzip;i==="auto"&&(i=(0,xAs.default)(t.metadata.contentType||"")),i&&(t.metadata.contentEncoding="gzip");let o=!0,s=!1;if(typeof t.validation=="string"?(t.validation=t.validation.toLowerCase(),o=t.validation==="crc32c",s=t.validation==="md5"):t.validation===!1&&(o=!1,s=!1),t.offset){if(s)throw new RangeError(g2.MD5_RESUMED_UPLOAD);if(o&&!t.isPartialUpload&&!t.resumeCRC32C)throw new RangeError(g2.MISSING_RESUME_CRC32C_FINAL_UPLOAD)}let a=f=>{l.destroy(f||void 0)},l=new lwe.Writable({final(f){a=f,c.end()},write(f,h,y){c.write(f,h,y)}}),u=[];i&&u.push(mPt.createGzip());let c=new SVe,d=null;if(o||s){let f=t.resumeCRC32C?GX.from(t.resumeCRC32C):void 0;d=new BVe({crc32c:o,crc32cInstance:f,md5:s,crc32cGenerator:this.crc32cGenerator,updateHashesOnly:!0}),u.push(d)}let p=(0,PAs.default)(),A=!1;return c.on("reading",()=>l.emit("reading")),c.on("writing",()=>l.emit("writing")),p.on("uri",f=>l.emit("uri",f)),p.on("progress",f=>l.emit("progress",f)),p.on("response",f=>l.emit("response",f)),p.once("metadata",()=>{A=!0}),l.once("writing",()=>{t.resumable===!1?this.startSimpleUpload_(p,t):this.startResumableUpload_(p,t),(0,lwe.pipeline)(c,...u,p,async f=>{if(f)return a(f);if(!A)try{await new Promise((h,y)=>{p.once("metadata",h),p.once("error",y)})}catch(h){return a(h)}d?.crc32c&&l.emit("crc32c",d.crc32c);try{let h=t.isPartialUpload&&!this.metadata;d&&!h&&await pn0(this,Bsn,"m",RAs).call(this,d,{crc32c:o,md5:s}),a()}catch(h){a(h)}})}),l}delete(t,n){let i=typeof t=="object"?t:{};n=typeof t=="function"?t:n,this.disableAutoRetryConditionallyIdempotent_(this.methods.delete,kB.delete,i),super.delete(i).then(o=>n(null,...o)).catch(n).finally(()=>{this.storage.retryOptions.autoRetry=this.instanceRetryValue})}download(t,n){let i;typeof t=="function"?(n=t,i={}):i=t;let o=!1,s=(...c)=>{o||n(...c),o=!0},a=i.destination;delete i.destination;let l=this.createReadStream(i),u=!1;a?l.on("error",s).once("data",c=>{u=!0;let d=gPt.createWriteStream(a);d.write(c),l.pipe(d).on("error",s).on("finish",s)}).on("end",()=>{if(!u){let c=Buffer.alloc(0);try{gPt.writeFileSync(a,c),s(null,c)}catch(d){s(d,c)}}}):this.getBufferFromReadable(l).then(c=>s?.(null,c)).catch(s)}setEncryptionKey(t){return this.encryptionKey=t,this.encryptionKeyBase64=Buffer.from(t).toString("base64"),this.encryptionKeyHash=DAs.createHash("sha256").update(this.encryptionKeyBase64,"base64").digest("base64"),this.encryptionKeyInterceptor={request:n=>(n.headers=n.headers||{},n.headers["x-goog-encryption-algorithm"]="AES256",n.headers["x-goog-encryption-key"]=this.encryptionKeyBase64,n.headers["x-goog-encryption-key-sha256"]=this.encryptionKeyHash,n)},this.interceptors.push(this.encryptionKeyInterceptor),this}getExpirationDate(t){this.getMetadata((n,i,o)=>{if(n){t(n,null,o);return}if(!i.retentionExpirationTime){let s=new Error(g2.EXPIRATION_TIME_NA);t(s,null,o);return}t(null,new Date(i.retentionExpirationTime),o)})}generateSignedPostPolicyV2(t,n){let i=Zw(t,n),o=i.options,s=i.callback,a=new Date(o.expires);if(isNaN(a.getTime()))throw new Error(FN.EXPIRATION_DATE_INVALID);if(a.valueOf()<Date.now())throw new Error(FN.EXPIRATION_DATE_PAST);o=Object.assign({},o);let l=[["eq","$key",this.name],{bucket:this.bucket.name}];if(Array.isArray(o.equals)&&(Array.isArray(o.equals[0])||(o.equals=[o.equals]),o.equals.forEach(p=>{if(!Array.isArray(p)||p.length!==2)throw new Error(g2.EQUALS_CONDITION_TWO_ELEMENTS);l.push(["eq",p[0],p[1]])})),Array.isArray(o.startsWith)&&(Array.isArray(o.startsWith[0])||(o.startsWith=[o.startsWith]),o.startsWith.forEach(p=>{if(!Array.isArray(p)||p.length!==2)throw new Error(g2.STARTS_WITH_TWO_ELEMENTS);l.push(["starts-with",p[0],p[1]])})),o.acl&&l.push({acl:o.acl}),o.successRedirect&&l.push({success_action_redirect:o.successRedirect}),o.successStatus&&l.push({success_action_status:o.successStatus}),o.contentLengthRange){let p=o.contentLengthRange.min,A=o.contentLengthRange.max;if(typeof p!="number"||typeof A!="number")throw new Error(g2.CONTENT_LENGTH_RANGE_MIN_MAX);l.push(["content-length-range",p,A])}let u={expiration:a.toISOString(),conditions:l},c=JSON.stringify(u),d=Buffer.from(c).toString("base64");this.storage.authClient.sign(d,o.signingEndpoint).then(p=>{s(null,{string:c,base64:d,signature:p})},p=>{s(new kle(p.message))})}generateSignedPostPolicyV4(t,n){let i=Zw(t,n),o=i.options,s=i.callback,a=new Date(o.expires);if(isNaN(a.getTime()))throw new Error(FN.EXPIRATION_DATE_INVALID);if(a.valueOf()<Date.now())throw new Error(FN.EXPIRATION_DATE_PAST);if(a.valueOf()-Date.now()>BAs*1e3)throw new Error(`Max allowed expiration is seven days (${BAs} seconds).`);o=Object.assign({},o);let l=Object.assign({},o.fields),u=new Date,c=Dle(u,!0),d=Dle(u);(async()=>{let{client_email:A}=await this.storage.authClient.getCredentials(),f=`${A}/${d}/auto/storage/goog4_request`;l={...l,bucket:this.bucket.name,key:this.name,"x-goog-date":c,"x-goog-credential":f,"x-goog-algorithm":"GOOG4-RSA-SHA256"};let h=o.conditions||[];Object.entries(l).forEach(([T,R])=>{T.startsWith("x-ignore-")||h.push({[T]:R})}),delete l.bucket;let y=Dle(a,!0,"-",":"),O=aAs({conditions:h,expiration:y}),w=Buffer.from(O).toString("base64");try{let T=await this.storage.authClient.sign(w,o.signingEndpoint),R=Buffer.from(T,"base64").toString("hex"),P=this.parent.storage.universeDomain;l.policy=w,l["x-goog-signature"]=R;let z;return this.storage.customEndpoint?z=this.storage.apiEndpoint:o.virtualHostedStyle?z=`https://${this.bucket.name}.storage.${P}/`:o.bucketBoundHostname?z=`${o.bucketBoundHostname}/`:z=`https://storage.${P}/${this.bucket.name}/`,{url:z,fields:l}}catch(T){throw new kle(T.message)}})().then(A=>s(null,A),s)}getSignedUrl(t,n){let i=Rsn[t.action],o=sAs(t.extensionHeaders||{});t.action==="resumable"&&(o["x-goog-resumable"]="start");let s=Object.assign({},t.queryParams);typeof t.responseType=="string"&&(s["response-content-type"]=t.responseType),typeof t.promptSaveAs=="string"&&(s["response-content-disposition"]='attachment; filename="'+t.promptSaveAs+'"'),typeof t.responseDisposition=="string"&&(s["response-content-disposition"]=t.responseDisposition),this.generation&&(s.generation=this.generation.toString());let a={method:i,expires:t.expires,accessibleAt:t.accessibleAt,extensionHeaders:o,queryParams:s,contentMd5:t.contentMd5,contentType:t.contentType,host:t.host};t.cname&&(a.cname=t.cname),t.version&&(a.version=t.version),t.virtualHostedStyle&&(a.virtualHostedStyle=t.virtualHostedStyle),this.signer||(this.signer=new awe(this.storage.authClient,this.bucket,this,this.storage)),this.signer.getSignedUrl(a).then(l=>n(null,l),n)}isPublic(t){var n;let i=((n=this.storage)===null||n===void 0?void 0:n.interceptors)||[],o=this.interceptors||[],a=i.concat(o).reduce((l,u)=>{let c=u.request({uri:`${this.storage.apiEndpoint}/${this.bucket.name}/${encodeURIComponent(this.name)}`});return Object.assign(l,c.headers),l},{});wl.makeRequest({method:"GET",uri:`${this.storage.apiEndpoint}/${this.bucket.name}/${encodeURIComponent(this.name)}`,headers:a},{retryOptions:this.storage.retryOptions},l=>{l?l.code===403?t(null,!1):t(l):t(null,!0)})}makePrivate(t,n){var i,o;let s=typeof t=="object"?t:{};n=typeof t=="function"?t:n;let a={predefinedAcl:s.strict?"private":"projectPrivate"};((i=s.preconditionOpts)===null||i===void 0?void 0:i.ifMetagenerationMatch)!==void 0&&(a.ifMetagenerationMatch=(o=s.preconditionOpts)===null||o===void 0?void 0:o.ifMetagenerationMatch,delete s.preconditionOpts),s.userProject&&(a.userProject=s.userProject);let l={...s.metadata,acl:null};this.setMetadata(l,a,n)}makePublic(t){t=t||wl.noop,this.acl.add({entity:"allUsers",role:"READER"},(n,i,o)=>{t(n,o)})}publicUrl(){return`${this.storage.apiEndpoint}/${this.bucket.name}/${encodeURIComponent(this.name)}`}move(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,i=i||wl.noop,this.copy(t,o,(s,a,l)=>{if(s){s.message="file#copy failed with an error - "+s.message,i(s,null,l);return}this.name!==a.name||this.bucket.name!==a.bucket.name?this.delete(o,(u,c)=>{if(u){u.message="file#delete failed with an error - "+u.message,i(u,a,c);return}i(null,a,l)}):i(null,a,l)})}rename(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,i=i||wl.noop,this.move(t,o,i)}request(t,n){return this.parent.request.call(this,t,n)}rotateEncryptionKey(t,n){var i;n=typeof t=="function"?t:n;let o={};typeof t=="string"||t instanceof Buffer?o={encryptionKey:t}:typeof t=="object"&&(o=t);let s=this.bucket.file(this.id,o),a=((i=o.preconditionOpts)===null||i===void 0?void 0:i.ifGenerationMatch)!==void 0?{preconditionOpts:o.preconditionOpts}:{};this.copy(s,a,n)}save(t,n,i){i=typeof n=="function"?n:i;let o=typeof n=="object"?n:{},s=this.storage.retryOptions.maxRetries;this.shouldRetryBasedOnPreconditionAndIdempotencyStrat(o?.preconditionOpts)||(s=0);let a=(0,kAs.default)(async l=>new Promise((u,c)=>{s===0&&(this.storage.retryOptions.autoRetry=!1);let d=this.createWriteStream(o);o.onUploadProgress&&d.on("progress",o.onUploadProgress);let p=A=>this.storage.retryOptions.autoRetry&&this.storage.retryOptions.retryableErrorFn(A)?c(A):l(A);typeof t=="string"||Buffer.isBuffer(t)?d.on("error",p).on("finish",()=>u()).end(t):(0,lwe.pipeline)(t,d,A=>{if(A){if(typeof t!="function")return l(A);p(A)}else u()})}),{retries:s,factor:this.storage.retryOptions.retryDelayMultiplier,maxTimeout:this.storage.retryOptions.maxRetryDelay*1e3,maxRetryTime:this.storage.retryOptions.totalTimeout*1e3});return i?a.then(()=>{if(i)return i()}).catch(i):a}setMetadata(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,this.disableAutoRetryConditionallyIdempotent_(this.methods.setMetadata,kB.setMetadata,o),super.setMetadata(t,o).then(s=>i(null,...s)).catch(i).finally(()=>{this.storage.retryOptions.autoRetry=this.instanceRetryValue})}setStorageClass(t,n,i){i=typeof n=="function"?n:i;let s={...typeof n=="object"?n:{},storageClass:t.replace(/-/g,"_").replace(/([a-z])([A-Z])/g,(a,l,u)=>l+"_"+u).toUpperCase()};this.copy(this,s,(a,l,u)=>{if(a){i(a,u);return}this.metadata=l.metadata,i(null,u)})}setUserProject(t){this.bucket.setUserProject.call(this,t)}startResumableUpload_(t,n={}){var i;(i=n.metadata)!==null&&i!==void 0||(n.metadata={});let o=this.storage.retryOptions;this.shouldRetryBasedOnPreconditionAndIdempotencyStrat(n.preconditionOpts)||(o.autoRetry=!1);let s=bAs({authClient:this.storage.authClient,apiEndpoint:this.storage.apiEndpoint,bucket:this.bucket.name,customRequestOptions:this.getRequestInterceptors().reduce((a,l)=>l(a),{}),file:this.name,generation:this.generation,isPartialUpload:n.isPartialUpload,key:this.encryptionKey,kmsKeyName:this.kmsKeyName,metadata:n.metadata,offset:n.offset,predefinedAcl:n.predefinedAcl,private:n.private,public:n.public,uri:n.uri,userProject:n.userProject||this.userProject,retryOptions:{...o},params:n?.preconditionOpts||this.instancePreconditionOpts,chunkSize:n?.chunkSize,highWaterMark:n?.highWaterMark,universeDomain:this.bucket.storage.universeDomain,[Vg]:n[Vg]});s.on("response",a=>{t.emit("response",a)}).on("uri",a=>{t.emit("uri",a)}).on("metadata",a=>{this.metadata=a,t.emit("metadata")}).on("finish",()=>{t.emit("complete")}).on("progress",a=>t.emit("progress",a)),t.setWritable(s),this.storage.retryOptions.autoRetry=this.instanceRetryValue}startSimpleUpload_(t,n={}){var i;(i=n.metadata)!==null&&i!==void 0||(n.metadata={});let o=this.storage.apiEndpoint,s=this.bucket.name,a=`${o}/upload/storage/v1/b/${s}/o`,l={qs:{name:this.name},uri:a,[Vg]:n[Vg]};this.generation!==void 0&&(l.qs.ifGenerationMatch=this.generation),this.kmsKeyName!==void 0&&(l.qs.kmsKeyName=this.kmsKeyName),typeof n.timeout=="number"&&(l.timeout=n.timeout),(n.userProject||this.userProject)&&(l.qs.userProject=n.userProject||this.userProject),n.predefinedAcl?l.qs.predefinedAcl=n.predefinedAcl:n.private?l.qs.predefinedAcl="private":n.public&&(l.qs.predefinedAcl="publicRead"),Object.assign(l.qs,this.instancePreconditionOpts,n.preconditionOpts),wl.makeWritableStream(t,{makeAuthenticatedRequest:u=>{this.request(u,(c,d,p)=>{if(c){t.destroy(c);return}this.metadata=d,t.emit("metadata",d),t.emit("response",p),t.emit("complete")})},metadata:n.metadata,request:l})}disableAutoRetryConditionallyIdempotent_(t,n,i){var o,s,a,l;(typeof t=="object"&&((s=(o=t?.reqOpts)===null||o===void 0?void 0:o.qs)===null||s===void 0?void 0:s.ifGenerationMatch)===void 0&&i?.ifGenerationMatch===void 0&&n===kB.delete&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(this.storage.retryOptions.autoRetry=!1),(typeof t=="object"&&((l=(a=t?.reqOpts)===null||a===void 0?void 0:a.qs)===null||l===void 0?void 0:l.ifMetagenerationMatch)===void 0&&i?.ifMetagenerationMatch===void 0&&n===kB.setMetadata&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(this.storage.retryOptions.autoRetry=!1)}async getBufferFromReadable(t){let n=[];for await(let i of t)n.push(i);return Buffer.concat(n)}};Bsn=new WeakSet,RAs=async function(t,n={}){let i=this.metadata,o=!!(n.crc32c||n.md5);if(n.crc32c&&i.crc32c&&(o=!t.test("crc32c",i.crc32c)),n.md5&&i.md5Hash&&(o=!t.test("md5",i.md5Hash)),o){let s=[],a="",l="";try{await this.delete(),n.md5&&!i.md5Hash?(a="MD5_NOT_AVAILABLE",l=g2.MD5_NOT_AVAILABLE):(a="FILE_NO_UPLOAD",l=g2.UPLOAD_MISMATCH)}catch(c){let d=c;a="FILE_NO_UPLOAD_DELETE",l=`${g2.UPLOAD_MISMATCH_DELETE_FAIL}${d.message}`,s.push(d)}let u=new Qle(l);throw u.code=a,u.errors=s,u}return!0};(0,MAs.promisifyAll)(zN,{exclude:["cloudStorageURI","publicUrl","request","save","setEncryptionKey","shouldRetryBasedOnPreconditionAndIdempotencyStrat","getBufferFromReadable"]});var QAs=yt(wh(),1);var yPt;(function(r){r.POLICY_OBJECT_REQUIRED="A policy object is required.",r.PERMISSIONS_REQUIRED="Permissions are required."})(yPt||(yPt={}));var cwe=class{constructor(t){this.request_=t.request.bind(t),this.resourceId_="buckets/"+t.getId()}getPolicy(t,n){let{options:i,callback:o}=Zw(t,n),s={};i.userProject&&(s.userProject=i.userProject),i.requestedPolicyVersion!==null&&i.requestedPolicyVersion!==void 0&&(s.optionsRequestedPolicyVersion=i.requestedPolicyVersion),this.request_({uri:"/iam",qs:s},o)}setPolicy(t,n,i){if(t===null||typeof t!="object")throw new Error(yPt.POLICY_OBJECT_REQUIRED);let{options:o,callback:s}=Zw(n,i),a;t.etag===void 0&&(a=0),this.request_({method:"PUT",uri:"/iam",maxRetries:a,json:Object.assign({resourceId:this.resourceId_},t),qs:o},s)}testPermissions(t,n,i){if(!Array.isArray(t)&&typeof t!="string")throw new Error(yPt.PERMISSIONS_REQUIRED);let{options:o,callback:s}=Zw(n,i),a=Array.isArray(t)?t:[t],l=Object.assign({permissions:a},o);this.request_({uri:"/iam/testPermissions",qs:l,useQuerystring:!0},(u,c)=>{if(u){s(u,null,c);return}let d=Array.isArray(c.permissions)?c.permissions:[],p=a.reduce((A,f)=>(A[f]=d.indexOf(f)>-1,A),{});s(null,p,c)})}};(0,QAs.promisifyAll)(cwe);var LAs=yt(wh(),1),uwe=class extends EI{constructor(t,n){let i={},o={create:!0,delete:{reqOpts:{qs:i}},get:{reqOpts:{qs:i}},getMetadata:{reqOpts:{qs:i}},exists:!0};super({parent:t,baseUrl:"/notificationConfigs",id:n.toString(),createMethod:t.createNotification.bind(t),methods:o})}};(0,LAs.promisifyAll)(uwe);var WAs=require("stream"),GAs=require("url"),Dsn;(function(r){r.list="GET"})(Dsn||(Dsn={}));var kB;(function(r){r[r.setMetadata=0]="setMetadata",r[r.delete=1]="delete"})(kB||(kB={}));var UN;(function(r){r.PROVIDE_SOURCE_FILE="You must provide at least one source file.",r.DESTINATION_FILE_NOT_SPECIFIED="A destination file must be specified.",r.CHANNEL_ID_REQUIRED="An ID is required to create a channel.",r.TOPIC_NAME_REQUIRED="A valid topic name is required.",r.CONFIGURATION_OBJECT_PREFIX_REQUIRED="A configuration object with a prefix is required.",r.SPECIFY_FILE_NAME="A file name must be specified.",r.METAGENERATION_NOT_PROVIDED="A metageneration must be provided.",r.SUPPLY_NOTIFICATION_ID="You must supply a notification ID."})(UN||(UN={}));var qN=class r extends EI{getFilesStream(t){return new WAs.Readable}constructor(t,n,i){var o,s,a,l;i=i||{},n=n.replace(/^gs:\/\//,"").replace(/\/+$/,"");let u={};!((o=i?.preconditionOpts)===null||o===void 0)&&o.ifGenerationMatch&&(u.ifGenerationMatch=i.preconditionOpts.ifGenerationMatch),!((s=i?.preconditionOpts)===null||s===void 0)&&s.ifGenerationNotMatch&&(u.ifGenerationNotMatch=i.preconditionOpts.ifGenerationNotMatch),!((a=i?.preconditionOpts)===null||a===void 0)&&a.ifMetagenerationMatch&&(u.ifMetagenerationMatch=i.preconditionOpts.ifMetagenerationMatch),!((l=i?.preconditionOpts)===null||l===void 0)&&l.ifMetagenerationNotMatch&&(u.ifMetagenerationNotMatch=i.preconditionOpts.ifMetagenerationNotMatch);let c=i.userProject;typeof c=="string"&&(u.userProject=c);let d={create:{reqOpts:{qs:u}},delete:{reqOpts:{qs:u}},exists:{reqOpts:{qs:u}},get:{reqOpts:{qs:u}},getMetadata:{reqOpts:{qs:u}},setMetadata:{reqOpts:{qs:u}}};super({parent:t,baseUrl:"/b",id:n,createMethod:t.createBucket.bind(t),methods:d}),this.name=n,this.storage=t,this.userProject=i.userProject,this.acl=new jX({request:this.request.bind(this),pathPrefix:"/acl"}),this.acl.default=new jX({request:this.request.bind(this),pathPrefix:"/defaultObjectAcl"}),this.crc32cGenerator=i.crc32cGenerator||this.storage.crc32cGenerator,this.iam=new cwe(this),this.getFilesStream=Nsn.paginator.streamify("getFiles"),this.instanceRetryValue=t.retryOptions.autoRetry,this.instancePreconditionOpts=i?.preconditionOpts}get cloudStorageURI(){let t=new GAs.URL("gs://");return t.host=this.name,t}addLifecycleRule(t,n,i){let o={};typeof n=="function"?i=n:n&&(o=n),o=o||{};let s=Array.isArray(t)?t:[t];for(let a of s)a.condition.createdBefore instanceof Date&&(a.condition.createdBefore=a.condition.createdBefore.toISOString().replace(/T.+$/,"")),a.condition.customTimeBefore instanceof Date&&(a.condition.customTimeBefore=a.condition.customTimeBefore.toISOString().replace(/T.+$/,"")),a.condition.noncurrentTimeBefore instanceof Date&&(a.condition.noncurrentTimeBefore=a.condition.noncurrentTimeBefore.toISOString().replace(/T.+$/,""));if(o.append===!1){this.setMetadata({lifecycle:{rule:s}},o,i);return}this.getMetadata((a,l)=>{var u,c;if(a){i(a);return}let d=Array.isArray((u=l.lifecycle)===null||u===void 0?void 0:u.rule)?(c=l.lifecycle)===null||c===void 0?void 0:c.rule:[];this.setMetadata({lifecycle:{rule:d.concat(s)}},o,i)})}combine(t,n,i,o){var s;if(!Array.isArray(t)||t.length===0)throw new Error(UN.PROVIDE_SOURCE_FILE);if(!n)throw new Error(UN.DESTINATION_FILE_NOT_SPECIFIED);let a={};typeof i=="function"?o=i:i&&(a=i),this.disableAutoRetryConditionallyIdempotent_(this.methods.setMetadata,kB.setMetadata,a);let l=d=>d instanceof zN?d:this.file(d);t=t.map(l);let u=l(n);if(o=o||wl.noop,!u.metadata.contentType){let d=qAs.contentType(u.name);d&&(u.metadata.contentType=d)}let c=this.storage.retryOptions.maxRetries;(((s=u?.instancePreconditionOpts)===null||s===void 0?void 0:s.ifGenerationMatch)===void 0&&a.ifGenerationMatch===void 0&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(c=0),a.ifGenerationMatch===void 0&&Object.assign(a,u.instancePreconditionOpts,a),u.request({method:"POST",uri:"/compose",maxRetries:c,json:{destination:{contentType:u.metadata.contentType},sourceObjects:t.map(d=>{let p={name:d.name};return d.metadata&&d.metadata.generation&&(p.generation=parseInt(d.metadata.generation.toString())),p})},qs:a},(d,p)=>{if(this.storage.retryOptions.autoRetry=this.instanceRetryValue,d){o(d,null,p);return}o(null,u,p)})}createChannel(t,n,i,o){if(typeof t!="string")throw new Error(UN.CHANNEL_ID_REQUIRED);let s={};typeof i=="function"?o=i:i&&(s=i),this.request({method:"POST",uri:"/o/watch",json:Object.assign({id:t,type:"web_hook"},n),qs:s},(a,l)=>{if(a){o(a,null,l);return}let u=l.resourceId,c=this.storage.channel(t,u);c.metadata=l,o(null,c,l)})}createNotification(t,n,i){let o={};if(typeof n=="function"?i=n:n&&(o=n),t!==null&&typeof t=="object"&&wl.isCustomType(t,"pubsub/topic")&&(t=t.name),typeof t!="string")throw new Error(UN.TOPIC_NAME_REQUIRED);let a=Object.assign({topic:t},o);a.topic.indexOf("projects")!==0&&(a.topic="projects/{{projectId}}/topics/"+a.topic),a.topic=`//pubsub.${this.storage.universeDomain}/`+a.topic,a.payloadFormat||(a.payloadFormat="JSON_API_V1");let l={};a.userProject&&(l.userProject=a.userProject,delete a.userProject),this.request({method:"POST",uri:"/notificationConfigs",json:sPt(a),qs:l,maxRetries:0},(u,c)=>{if(u){i(u,null,c);return}let d=this.notification(c.id);d.metadata=c,i(null,d,c)})}deleteFiles(t,n){let i={};typeof t=="function"?n=t:t&&(i=t);let o=10,s=1e3,a=[],l=u=>u.delete(i).catch(c=>{if(!i.force)throw c;a.push(c)});(async()=>{try{let u=[],c=(0,Msn.default)(o),d=this.getFilesStream(i);for await(let p of d)u.length>=s&&(await Promise.all(u),u=[]),u.push(c(()=>l(p)).catch(A=>{throw d.destroy(),A}));await Promise.all(u),n(a.length>0?a:null)}catch(u){n(u);return}})()}deleteLabels(t,n,i){let o=new Array,s={};typeof t=="function"?i=t:typeof t=="string"?o=[t]:Array.isArray(t)?o=t:t&&(s=t),typeof n=="function"?i=n:n&&(s=n);let a=l=>{let u=l.reduce((c,d)=>(c[d]=null,c),{});s?.ifMetagenerationMatch!==void 0?this.setLabels(u,s,i):this.setLabels(u,i)};o.length===0?this.getLabels((l,u)=>{if(l){i(l);return}a(Object.keys(u))}):a(o)}disableRequesterPays(t,n){let i={};typeof t=="function"?n=t:t&&(i=t),this.setMetadata({billing:{requesterPays:!1}},i,n)}enableLogging(t,n){if(!t||typeof t=="function"||typeof t.prefix>"u")throw new Error(UN.CONFIGURATION_OBJECT_PREFIX_REQUIRED);let i=this.id;t.bucket&&t.bucket instanceof r?i=t.bucket.id:t.bucket&&typeof t.bucket=="string"&&(i=t.bucket);let o={};t?.ifMetagenerationMatch&&(o.ifMetagenerationMatch=t.ifMetagenerationMatch),t?.ifMetagenerationNotMatch&&(o.ifMetagenerationNotMatch=t.ifMetagenerationNotMatch),(async()=>{try{let[s]=await this.iam.getPolicy();s.bindings.push({members:["group:cloud-storage-analytics@google.com"],role:"roles/storage.objectCreator"}),await this.iam.setPolicy(s),this.setMetadata({logging:{logBucket:i,logObjectPrefix:t.prefix}},o,n)}catch(s){n(s);return}})()}enableRequesterPays(t,n){let i={};typeof t=="function"?n=t:t&&(i=t),this.setMetadata({billing:{requesterPays:!0}},i,n)}file(t,n){if(!t)throw Error(UN.SPECIFY_FILE_NAME);return new zN(this,t,n)}getFiles(t,n){let i=typeof t=="object"?t:{};n||(n=t),i=Object.assign({},i),this.request({uri:"/o",qs:i},(o,s)=>{if(o){n(o,null,null,s);return}let l=(s.items?s.items:[]).map(c=>{let d={};i.versions&&(d.generation=c.generation),c.kmsKeyName&&(d.kmsKeyName=c.kmsKeyName);let p=this.file(c.name,d);return p.metadata=c,p}),u=null;s.nextPageToken&&(u=Object.assign({},i,{pageToken:s.nextPageToken})),n(null,l,u,s)})}getLabels(t,n){let i={};typeof t=="function"?n=t:t&&(i=t),this.getMetadata(i,(o,s)=>{if(o){n(o,null);return}n(null,s?.labels||{})})}getNotifications(t,n){let i={};typeof t=="function"?n=t:t&&(i=t),this.request({uri:"/notificationConfigs",qs:i},(o,s)=>{if(o){n(o,null,s);return}let l=(s.items?s.items:[]).map(u=>{let c=this.notification(u.id);return c.metadata=u,c});n(null,l,s)})}getSignedUrl(t,n){let o={method:Dsn[t.action],expires:t.expires,version:t.version,cname:t.cname,extensionHeaders:t.extensionHeaders||{},queryParams:t.queryParams||{},host:t.host,signingEndpoint:t.signingEndpoint};this.signer||(this.signer=new awe(this.storage.authClient,this,void 0,this.storage)),this.signer.getSignedUrl(o).then(s=>n(null,s),n)}lock(t,n){let i=typeof t;if(i!=="number"&&i!=="string")throw new Error(UN.METAGENERATION_NOT_PROVIDED);this.request({method:"POST",uri:"/lockRetentionPolicy",qs:{ifMetagenerationMatch:t}},n)}makePrivate(t,n){var i,o,s,a;let l=typeof t=="object"?t:{};n=typeof t=="function"?t:n,l.private=!0;let u={predefinedAcl:"projectPrivate"};l.userProject&&(u.userProject=l.userProject),!((i=l.preconditionOpts)===null||i===void 0)&&i.ifGenerationMatch&&(u.ifGenerationMatch=l.preconditionOpts.ifGenerationMatch),!((o=l.preconditionOpts)===null||o===void 0)&&o.ifGenerationNotMatch&&(u.ifGenerationNotMatch=l.preconditionOpts.ifGenerationNotMatch),!((s=l.preconditionOpts)===null||s===void 0)&&s.ifMetagenerationMatch&&(u.ifMetagenerationMatch=l.preconditionOpts.ifMetagenerationMatch),!((a=l.preconditionOpts)===null||a===void 0)&&a.ifMetagenerationNotMatch&&(u.ifMetagenerationNotMatch=l.preconditionOpts.ifMetagenerationNotMatch);let c={...l.metadata,acl:null};this.setMetadata(c,u,d=>{d&&n(d),(l.includeFiles?(0,xsn.promisify)(this.makeAllFilesPublicPrivate_).call(this,l):Promise.resolve([])).then(A=>n(null,A)).catch(n)})}makePublic(t,n){let i=typeof t=="object"?t:{};n=typeof t=="function"?t:n;let o={public:!0,...i};this.acl.add({entity:"allUsers",role:"READER"}).then(()=>this.acl.default.add({entity:"allUsers",role:"READER"})).then(()=>o.includeFiles?(0,xsn.promisify)(this.makeAllFilesPublicPrivate_).call(this,o):[]).then(s=>n(null,s),n)}notification(t){if(!t)throw new Error(UN.SUPPLY_NOTIFICATION_ID);return new uwe(this,t)}removeRetentionPeriod(t,n){let i=typeof t=="object"?t:{};n=typeof t=="function"?t:n,this.setMetadata({retentionPolicy:null},i,n)}request(t,n){return this.userProject&&(!t.qs||!t.qs.userProject)&&(t.qs={...t.qs,userProject:this.userProject}),super.request(t,n)}setLabels(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,i=i||wl.noop,this.setMetadata({labels:t},o,i)}setMetadata(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,this.disableAutoRetryConditionallyIdempotent_(this.methods.setMetadata,kB.setMetadata,o),super.setMetadata(t,o).then(s=>i(null,...s)).catch(i).finally(()=>{this.storage.retryOptions.autoRetry=this.instanceRetryValue})}setRetentionPeriod(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,this.setMetadata({retentionPolicy:{retentionPeriod:t.toString()}},o,i)}setCorsConfiguration(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,this.setMetadata({cors:t},o,i)}setStorageClass(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,t=t.replace(/-/g,"_").replace(/([a-z])([A-Z])/g,(s,a,l)=>a+"_"+l).toUpperCase(),this.setMetadata({storageClass:t},o,i)}setUserProject(t){this.userProject=t,["create","delete","exists","get","getMetadata","setMetadata"].forEach(i=>{let o=this.methods[i];typeof o=="object"&&(typeof o.reqOpts=="object"?Object.assign(o.reqOpts.qs,{userProject:t}):o.reqOpts={qs:{userProject:t}})})}upload(t,n,i){var o,s;let a=d=>{let p=(0,jAs.default)(async A=>{await new Promise((f,h)=>{var y,C;d===0&&(!((C=(y=c?.storage)===null||y===void 0?void 0:y.retryOptions)===null||C===void 0)&&C.autoRetry)&&(c.storage.retryOptions.autoRetry=!1);let O=c.createWriteStream(l);l.onUploadProgress&&O.on("progress",l.onUploadProgress),zAs.createReadStream(t).on("error",A).pipe(O).on("error",w=>this.storage.retryOptions.autoRetry&&this.storage.retryOptions.retryableErrorFn(w)?h(w):A(w)).on("finish",()=>f())})},{retries:d,factor:this.storage.retryOptions.retryDelayMultiplier,maxTimeout:this.storage.retryOptions.maxRetryDelay*1e3,maxRetryTime:this.storage.retryOptions.totalTimeout*1e3});return i?p.then(()=>{if(i)return i(null,c,c.metadata)}).catch(i):p};if(global.GCLOUD_SANDBOX_ENV)return;let l=typeof n=="object"?n:{};i=typeof n=="function"?n:i,l=Object.assign({metadata:{}},l);let u=this.storage.retryOptions.maxRetries;(((o=l?.preconditionOpts)===null||o===void 0?void 0:o.ifGenerationMatch)===void 0&&((s=this.instancePreconditionOpts)===null||s===void 0?void 0:s.ifGenerationMatch)===void 0&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(u=0);let c;if(l.destination instanceof zN)c=l.destination;else if(l.destination!==null&&typeof l.destination=="string")c=this.file(l.destination,{encryptionKey:l.encryptionKey,kmsKeyName:l.kmsKeyName,preconditionOpts:this.instancePreconditionOpts});else{let d=UAs.basename(t);c=this.file(d,{encryptionKey:l.encryptionKey,kmsKeyName:l.kmsKeyName,preconditionOpts:this.instancePreconditionOpts})}a(u)}makeAllFilesPublicPrivate_(t,n){let o=[],s=[],a=typeof t=="object"?t:{};n=typeof t=="function"?t:n;let l=async u=>{try{await(a.public?u.makePublic():u.makePrivate(a)),s.push(u)}catch(c){if(!a.force)throw c;o.push(c)}};this.getFiles(a).then(([u])=>{let c=(0,Msn.default)(10),d=u.map(p=>c(()=>l(p)));return Promise.all(d)}).then(()=>n(o.length>0?o:null,s),u=>n(u,s))}getId(){return this.id}disableAutoRetryConditionallyIdempotent_(t,n,i){var o,s;typeof t=="object"&&((s=(o=t?.reqOpts)===null||o===void 0?void 0:o.qs)===null||s===void 0?void 0:s.ifMetagenerationMatch)===void 0&&i?.ifMetagenerationMatch===void 0&&(n===kB.setMetadata||n===kB.delete)&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional?this.storage.retryOptions.autoRetry=!1:this.storage.retryOptions.idempotencyStrategy===rA.RetryNever&&(this.storage.retryOptions.autoRetry=!1)}};Nsn.paginator.extend(qN,"getFiles");(0,FAs.promisifyAll)(qN,{exclude:["cloudStorageURI","request","file","notification"]});var VAs=yt(wh(),1),Lle=class extends EI{constructor(t,n,i){let o={parent:t,baseUrl:"/channels",id:"",methods:{}};super(o),this.metadata.id=n,this.metadata.resourceId=i}stop(t){t=t||wl.noop,this.request({method:"POST",uri:"/stop",json:this.metadata},(n,i)=>{t(n,i)})}};(0,VAs.promisifyAll)(Lle);var YAs=yt(iwe(),1);var HAs=yt(wh(),1),Fle=class extends EI{constructor(t,n,i){let o={delete:!0,get:!0,getMetadata:!0,setMetadata:{reqOpts:{method:"PUT"}}},s=i&&i.projectId||t.projectId;super({parent:t,id:n,baseUrl:`/projects/${s}/hmacKeys`,methods:o}),this.storage=t,this.instanceRetryValue=t.retryOptions.autoRetry}setMetadata(t,n,i){this.storage.retryOptions.idempotencyStrategy!==rA.RetryAlways&&(this.storage.retryOptions.autoRetry=!1);let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,super.setMetadata(t,o).then(s=>i(null,...s)).catch(i).finally(()=>{this.storage.retryOptions.autoRetry=this.instanceRetryValue})}};(0,HAs.promisifyAll)(Fle);var JAs=yt(Vb(),1),rA;(function(r){r[r.RetryAlways=0]="RetryAlways",r[r.RetryConditional=1]="RetryConditional",r[r.RetryNever=2]="RetryNever"})(rA||(rA={}));var FN;(function(r){r.EXPIRATION_DATE_INVALID="The expiration date provided was invalid.",r.EXPIRATION_DATE_PAST="An expiration date cannot be in the past."})(FN||(FN={}));var dwe;(function(r){r.BUCKET_NAME_REQUIRED="A bucket name is needed to use Cloud Storage.",r.BUCKET_NAME_REQUIRED_CREATE="A name is required to create a bucket.",r.HMAC_SERVICE_ACCOUNT="The first argument must be a service account email to create an HMAC key.",r.HMAC_ACCESS_ID="An access ID is needed to create an HmacKey object."})(dwe||(dwe={}));var fn0=/^(\w*):\/\//,hn0=!0,gn0=3,mn0=2,yn0=600,En0=64,bn0=rA.RetryConditional,Cn0=function(r){var t;let n=i=>i.includes("eai_again")||i==="econnreset"||i==="unexpected connection closure"||i==="epipe"||i==="socket connection timeout";if(r){if([408,429,500,502,503,504].indexOf(r.code)!==-1)return!0;if(typeof r.code=="string"){if(["408","429","500","502","503","504"].indexOf(r.code)!==-1)return!0;let i=r.code.toLowerCase();if(n(i))return!0}if(r.errors)for(let i of r.errors){let o=(t=i?.reason)===null||t===void 0?void 0:t.toString().toLowerCase();if(o&&n(o))return!0}}return!1};var e_=class r extends wVe{getBucketsStream(){return new Psn.Readable}getHmacKeysStream(){return new Psn.Readable}constructor(t={}){var n,i,o,s,a,l,u,c,d,p,A,f,h,y;let O=`https://storage.${t.universeDomain||JAs.DEFAULT_UNIVERSE}`,w=!1,T=process.env.STORAGE_EMULATOR_HOST;typeof T=="string"&&(O=r.sanitizeEndpoint(T),w=!0),t.apiEndpoint&&(O=r.sanitizeEndpoint(t.apiEndpoint),w=!0),t=Object.assign({},t,{apiEndpoint:O});let R=T||`${t.apiEndpoint}/storage/v1`,P={apiEndpoint:t.apiEndpoint,retryOptions:{autoRetry:((n=t.retryOptions)===null||n===void 0?void 0:n.autoRetry)!==void 0?(i=t.retryOptions)===null||i===void 0?void 0:i.autoRetry:hn0,maxRetries:!((o=t.retryOptions)===null||o===void 0)&&o.maxRetries?(s=t.retryOptions)===null||s===void 0?void 0:s.maxRetries:gn0,retryDelayMultiplier:!((a=t.retryOptions)===null||a===void 0)&&a.retryDelayMultiplier?(l=t.retryOptions)===null||l===void 0?void 0:l.retryDelayMultiplier:mn0,totalTimeout:!((u=t.retryOptions)===null||u===void 0)&&u.totalTimeout?(c=t.retryOptions)===null||c===void 0?void 0:c.totalTimeout:yn0,maxRetryDelay:!((d=t.retryOptions)===null||d===void 0)&&d.maxRetryDelay?(p=t.retryOptions)===null||p===void 0?void 0:p.maxRetryDelay:En0,retryableErrorFn:!((A=t.retryOptions)===null||A===void 0)&&A.retryableErrorFn?(f=t.retryOptions)===null||f===void 0?void 0:f.retryableErrorFn:Cn0,idempotencyStrategy:((h=t.retryOptions)===null||h===void 0?void 0:h.idempotencyStrategy)!==void 0?(y=t.retryOptions)===null||y===void 0?void 0:y.idempotencyStrategy:bn0},baseUrl:R,customEndpoint:w,useAuthWithCustomEndpoint:t?.useAuthWithCustomEndpoint,projectIdRequired:!1,scopes:["https://www.googleapis.com/auth/iam","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/devstorage.full_control"],packageJson:(0,YAs.getPackageJSON)()};super(P,t),this.acl=r.acl,this.crc32cGenerator=t.crc32cGenerator||APt,this.retryOptions=P.retryOptions,this.getBucketsStream=EPt.paginator.streamify("getBuckets"),this.getHmacKeysStream=EPt.paginator.streamify("getHmacKeys")}static sanitizeEndpoint(t){return fn0.test(t)||(t=`https://${t}`),t.replace(/\/+$/,"")}bucket(t,n){if(!t)throw new Error(dwe.BUCKET_NAME_REQUIRED);return new qN(this,t,n)}channel(t,n){return new Lle(this,t,n)}createBucket(t,n,i){if(!t)throw new Error(dwe.BUCKET_NAME_REQUIRED_CREATE);let o;i?o=n:(i=n,o={});let s={...o,name:t},a={archive:"ARCHIVE",coldline:"COLDLINE",dra:"DURABLE_REDUCED_AVAILABILITY",multiRegional:"MULTI_REGIONAL",nearline:"NEARLINE",regional:"REGIONAL",standard:"STANDARD"},l=Object.keys(a);for(let c of l)if(s[c]){if(o.storageClass&&o.storageClass!==c)throw new Error(`Both \`${c}\` and \`storageClass\` were provided.`);s.storageClass=a[c],delete s[c]}s.requesterPays&&(s.billing={requesterPays:s.requesterPays},delete s.requesterPays);let u={project:this.projectId};s.userProject&&(u.userProject=s.userProject,delete s.userProject),s.enableObjectRetention&&(u.enableObjectRetention=s.enableObjectRetention,delete s.enableObjectRetention),this.request({method:"POST",uri:"/b",qs:u,json:s},(c,d)=>{if(c){i(c,null,d);return}let p=this.bucket(t);p.metadata=d,i(null,p,d)})}createHmacKey(t,n,i){if(typeof t!="string")throw new Error(dwe.HMAC_SERVICE_ACCOUNT);let{options:o,callback:s}=Zw(n,i),a=Object.assign({},o,{serviceAccountEmail:t}),l=a.projectId||this.projectId;delete a.projectId,this.request({method:"POST",uri:`/projects/${l}/hmacKeys`,qs:a,maxRetries:0},(u,c)=>{if(u){s(u,null,null,c);return}let d=c.metadata,p=this.hmacKey(d.accessId,{projectId:d.projectId});p.metadata=c.metadata,s(null,p,c.secret,c)})}getBuckets(t,n){let{options:i,callback:o}=Zw(t,n);i.project=i.project||this.projectId,this.request({uri:"/b",qs:i},(s,a)=>{if(s){o(s,null,null,a);return}let u=(a.items?a.items:[]).map(d=>{let p=this.bucket(d.id);return p.metadata=d,p}),c=a.nextPageToken?Object.assign({},i,{pageToken:a.nextPageToken}):null;o(null,u,c,a)})}getHmacKeys(t,n){let{options:i,callback:o}=Zw(t,n),s=Object.assign({},i),a=s.projectId||this.projectId;delete s.projectId,this.request({uri:`/projects/${a}/hmacKeys`,qs:s},(l,u)=>{if(l){o(l,null,null,u);return}let d=(u.items?u.items:[]).map(A=>{let f=this.hmacKey(A.accessId,{projectId:A.projectId});return f.metadata=A,f}),p=u.nextPageToken?Object.assign({},i,{pageToken:u.nextPageToken}):null;o(null,d,p,u)})}getServiceAccount(t,n){let{options:i,callback:o}=Zw(t,n);this.request({uri:`/projects/${this.projectId}/serviceAccount`,qs:i},(s,a)=>{if(s){o(s,null,a);return}let l={};for(let u in a)if(a.hasOwnProperty(u)){let c=u.replace(/_(\w)/g,(d,p)=>p.toUpperCase());l[c]=a[u]}o(null,l,a)})}hmacKey(t,n){if(!t)throw new Error(dwe.HMAC_ACCESS_ID);return new Fle(this,t,n)}};e_.Bucket=qN;e_.Channel=Lle;e_.File=zN;e_.HmacKey=Fle;e_.acl={OWNER_ROLE:"OWNER",READER_ROLE:"READER",WRITER_ROLE:"WRITER"};EPt.paginator.extend(e_,["getBuckets","getHmacKeys"]);(0,KAs.promisifyAll)(e_,{exclude:["bucket","channel","hmacKey"]});var On0=yt(Vse(),1);var wn0=yt(Vb(),1),XAs=yt(uCe(),1),_n0=yt(q4(),1);var $As=yt(iwe(),1);var In0,vn0,Sn0,Tn0=(0,$As.getPackageJSON)();var dGp=32*1024*1024,pGp=32*1024*1024,AGp=32*1024*1024;var ksn={UPLOAD_MANY:"tm.upload_many",DOWNLOAD_MANY:"tm.download_many",UPLOAD_SHARDED:"tm.upload_sharded",DOWNLOAD_SHARDED:"tm.download_sharded"};In0=new WeakSet,vn0=function(t={}){let n=!1,i=!1;for(let[o,s]of Object.entries(t))o.toLocaleLowerCase().trim()==="x-goog-api-client"?(n=!0,s.includes(ksn.UPLOAD_SHARDED)||(t[o]=`${s} gccl-gcs-cmd/${ksn.UPLOAD_SHARDED}`)):o.toLocaleLowerCase().trim()==="user-agent"&&(i=!0);return n||(t["x-goog-api-client"]=`${QN()} gccl/${Tn0.version} gccl-gcs-cmd/${ksn.UPLOAD_SHARDED}`),i||(t["User-Agent"]=LN()),t},Sn0=function(t,n){if(this.bucket.storage.retryOptions.autoRetry&&this.bucket.storage.retryOptions.retryableErrorFn(t))throw t;n(t)};cte();var Bn0=yt(msn());PS();qt();f1();var RVe=class{whereClauseDisjunctionLimits={in:30,"not-in":10,"array-contains-any":30};async selectInBatches(t,n,i,o,s){let a=[],l=this.whereClauseDisjunctionLimits[i];for(let u=0;u<o.length;u+=l){let c=o.slice(u,u+l),d=this.createQuery(t,{where:[...s,[n,i,c]]}),p=await this.runQuery(d);a.push(p)}return a.flat()}};var kGp=av.getTracer("repository");Hi();f1();var Rn0=500,Mn0=10*1024*1024,xn0=.7*Mn0,bPt=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=lut(t)+lut(n),o=this.requestSize+i>=xn0,s=this.batchSize+1>=Rn0;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 ua().info("committing batch!"),this.batchSize&&(this.batchesCommitted+=1,await this.firestoreOperations.commitBatch(this.batch)),this.batchesCommitted}};qt();var CPt=r=>r?r?.message??"":"",Dn0=r=>/(PERMISSION_DENIED)|(false for 'get')|(false for 'list')|(false for 'update')|(false for 'delete')|(Missing or insufficient permissions.)/.test(CPt(r)),Nn0=r=>/NOT_FOUND/.test(CPt(r)),MVe=r=>Dn0(r)?new D2("Permission denied",CPt(r)):Nn0(r)?new $s("Not found",CPt(r)):r,QB=async r=>{try{return await r}catch(t){throw MVe(t)}};var HX=class extends XP{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 QB(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}};var IPt=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)}};pr();Hi();KP();No();f1();var bo=class extends HX{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 QB(o.getQuery(s)):a=await QB(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 QB(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={...ca(n),id:i,createdAt:m6(),createdBy:s,updatedAt:m6(),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,u)=>{try{let c=this.transformDataFromStorage(u.doc.ref,u.doc.data(),o);l.push({type:u.type==="added"?"added":u.type==="removed"?"removed":"modified",value:c,id:c.id.toString(),hasPendingWrites:this.firestoreOperations.hasPendingWrites(u.doc)})}catch(c){i&&i(c)}return l},[]);ua().debug(`Listener notification for ${a.length} changes in collection ${this.path}`),n(a)},s=>{ua().error(`Firestore error listening to collection ${this.path}`,s),i&&i(MVe(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,o,s=[]){return(await this.firestoreOperations.selectInBatches(this.collectionRef,n,i,o,s)).map(u=>u.docs).flat().map(u=>this.transformDataFromStorage(u.ref,this.firestoreOperations.data(u)))}};No();qt();f1();m7();f1();var ZAs=async(r,t)=>{let{attempts:n,tags:i,waitSeconds:o}=t,s=ua().child({retryOptions:{maxAttempts:n,waitSeconds:o},tags:["[withRetries]",...i]});Np(n>=2,`Retry attempts value must be at least '2', but was '${n}'`,s);try{let a=await r();return s.info("Operation succeeded without retrying"),a}catch(a){s.error("Operation initial attempt failed; retrying. Error:",a);let l,u=n-1;do{u--,await new Promise(c=>setTimeout(c,o*(n-u)*1e3));try{let c=await r();return s.info(`Operation succeeded on retry (attempt ${n-u})`),c}catch(c){s.error(`Operation failed on retry (attempt ${n-u}). Error:`,c),l=c}}while(u);throw s.error("Exhausted all retry attempts; exiting"),l}};var Co=class extends HX{constructor(n,i,o,s,a,l,u=[]){super(n,i,u,s,a,l);this.docRef=i;this.dataTransform=o}get path(){return this.docRef.path}async fetch(n){let i=n?.transaction,o=i?()=>i.get(this.docRef):()=>this.firestoreOperations.getDoc(this.docRef,n),s=n?.retryOptions,l=await QB((s?()=>ZAs(o,{...s,tags:[...s.tags,"[FirestoreEntityRepository.fetch()]",`[${this.path}]`]}):o)());if(!l.exists)throw ua().info(`Document ${this.path} not found`),new $s(`Entity ${this.path} not found`);return this.dataTransform.fromStorage(this.id.toString(),this.path,this.firestoreOperations.data(l),this.firestoreOperations,n)}async save(n,i){let o=i?.transaction,s=this.prepareDataForSave(n,i);o?o.set(this.docRef,s):await QB(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 QB(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 QB(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{ua().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 ua().debug(`Listener notification for document ${this.path} removed`),n({type:"removed",id:a.id,hasPendingWrites:this.firestoreOperations.hasPendingWrites(a)})},a=>{ua().error(`Firestore error listening to document ${this.path}`,a),i&&i(MVe(a))})}prepareDataForSave(n,i){if(n.id&&n.id?.toString()!==this.docRef.id)throw new Qi(`Attempt to assign a new ID to entity ${this.path} `);let o=this.firestoreOperations.currentUser(),s=this.id.toString(),a={id:this.id,...ca(n),createdAt:n.createdAt??m6(),createdBy:n.createdBy??o,updatedAt:m6(),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 Qi(`Attempt to assign a new ID to entity ${this.path} `);let s={...ca(n),updatedAt:m6(),updatedBy:this.firestoreOperations.currentUser()};return this.dataTransform.mergeToStorage(this.id.toString(),this.path,s,this.firestoreOperations)}mergeWithDeletes(n,i){return tie(this.path,o=>o instanceof $te?[void 0,!0]:[o,!1],gGt(n,i))}};m1r();y1r();E1r();b1r();w1r();_1r();var Pn0=_.discriminatedUnion("type",[Gn.merge(Sn.merge(Im)),Gn.merge(Sn.merge(gut)),Gn.merge(Sn.merge(mut)),Gn.merge(Sn.merge(yut)),Gn.merge(Sn.merge(Eut)),Gn.merge(Sn.merge(vut)),Gn.merge(Sn.merge(Sut)),Gn.merge(Sn.merge(Out))]),kn0=Fi("Event",Pn0),efs=Vo(kn0),Qsn=class extends Co{constructor(t,n,i,o,s){super(t,n,efs,i,o,s)}},vPt=class extends bo{constructor(t,n,i,o){super(t,efs,n,i,o,Qsn)}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,u){let d={...this.createEventCore(t,"workspaces.nodeType.duplicate","NodeType",n,i,o,u),type:"duplicate",packageID:s,releaseID:a,workspaceID:l};return(await this.createEntity(d)).id}async createInstallPkgNodeTypeEvent(t,n,i,o,s,a){let u={...this.createEventCore(t,"workspaces.nodeType.install","NodeType",n,"",s,a),type:"install",packageID:n,releaseID:i,workspaceID:o};return(await this.createEntity(u)).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,u){let d={...this.createEventCore(t,"ai.description.columnDescriptions","AI","Description",n,n,u),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,u,c,d){let p=this.createEventCore(t,"workspaces.create.newWorkspace","NewWorkspace",i.toString(),c?.toString()??"",u,d),A=typeof s=="string"?new Date(s):s,f={...p,type:"create",projectID:n,stepNumber:o,startTime:A,endTime:a,status:l};return(await this.createEntity(f)).id}async createAINodeDescriptionTypeEvent(t,n,i,o,s,a){let u={...this.createEventCore(t,"ai.description.nodeDescription","AI",o,"",n,a),type:"update_node_description",workspaceID:i,nodeID:o,action:s};return(await this.createEntity(u)).id}async createAIGitCommitMessageRequestEvent(t,n,i,o,s,a,l){let c={...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(c)).id}async createAIGitCommitMessageActionEvent(t,n,i,o,s,a,l){let c={...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(c)).id}};Zn();var Qn0=Fi("Event",cai),tfs=Vo(Qn0),Lsn=class extends Co{constructor(t,n,i,o,s){super(t,n,tfs,i,o,s)}},SPt=class extends bo{constructor(t,n,i,o){super(t,tfs,n,i,o,Lsn)}};qt();Zn();Zn();df();Zn();var Ln0=Gn.merge(Poi),Fn0=Fi("GitAccount",Ln0),rfs=Vo(Fn0),Fsn=class extends Co{constructor(t,n,i,o,s){super(t,n,rfs,i,o,s)}},OPt=class extends bo{constructor(t,n,i,o){super(t,rfs,n,i,o,Fsn)}async generateID(t){return t.id??xs()}};df();Zn();var zn0=Gn.merge(bsi),qn0=Fi("ProjectGitAccount",zn0),nfs=Vo(qn0),zsn=class extends Co{constructor(t,n,i,o,s){super(t,n,nfs,i,o,s)}},wPt=class extends bo{constructor(t,n,i,o){super(t,nfs,n,i,o,zsn)}async generateID(t){return t.id??xs()}};var Un0=Gn.merge(Loi),jn0=Fi("GlobalUserSettings",Un0),ifs=Vo(jn0),qsn=class extends Co{constructor(t,n,i,o,s){super(t,n,ifs,i,o,s,["gitAccounts","projectGitAccounts"])}get gitAccounts(){return this.getSubCollection("gitAccounts",OPt)}gitAccount(t){return this.gitAccounts.get(t)}get projectGitAccounts(){return this.getSubCollection("projectGitAccounts",wPt)}projectGitAccount(t){return this.projectGitAccounts.get(t)}},_Pt=class extends bo{constructor(t,n,i,o){super(t,ifs,n,i,o,qsn)}listUsers(){return this.firestoreOperations.getChildren(this.collectionRef)}};df();Zn();var Wn0=Gn.merge(z1r),Gn0=Fi("Project",Wn0),ofs=Vo(Gn0),Usn=class extends Co{constructor(t,n,i,o,s){super(t,n,ofs,i,o,s)}},TPt=class extends bo{constructor(t,n,i,o){super(t,ofs,n,i,o,Usn)}async generateID(t){return t.id??xs()}};pr();qt();Zn();Ft();Zn();Ft();var Vn0=qe.FIREBASE,BPt=class extends pg{transformFromStorage(t,n,i){let o=i,s=[];return"endTime"in o&&(s.push("Removing property 'endTime'"),delete o.endTime),(!o.version||o.version<rfe)&&(s.push(`Updating version ${o.version} to ${rfe}`),o.version=rfe),o.runDetails&&!o.runDetails.environmentID&&("toWorkspaceID"in o.runDetails&&o.runDetails.toWorkspaceID!=null?(s.push(`Found runDetails.toWorkspaceID with value ${o.runDetails.toWorkspaceID}; setting to runDetails.environmentID`),o.runDetails.environmentID=o.runDetails.toWorkspaceID.toString()):(s.push('Setting missing runDetails.environmentID to "0"'),o.runDetails.environmentID="0")),o.runDetails&&"toWorkspaceID"in o.runDetails&&(s.push("Deleting runDetails.toWorkspaceID"),delete o.runDetails.toWorkspaceID),Vn0.debug(`Patched run ${n}`,s),o}};Zn();Ft();var Hn0=qe.FIREBASE,RPt=class extends pg{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 ${JV.toISOString} for query result ${a}`),s.startTime=JV),s.endTime||(o.push(`Setting 'endTime' to ${JV.toISOString} for query result ${a}`),s.endTime=JV),s.fields?.map((l,u)=>{o.push(`Setting 'type' to 'unknown' for field ${u} 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&&Hn0.debug(`Patched run result ${n}`,o),i}};var Kn0=Gn.merge(Dut),Yn0=Fi("QueryResult",Kn0),DPt=Vo(Yn0),jsn=class extends Co{constructor(t,n,i,o,s){super(t,n,DPt,i,o,s)}},Wsn=class extends bo{constructor(t,n,i,o){super(t,DPt,n,i,o,jsn)}},Gsn=class extends Co{constructor(t,n,i,o,s){super(t,n,DPt,i,o,s)}},Vsn=class extends bo{constructor(t,n,i,o){super(t,DPt,n,i,o,Gsn)}},Jn0=Gn.merge(Put),Xn0=Fi("RunResult",Jn0),NPt=Vo(Xn0,new RPt),Hsn=class extends Co{constructor(t,n,i,o,s){super(t,n,NPt,i,o,s,["queryResults"])}get queryResults(){return this.getSubCollection("queryResults",Wsn)}queryResult(t){return this.queryResults.get(t)}},MPt=class extends bo{constructor(t,n,i,o){super(t,NPt,n,i,o,Hsn)}},Ksn=class extends Co{constructor(t,n,i,o,s){super(t,n,NPt,i,o,s,["queryResults"])}get queryResults(){return this.getSubCollection("queryResults",Vsn)}queryResult(t){return this.queryResults.get(t)}},xPt=class extends bo{constructor(t,n,i,o){super(t,NPt,n,i,o,Ksn)}};var PPt=(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 KX=qe.FIREBASE,$n0=_.discriminatedUnion("runType",[Gn.merge(Z1r),Gn.merge(eAr),Gn.merge(tAr)]),Zn0=Fi("Run",$n0),LPt=Vo(Zn0,new BPt,!0),Ysn=class extends Co{constructor(t,n,i,o,s){super(t,n,LPt,i,{...o,runID:t},s,["runResults"])}get runResults(){return this.getSubCollection("runResults",MPt)}runResult(t){return this.runResults.get(t)}async updateHeartbeat(t={},n){return this.merge({...t,runHeartbeat:m6()},n)}},kPt=class extends bo{constructor(t,n,i,o){super(t,LPt,n,i,o,Ysn)}async createDeployRun(t,n){let i=PPt(t.runDetails.environmentID,Qi,this.logContext),o={...this.logContext,environmentID:i},s=(u,c)=>(SSr(u,"deploy",t.runDetails.forcedDeployment,o),{status:"Deploying",currentlyRunningJobs:u.currentlyRunningJobs?u.currentlyRunningJobs.concat(c):[c]}),a={...t,runDetails:{...t.runDetails}};if(delete a.runDetails.fromWorkspaceData,a.runDetails.version===2)for(let u of Lsi)delete a.runDetails[u];else for(let u of ksi)delete a.runDetails[u];let l=await Xsn(this,i,a,s,n);return u1e(o,l.id),KX.infoContext(o,"FirestoreOrgRepo createDeployRun: finished securing workspace"),l}async createRefreshRun(t,n){let i=PPt(t.runDetails.environmentID,Qi,this.logContext),o={...this.logContext,environmentID:i},a=await Xsn(this,i,t,(l,u)=>(SSr(l,"refresh",t.runDetails.forceIgnoreWorkspaceStatus,o),{status:l.status==="Failed Deploy"?l.status:"Refreshing",currentlyRunningJobs:l.currentlyRunningJobs?l.currentlyRunningJobs.concat(u):[u]}),n);return u1e(o,a.id),KX.infoContext(o,"FirestoreOrgRepo createRefreshRun: finished securing workspace"),a}},Jsn=class extends Co{constructor(t,n,i,o,s){super(t,n,LPt,i,{...o,runID:t},s,["runResults"])}get runResults(){return this.getSubCollection("runResults",xPt)}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)}},QPt=class extends bo{constructor(t,n,i,o){super(t,LPt,n,i,o,Jsn)}async createDevRun(t){let n=PPt(t.runDetails.environmentID,Qi,this.logContext),i={...this.logContext,environmentID:n},o=(a,l)=>{if(!a.devEnv)throw new Qi(`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 Xsn(this,n,t,o);return u1e(i,s.id),KX.infoContext(i,"FirestoreOrgRepo createDevRun: finished securing workspace"),s}},Xsn=(r,t,n,i,o)=>{let s=r.parent.workspace(t),a={...r.logContext,environmentID:t};return r.runTransaction(o,async l=>{KX.infoContext(a,"securing workspace status");let[u,c]=await Promise.all([s.fetch(l),r.parent.getNextCounter(r.id.substring(0,r.id.length-1),1,l)]);u1e(a,c),KX.infoContext(a,"got workspace doc data, updating workspace",{status:u?.status,jobs:u?.currentlyRunningJobs});let d=()=>{try{return i(u,c)}catch(f){if(KX.errorContext(a,"createRun: error updating workspace",{error:f}),f instanceof MV){let h=f.detail??`${u.name} is in state ${u.status},`;throw new N2(f.message,h+` context=${JSON.stringify(a)}.`)}throw f}};await s.merge(d(),l),KX.infoContext(a,`Run ${c} will use the following mappings:`,u.mappingsV1),KX.infoContext(a,"reserving run");let p=await r.prepareDataForCreate(n,c);p.runStartTime=r.firestoreOperations.getServerTimestampSentinel(),p.runHeartbeat=r.firestoreOperations.getServerTimestampSentinel();let A=r.get(c);return l.transaction.set(A.docRef,p),A})};Zn();Zn();var ei0=Gn.merge(n8),ti0=Fi("Macro",ei0),sfs=Vo(ti0,void 0,!0),$sn=class extends Co{constructor(t,n,i,o,s){super(t,n,sfs,i,o,s)}},FPt=class extends bo{constructor(t,n,i,o){super(t,sfs,n,i,o,$sn)}};Zn();var ri0=Gn.merge(XAe),ni0=Fi("NodeType",ri0),afs=Vo(ni0),Zsn=class extends Co{constructor(t,n,i,o,s){super(t,n,afs,i,o,s)}},zPt=class extends bo{constructor(t,n,i,o){super(t,afs,n,i,o,Zsn)}async generateID(t){return t.id??(await this.parent.parent.getNextCounter("template")).toString()}};df();pr();Hi();Zn();qt();var ii0=_.discriminatedUnion("type",[Gn.merge(Sn.merge(e8)),Gn.merge(Sn.merge(t8))]),oi0=Fi("Node",ii0),lfs=Vo(oi0,new i3t),ean=class extends Co{constructor(t,n,i,o,s){super(t,n,lfs,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)}},qPt=class extends bo{constructor(t,n,i,o){super(t,lfs,n,i,o,ean)}async generateID(t){return t.id??xs()}listenCollection(t,n,i){throw new Vl("The firestore nodes repository listener is not implemented. Use listenCollectionOverride")}listenCollectionOverride(t,n,i,o,s){let[a,l]=this.getListenCallbacks(t,o,s),u=this.firestoreOperations.onCollectionSnapshot(this.collectionRef.orderBy("updatedAt").startAfter(n),a,l),c=p=>{let f=[...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 O=new Date(C.updatedAt),w=y.deletedAt?y.deletedAt.toDate():O;return O<=w}else return!0;return!1}).map(h=>({type:"removed",value:{id:h.doc.id},id:h.doc.id,hasPendingWrites:!1}));t(f)},d=this.firestoreOperations.onCollectionSnapshot(this.collectionRef.parent.collection("deletedSteps").orderBy("deletedAt").startAfter(n),c,l);return()=>{u(),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=xoi.verify({operation:{...o.data()}});i[o.id]=s}),i}};qt();Zn();var si0=Gn.merge(Jte),ai0=Fi("Subgraph",si0),cfs=Vo(ai0),tan=class extends Co{constructor(t,n,i,o,s){super(t,n,cfs,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 N2(`${n.uniquenessConstraints.field} must be unique`);let a=this.prepareDataForMerge(t,n);return i.transaction.update(this.docRef,a)}):super.fetchAndMerge(t,n)}},UPt=class extends bo{constructor(t,n,i,o){super(t,cfs,n,i,o,tan)}async generateID(t){return t.id??(await this.parent.parent.getNextCounter("subgraph")).toString()}async createEntity(t,n){let i=await this.generateID(t);return n?.uniquenessConstraints?this.runTransaction(n,async o=>{if((await this.select({where:[[n.uniquenessConstraints.field,"in",n.uniquenessConstraints.values]]},o)).length>0)throw new N2(`${n.uniquenessConstraints.field} must be unique`);return super.createEntity({...t,id:i,folderCounter:i},o)}):super.createEntity({...t,id:i,folderCounter:i},n)}};pr();Zn();Ft();var li0=qe.FIREBASE,jPt=class extends pg{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&&li0.debug(`Patched workspace user ${n}`,o),i}};var ci0=_.union([Gn.merge(tDe),Gn.merge(rDe),Gn.merge(nDe)]),ui0=Fi("WorkspaceUser",ci0),ufs=Vo(ui0,new jPt),ran=class extends Co{constructor(t,n,i,o,s){super(t,n,ufs,i,o,s)}},WPt=class extends bo{constructor(t,n,i,o){super(t,ufs,n,i,o,ran)}};Ft();Zn();var di0=qe.FIREBASE,GPt=class extends pg{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 '${jAe}'`),o.version=jAe),o.tagColors||(s.push("Setting missing 'tagColors' property to default"),o.tagColors={backgroundColor:Ivr,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&&di0.debug(`Patched workspace ${n}:`,s),o}};qt();Zn();var pi0=Gn.merge(r8),Ai0=Fi("Job",pi0),dfs=Vo(Ai0),nan=class extends Co{constructor(t,n,i,o,s){super(t,n,dfs,i,o,s)}async fetchAndMerge(t,n){return n?.uniquenessConstraints?this.runTransaction(n,async i=>{let o=await this.fetch(i);if(o.name!==t.name&&(await this.parent.jobs.select({where:[[n.uniquenessConstraints.field,"in",n.uniquenessConstraints.values]]},i)).length>0)throw new N2(`${n.uniquenessConstraints.field} must be unique`);return super.save(super.mergeWithDeletes(o,t),i)}):super.fetchAndMerge(t,n)}},VPt=class extends bo{constructor(t,n,i,o){super(t,dfs,n,i,o,nan)}async generateID(t){return t.id??this.parent.parent.getNextCounter("job")}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 N2(`${n.uniquenessConstraints.field} must be unique`);return await super.createEntity(t,i)}):super.createEntity(t,n)}};Zn();var fi0=Gn.merge($Ae),hi0=Fi("InstalledPackage",fi0),pfs=Vo(hi0),ian=class extends Co{constructor(t,n,i,o,s){super(t,n,pfs,i,o,s)}},HPt=class extends bo{constructor(t,n,i,o){super(t,pfs,n,i,o,ian)}};df();uAr();var gi0=Gn.merge(lai),mi0=Fi("NodeLastRefreshed",gi0),Afs=Vo(mi0,void 0,!0),oan=class extends Co{constructor(t,n,i,o,s){super(t,n,Afs,i,{...o,nodeID:t},s)}},KPt=class extends bo{constructor(t,n,i,o){super(t,Afs,n,i,o,oan)}async generateID(t){return t.id??xs()}};var yi0=Gn.merge(put),Ei0=Fi("Workspace",yi0),ffs=Vo(Ei0,new GPt,!0),san=class extends Co{constructor(t,n,i,o,s){super(t,n,ffs,i,o,s,["jobs","macros","nodes","nodeTypes","subgraphs","users","installedPackages","nodesLastRefreshed"])}get installedPackages(){return this.getSubCollection("installedPackages",HPt)}installedPackage(t){return this.installedPackages.get(t)}get jobs(){return this.getSubCollection("jobs",VPt)}job(t){return this.jobs.get(t)}get macros(){return this.getSubCollection("macros",FPt)}macro(t){return this.macros.get(t)}get nodes(){return this.getSubCollection("steps",qPt)}node(t){return this.nodes.get(t)}get nodesLastRefreshed(){return this.getSubCollection("nodesLastRefreshed",KPt)}nodeLastRefreshed(t){return this.nodesLastRefreshed.get(t)}get nodeTypes(){return this.getSubCollection("templates",zPt)}nodeType(t){return this.nodeTypes.get(t)}get subgraphs(){return this.getSubCollection("folders",UPt)}subgraph(t){return this.subgraphs.get(t)}get users(){return this.getSubCollection("users",WPt)}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 c=[...l.docs].map(d=>({docRef:d.ref}));for(let d of c)await a.delete(d,{});await a.commit(),process.nextTick(()=>{i(o,s)})}catch(a){s(a)}};return new Promise((o,s)=>i(o,s))}},YPt=class extends bo{constructor(t,n,i,o){super(t,ffs,n,i,o,san)}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())}};Ft();var bi0=qe.FIREBASE,JPt=class extends pg{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&&bi0.debug(`Patched org ${n}`,o),i}};No();qt();Zn();Ft();Ft();var Ci0=qe.FIREBASE,XPt=class extends pg{transformFromStorage(t,n,i){let o=i,s=[];o.projects||(o.projects={},s.push("Changing userRoles.projects from undefined to empty object"));let a=(l,u,c,d)=>{let p=u.indexOf(c);p>=0&&(s.push(`Changing ${l} role '${c}' to '${d}'`),u[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 u of Object.values(l?.environments))u.environmentRoles?a("env",u.environmentRoles,"owner","admin"):(u.environmentRoles=[],s.push("Changing env.environmentRoles from undefined to empty array"))}return s.length>0&&Ci0.debug(`Patched userRoles ${n}`,s),i}};var zle=qe.USER_MANAGEMENT,Ii0=Gn.merge(tai),vi0=Fi("UserRoles",Ii0),hfs=Vo(vi0,new XPt),aan=class extends Co{constructor(t,n,i,o,s){super(t,n,hfs,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 u=ca(s.projects[n]);return Object.values(t.environments).forEach(c=>{t.projectRoles.includes("member")?c.environmentRoles=[]:t.projectRoles.includes("admin")?c.environmentRoles=["admin"]:c.environmentRoles=["reader"]}),s.projects[n]=t,await this.save(s,o),zle.infoContext(this.logContext,`User project roles updated for user ${s.id} at project ${n}. Previous roles:`,u,"New roles:",s.projects[n]),s})}async upsertProjectRole(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!=="admin"&&await this.throwIfLastProjectAdmin(n,o);let u=ca(s.projects[n]),c=s.projects[n];return c?c.projectRoles=[t]:s.projects[n]={projectRoles:[t],environments:{}},await this.save(s,o),zle.infoContext(this.logContext,`User project roles updated for user ${s.id} at project ${n}. Previous roles:`,u,"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(c){if(rd(c)&&(c instanceof $s||c instanceof D2))o={id:this.id,organizationRoles:[],projects:{}};else throw c}let s=o.organizationRoles.includes("admin"),a=t.includes("admin");s&&!a&&await this.throwIfLastOrgAdmin(i);let u=ca(o.organizationRoles);return o.organizationRoles=t,await this.save(o,i),zle.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 $s(`Environment ${i} not found`);let l=await this.fetch(s);if(!l.projects[n]?.projectRoles.length)throw new D2("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=ca(l.projects[n].environments[i]);return l.projects[n].environments[i]=t,await this.save(l,s),zle.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 upsertEnvironmentRole(t,n,i,o,s){return await this.runTransaction(s,async a=>{let l=await this.parent.workspace(i).fetch(a);if(l.project!==n||l.devEnv)throw new $s(`Environment ${i} not found`);let u=await this.fetch(a);if((u.projects[n]?.environments[i]?.environmentRoles.includes("admin")??!1)&&t!=="admin"&&await this.throwIfLastEnvironmentAdmin(n,i,a),!u.projects[n]?.projectRoles.length)if(o?.setDefaultProjectRole)u.projects[n]?u.projects[n].projectRoles=[o.setDefaultProjectRole]:u.projects[n]={projectRoles:[o.setDefaultProjectRole],environments:{}};else throw new D2("User must have a project role before being granted any environment roles therein");let p=ca(u.projects[n].environments[i]),A=u.projects[n].environments[i];return A?A.environmentRoles=[t]:u.projects[n].environments[i]={environmentRoles:[t]},await this.save(u,a),zle.infoContext(this.logContext,`User env roles updated for user ${u.id} at envID ${i} in project ${n}. Previous roles:`,p,"New roles:",u.projects[n].environments[i]),u})}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=ca(o.projects[t]);delete o.projects[t],await this.save(o,i),zle.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=ca(s.projects[t].environments[n]);delete s.projects[t].environments[n],await this.save(s,o),zle.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 N2("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 N2("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 N2("Role change failed, at least one environment admin is required")})}},$Pt=class extends bo{constructor(t,n,i,o){super(t,hfs,n,i,o,aan)}};var Si0=Gn.merge(xut),Oi0=Fi("Org",Si0),gfs=Vo(Oi0,new JPt),wi0={gitRepo:"gitRepo",workspace:"workspace",job:"job",subgraph:"folder",location:"location",connection:"connection",template:"template",run:"run",devRun:"devRun"},lan=class extends Co{constructor(t,n,i,o,s){super(t,n,gfs,i,{...o,orgID:t},s,["devRuns","globalUsersSettings","projects","runs","userRoles","workspaces"])}get devRuns(){return this.getSubCollection("devRuns",QPt)}devRun(t){return this.devRuns.get(t)}get globalUsersSettings(){return this.getSubCollection("globalUsersSettings",_Pt)}globalUsersSetting(t){return this.globalUsersSettings.get(t)}get projects(){return this.getSubCollection("projects",TPt)}project(t){return this.projects.get(t)}get runs(){return this.getSubCollection("runs",kPt)}run(t){return this.runs.get(t)}get userRoles(){return this.getSubCollection("userRoles",$Pt)}userRole(t){return this.userRoles.get(t)}get workspaces(){return this.getSubCollection("workspaces",YPt)}workspace(t){return this.workspaces.get(t)}async getNextCounter(t,n=1,i){if(!n||n<=0)throw new X$(`getNextCounter() expected reserveCount value greater than zero, received ${n}`);let o=wi0[t];if(!o)throw new X$(`getNextCounter() received unsupported counter name '${t}'`);return this.runTransaction(i,async s=>{let a=await this.fetch(s),l=`${o}Counter`,u=l in a?a[l]??0:0;return await this.merge({[l]:u+n},s),u+1})}async releaseWorkspaceStatusAndEndRun(t,n,i,o,s,a){return this.runTransaction(a,async l=>{let u=this.workspace(t),c=await u.fetch(l),{newStatus:d,remainingActiveRuns:p}=await o();c.status=d??c.status,i==="run"?c.currentlyRunningJobs=p:c.currentlyRunningDevJobs=p,await u.save(c,l);let A=this[i](n);return l.transaction.update(A.docRef,{...A.prepareDataForMerge(s,l),runEndTime:this.firestoreOperations.getServerTimestampSentinel()}),c.status})}async updateLastLoginTime(){let t=this.prepareDataForMerge({});t.lastLoginTime=this.firestoreOperations.getServerTimestampSentinel(),await this.firestoreOperations.updateDoc(this.docRef,t)}},ZPt=class extends bo{constructor(t,n,i,o){super(t,gfs,n,i,o,lan)}};Zn();var _i0=Gn.merge(hsi),Ti0=Fi("OrgPublic",_i0),mfs=Vo(Ti0),can=class extends Co{constructor(t,n,i,o,s){super(t,n,mfs,i,{...o,orgID:t},s)}},ekt=class extends bo{constructor(t,n,i,o){super(t,mfs,n,i,o,can)}};Zn();Zn();var Bi0=Gn.merge(Aut),Ri0=Fi("RegistryPackageRelease",Bi0),yfs=Vo(Ri0),uan=class extends Co{constructor(t,n,i,o,s){super(t,n,yfs,i,o,s)}},tkt=class extends bo{constructor(t,n,i,o){super(t,yfs,n,i,o,uan)}};var Mi0=Gn.merge(fut),xi0=Fi("RegistryPackage",Mi0),Efs=Vo(xi0),dan=class extends Co{constructor(t,n,i,o,s){super(t,n,Efs,i,o,s,["releases"])}get releases(){return this.getSubCollection("releases",tkt)}release(t){return this.releases.get(t)}},rkt=class extends bo{constructor(t,n,i,o){super(t,Efs,n,i,o,dan)}};Zn();var Di0=Gn.merge(oai),Ni0=Fi("ActivePrompt",Di0),bfs=Vo(Ni0),Pi0=Gn.merge(sai),ki0=Fi("PromptVersion",Pi0),Cfs=Vo(ki0),pan=class extends Co{constructor(t,n,i,o,s){super(t,n,bfs,i,{...o,nodeID:t},s)}},Aan=class extends Co{constructor(t,n,i,o,s){super(t,n,Cfs,i,{...o,nodeID:t},s)}},nkt=class extends bo{constructor(t,n,i,o){super(t,bfs,n,i,o,pan)}},ikt=class extends bo{constructor(t,n,i,o){super(t,Cfs,n,i,o,Aan)}};Zn();Ft();var Qi0=qe.FIREBASE,okt=class extends pg{transformFromStorage(t,n,i){return i.accountType||(Qi0.debug(`Patched user ${n}: Setting accountType to 'normal'`),i.accountType="normal"),i}};var Li0=Gn.merge(lAr),Fi0=Fi("User",Li0),Ifs=Vo(Fi0,new okt),fan=class extends Co{constructor(t,n,i,o,s){super(t,n,Ifs,i,o,s)}},skt=class extends bo{constructor(t,n,i,o){super(t,Ifs,n,i,o,fan)}};var akt=class extends HX{constructor(t){super("root",t.db,["orgs","users","packagesRegistry","events"],void 0,t.currentLogContext(),t)}get path(){return""}get orgs(){return this.getSubCollection("orgs",ZPt)}org(t){return this.orgs.get(t)}get orgsPublic(){return this.getSubCollection("orgsPublic",ekt)}orgPublic(t){return this.orgsPublic.get(t)}get users(){return this.getSubCollection("users",skt)}user(t){return this.users.get(t)}get packagesRegistry(){return this.getSubCollection("packagesRegistry",rkt)}registryPackage(t){return this.packagesRegistry.get(t)}get events(){return this.getSubCollection("events",vPt)}event(t){return this.events.get(t)}get oauthStates(){return this.getSubCollection("oauthState",SPt)}oauthState(t){return this.oauthStates.get(t)}get activePrompts(){return this.getSubCollection("activePrompts",nkt)}activePrompt(t){return this.activePrompts.get(t)}get promptVersions(){return this.getSubCollection("promptVersions",ikt)}promptVersion(t){return this.promptVersions.get(t)}batch(){return new bPt(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)return;o=void 0}}return i||o||this}storage(){return new IPt(this.firestoreOperations)}};qt();var zi0=["run","runs","devRun","devRuns"],qi0=["createEntity","save","delete","merge","fetchAndMerge","mergeMetadata"],qle=class r{providers;flaggedRepositoryParent;constructor(t,n,i,o,s){return this.providers=n,this.flaggedRepositoryParent=t,new Proxy(this,{get:(a,l)=>{if(l==="flaggedRepositoryParent")return t;if(l==="providers")return n;if(zi0.includes(l))return this.providers.firebase[l];if(l==="batch"&&t.id==="root")return s;let{providerId:u,shouldMutateBoth:c}=o(l,i);if(!(u in this.providers))throw new Ye("[FLAGGED_REPOSITORY] Attempted to access a flagged repository implementation that is not configured.",`Provider ID: ${u}`);let d=a.providers[u]?.[l];if(d instanceof XP){let p=Object.fromEntries(Object.entries(this.providers).map(([A,f])=>[A,f?.[l]]));return new r(d,p,{...i},o,s)}return typeof d=="function"?(...p)=>{let A=t?.[l],f=d,h=this.providers.firebase?.[l],y=this.providers.service?.[l],C=A||f,O={};if(c&&l==="createEntity"){let Q=t.generateID?.(p[0]);O.generateID=()=>Q}let w=A?.bind(Object.assign(t,O)),T=f?.bind(Object.assign(a.providers[u],O)),R=h?.bind(Object.assign(this.providers.firebase,O)),P=y?.bind(Object.assign(this.providers.service,O)),q=(w||T)?.(...p);if(q instanceof Promise&&(q=new Promise((Q,Y)=>{let j=q,k=[j];qi0.includes(l)&&c&&(C===h?k.push(P?.(...p)):k.push(R?.(...p))),Promise.allSettled(k).then(()=>{j.then(Q).catch(Y)}).catch(()=>{console.error("Promise allSettled failed unexpectedly")})})),!(q instanceof XP))return q;let H=Object.fromEntries(Object.entries(this.providers).map(([Q,Y])=>[Q,Y?.[l]?.bind(Y)?.(...p)])),V=i.orgId;l==="org"&&(V=p[0]),l==="get"&&t.id==="orgs"&&(V=p[0]);let U=l==="get"?q:T?.(...p);return new r(U,H,{...i,orgId:V},o,s)}:t[l]}})}},vfs=(r,t,n,i)=>new qle(r,t,{},n,i);No();qt();bm();var XE=class extends XP{constructor(n,i,o,s,a,l){super(n);this.id=n;this.collectionName=i;this.subCollectionNames=o;this.parent=s;this.logContext=a;this.serviceOperations=l}subCollections=[];async getToken(){return this.serviceOperations.getToken()}getSubCollection(n,i){let o=this.subCollections[n];return o||(o=new i(this,this.serviceOperations,this.logContext),this.subCollections[n]=o),o}};var Hg=class extends XE{constructor(n,i,o,s,a,l=[],u){super(n,i,l,s,a,u);this.dataTransform=o}async addAuthHeader(n={}){let i=await this.getToken();return i&&(n.Authorization=`Bearer ${i}`),n}get path(){return`${this.parent.path}/${this.collectionName}/${this.id}`}async fetch(n){let i=await this.addAuthHeader({}),s=(await(await hd).get(`${this.serviceOperations.hostname}${this.baseUri}/${this.id}`,{headers:i})).data;return this.dataTransform.fromStorage(this.id.toString(),this.path,s,n)}async save(n,i){let o=await this.addAuthHeader(),s=this.dataTransform.toStorage(this.id.toString(),this.path,n,i);await(await hd).put(`${this.serviceOperations.hostname}${this.baseUri}/${this.id}`,s,{headers:o})}async merge(n,i){let o=Object.entries(n).reduce((s,[a,l])=>(iTe(s,a,l),s),{});await this.fetchAndMerge(o,i)}async fetchAndMerge(n,i){let o=await this.addAuthHeader(),s=this.dataTransform.mergeToStorage(String(this.id),this.path,n,i);await(await hd).patch(`${this.serviceOperations.hostname}${this.baseUri}/${this.id}`,this.mapDataToPatchPayload(s),{headers:o})}async delete(){let n=await this.addAuthHeader({});await(await hd).delete(`${this.serviceOperations.hostname}${this.baseUri}/${this.id}`,{headers:n})}listen(){throw new Vl}mapDataToPatchPayload(n){let i=this.flattenToPaths(n);return Object.entries(i).reduce((s,[a,l])=>(l===Vut()?iTe(s.delete,a,!0):iTe(s.update,a,l),s),{update:{id:this.id},delete:{}})}flattenToPaths(n){let i={};function o(s,a){nTe(s,(l,u)=>{let c=a?`${a}.${u}`:u;Lu(l)&&!Array.isArray(l)?o(l,c):i[c]=l})}return o(n,""),i}};qt();No();var han=r=>r instanceof Hg,lkt=class{batches={save:{},merge:{},delete:{}};async save(t,n){if(!han(t))throw new Ye("Entity must be a ServiceEntityRepository for batch writes");let i=t.getCollection(),o=i.id,s=this.batches.save[o];s?s.data.push(t.dataTransform.toStorage(t.id,t.path,n)):this.batches.save[o]={collection:i,data:[n]}}async merge(t,n){if(!han(t))throw new Ye("Entity must be a ServiceEntityRepository for batch writes");let i=t.getCollection(),o=i.id,s=this.batches.merge[o];s?s.data.push(t.dataTransform.mergeToStorage(t.id,t.path,n)):this.batches.merge[o]={collection:i,data:[n]}}async delete(t){if(!han(t))throw new Ye("Entity must be a ServiceEntityRepository for batch writes");let n=t.getCollection(),i=n.id,o=this.batches.delete[i],s={id:t.id};o?o.data.push(s):this.batches.delete[i]={collection:n,data:[s]}}async commit(){let t=0;return await Promise.allSettled(Object.values(this.batches.delete).map(async n=>{for(let i of X6e(n.data,1e3))await n.collection.bulkDelete(i),t+=i.length})),await Promise.allSettled(Object.values(this.batches.merge).map(async n=>{for(let i of X6e(n.data,1e3))await n.collection.bulkUpdate(i),t+=i.length})),await Promise.allSettled(Object.values(this.batches.save).map(async n=>{for(let i of X6e(n.data,1e3))await n.collection.bulkSave(i),t+=i.length})),t}};Zn();kn();No();var Ian=yt(wfs(),1);var LB=Object.create(null);LB.open="0";LB.close="1";LB.ping="2";LB.pong="3";LB.message="4";LB.upgrade="5";LB.noop="6";var xVe=Object.create(null);Object.keys(LB).forEach(r=>{xVe[LB[r]]=r});var DVe={type:"error",data:"parser error"};var NVe=({type:r,data:t},n,i)=>t instanceof ArrayBuffer||ArrayBuffer.isView(t)?i(n?t:"b"+_fs(t,!0).toString("base64")):i(LB[r]+(t||"")),_fs=(r,t)=>Buffer.isBuffer(r)||r instanceof Uint8Array&&!t?r:r instanceof ArrayBuffer?Buffer.from(r):Buffer.from(r.buffer,r.byteOffset,r.byteLength),man;function Tfs(r,t){if(r.data instanceof ArrayBuffer||ArrayBuffer.isView(r.data))return t(_fs(r.data,!1));NVe(r,!0,n=>{man||(man=new TextEncoder),t(man.encode(n))})}var PVe=(r,t)=>{if(typeof r!="string")return{type:"message",data:Bfs(r,t)};let n=r.charAt(0);if(n==="b"){let i=Buffer.from(r.substring(1),"base64");return{type:"message",data:Bfs(i,t)}}return xVe[n]?r.length>1?{type:xVe[n],data:r.substring(1)}:{type:xVe[n]}:DVe},Bfs=(r,t)=>{switch(t){case"arraybuffer":return r instanceof ArrayBuffer?r:Buffer.isBuffer(r)?r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength):r.buffer;case"nodebuffer":default:return Buffer.isBuffer(r)?r:Buffer.from(r)}};var Rfs="",Mfs=(r,t)=>{let n=r.length,i=new Array(n),o=0;r.forEach((s,a)=>{NVe(s,!1,l=>{i[a]=l,++o===n&&t(i.join(Rfs))})})},xfs=(r,t)=>{let n=r.split(Rfs),i=[];for(let o=0;o<n.length;o++){let s=PVe(n[o],t);if(i.push(s),s.type==="error")break}return i};function Dfs(){return new TransformStream({transform(r,t){Tfs(r,n=>{let i=n.length,o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);let s=new DataView(o.buffer);s.setUint8(0,126),s.setUint16(1,i)}else{o=new Uint8Array(9);let s=new DataView(o.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}var yan;function ckt(r){return r.reduce((t,n)=>t+n.length,0)}function ukt(r,t){if(r[0].length===t)return r.shift();let n=new Uint8Array(t),i=0;for(let o=0;o<t;o++)n[o]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),n}function Nfs(r,t){yan||(yan=new TextDecoder);let n=[],i=0,o=-1,s=!1;return new TransformStream({transform(a,l){for(n.push(a);;){if(i===0){if(ckt(n)<1)break;let u=ukt(n,1);s=(u[0]&128)===128,o=u[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(ckt(n)<2)break;let u=ukt(n,2);o=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),i=3}else if(i===2){if(ckt(n)<8)break;let u=ukt(n,8),c=new DataView(u.buffer,u.byteOffset,u.length),d=c.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(DVe);break}o=d*Math.pow(2,32)+c.getUint32(4),i=3}else{if(ckt(n)<o)break;let u=ukt(n,o);l.enqueue(PVe(s?u:yan.decode(u),t)),i=0}if(o===0||o>r){l.enqueue(DVe);break}}}})}var Ean=4;var qfs=yt(Ule(),1);var lF=process.nextTick,ZE=global,kfs="nodebuffer";function Qfs(){return new ban}function Wi0(r){let t=r.split("; "),n=t[0].indexOf("=");if(n===-1)return;let i=t[0].substring(0,n).trim();if(!i.length)return;let o=t[0].substring(n+1).trim();o.charCodeAt(0)===34&&(o=o.slice(1,-1));let s={name:i,value:o};for(let a=1;a<t.length;a++){let l=t[a].split("=");if(l.length!==2)continue;let u=l[0].trim(),c=l[1].trim();switch(u){case"Expires":s.expires=new Date(c);break;case"Max-Age":let d=new Date;d.setUTCSeconds(d.getUTCSeconds()+parseInt(c,10)),s.expires=d;break;default:}}return s}var ban=class{constructor(){this._cookies=new Map}parseCookies(t){t&&t.forEach(n=>{let i=Wi0(n);i&&this._cookies.set(i.name,i)})}get cookies(){let t=Date.now();return this._cookies.forEach((n,i)=>{var o;((o=n.expires)===null||o===void 0?void 0:o.getTime())<t&&this._cookies.delete(i)}),this._cookies.entries()}addCookies(t){let n=[];for(let[i,o]of this.cookies)n.push(`${i}=${o.value}`);n.length&&(t.setDisableHeaderCheck(!0),t.setRequestHeader("cookie",n.join("; ")))}appendCookies(t){for(let[n,i]of this.cookies)t.append("cookie",`${n}=${i.value}`)}};function dkt(r,...t){return t.reduce((n,i)=>(r.hasOwnProperty(i)&&(n[i]=r[i]),n),{})}var Gi0=ZE.setTimeout,Vi0=ZE.clearTimeout;function cF(r,t){t.useNativeTimers?(r.setTimeoutFn=Gi0.bind(ZE),r.clearTimeoutFn=Vi0.bind(ZE)):(r.setTimeoutFn=ZE.setTimeout.bind(ZE),r.clearTimeoutFn=ZE.clearTimeout.bind(ZE))}var Hi0=1.33;function Lfs(r){return typeof r=="string"?Ki0(r):Math.ceil((r.byteLength||r.size)*Hi0)}function Ki0(r){let t=0,n=0;for(let i=0,o=r.length;i<o;i++)t=r.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}function pkt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ffs(r){let t="";for(let n in r)r.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(r[n]));return t}function zfs(r){let t={},n=r.split("&");for(let i=0,o=n.length;i<o;i++){let s=n[i].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}var Ufs=yt(FI(),1),Yi0=(0,Ufs.default)("engine.io-client:transport"),Akt=class extends Error{constructor(t,n,i){super(t),this.description=n,this.context=i,this.type="TransportError"}},uF=class extends qfs.Emitter{constructor(t){super(),this.writable=!1,cF(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,i){return super.emitReserved("error",new Akt(t,n,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"?this.write(t):Yi0("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let n=PVe(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){let t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){let n=Ffs(t);return n.length?"?"+n:""}};var jfs=yt(FI(),1),FB=(0,jfs.default)("engine.io-client:polling"),kVe=class extends uF{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let n=()=>{FB("paused"),this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(FB("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){FB("pre-pause polling complete"),--i||n()})),this.writable||(FB("we are currently writing - waiting to pause"),i++,this.once("drain",function(){FB("pre-pause writing complete"),--i||n()}))}else n()}_poll(){FB("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){FB("polling got data %s",t);let n=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};xfs(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():FB('ignoring poll - transport state "%s"',this.readyState))}doClose(){let t=()=>{FB("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(FB("transport open - closing"),t()):(FB("transport not open - deferring close"),this.once("open",t))}write(t){this.writable=!1,Mfs(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=pkt()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}};var Hfs=yt(Ule(),1);var Wfs=!1;try{Wfs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Gfs=Wfs;var Kfs=yt(FI(),1),Can=(0,Kfs.default)("engine.io-client:polling");function Ji0(){}var fkt=class extends kVe{constructor(t){if(super(t),typeof location<"u"){let n=location.protocol==="https:",i=location.port;i||(i=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,n){let i=this.request({method:"POST",data:t});i.on("success",n),i.on("error",(o,s)=>{this.onError("xhr post error",o,s)})}doPoll(){Can("xhr poll");let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,i)=>{this.onError("xhr poll error",n,i)}),this.pollXhr=t}},dF=class r extends Hfs.Emitter{constructor(t,n,i){super(),this.createRequest=t,cF(this,i),this._opts=i,this._method=i.method||"GET",this._uri=n,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let n=dkt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(n);try{Can("xhr open %s: %s",this._method,this._uri),i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},Can("xhr data %s",this._data),i.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ji0,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};dF.requestsCount=0;dF.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Vfs);else if(typeof addEventListener=="function"){let r="onpagehide"in ZE?"pagehide":"unload";addEventListener(r,Vfs,!1)}}function Vfs(){for(let r in dF.requests)dF.requests.hasOwnProperty(r)&&dF.requests[r].abort()}var o$p=function(){let r=Xi0({xdomain:!1});return r&&r.responseType!==null}();function Xi0(r){let t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Gfs))return new XMLHttpRequest}catch{}if(!t)try{return new ZE[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var $i0=Ian.default||Ian,Awe=class extends fkt{request(t={}){var n;return Object.assign(t,{xd:this.xd,cookieJar:(n=this.socket)===null||n===void 0?void 0:n._cookieJar},this.opts),new dF(i=>new $i0(i),this.uri(),t)}};var ls0=yt($fs(),1),cs0=yt(Dan(),1),us0=yt(Pan(),1),Wan=yt(Uan(),1),ds0=yt(Yhs(),1);var Jhs=yt(FI(),1),As0=(0,Jhs.default)("engine.io-client:websocket"),fs0=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Tkt=class extends uF{get name(){return"websocket"}doOpen(){let t=this.uri(),n=this.opts.protocols,i=fs0?{}:dkt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,i)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){let i=t[n],o=n===t.length-1;NVe(i,this.supportsBinary,s=>{try{this.doWrite(i,s)}catch{As0("websocket closed before onclose event")}o&&lF(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=pkt()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}},R$p=ZE.WebSocket||ZE.MozWebSocket;var ywe=class extends Tkt{createSocket(t,n,i){var o;if(!((o=this.socket)===null||o===void 0)&&o._cookieJar){i.headers=i.headers||{},i.headers.cookie=typeof i.headers.cookie=="string"?[i.headers.cookie]:i.headers.cookie||[];for(let[s,a]of this.socket._cookieJar.cookies)i.headers.cookie.push(`${s}=${a.value}`)}return new Wan.default(t,n,i)}doWrite(t,n){let i={};t.options&&(i.compress=t.options.compress),this.opts.perMessageDeflate&&(typeof n=="string"?Buffer.byteLength(n):n.length)<this.opts.perMessageDeflate.threshold&&(i.compress=!1),this.ws.send(n,i)}};var Xhs=yt(FI(),1),HVe=(0,Xhs.default)("engine.io-client:webtransport"),Ewe=class extends uF{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{HVe("transport closed gracefully"),this.onClose()}).catch(t=>{HVe("transport closed due to %s",t),this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{let n=Nfs(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(n).getReader(),o=Dfs();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();let s=()=>{i.read().then(({done:l,value:u})=>{if(l){HVe("session is closed");return}HVe("received chunk: %o",u),this.onPacket(u),s()}).catch(l=>{HVe("an error occurred while reading: %s",l)})};s();let a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){let i=t[n],o=n===t.length-1;this._writer.write(i).then(()=>{o&&lF(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var Gan={websocket:ywe,webtransport:Ewe,polling:Awe};var hs0=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,gs0=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function bwe(r){if(r.length>8e3)throw"URI too long";let t=r,n=r.indexOf("["),i=r.indexOf("]");n!=-1&&i!=-1&&(r=r.substring(0,n)+r.substring(n,i).replace(/:/g,";")+r.substring(i,r.length));let o=hs0.exec(r||""),s={},a=14;for(;a--;)s[gs0[a]]=o[a]||"";return n!=-1&&i!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=ms0(s,s.path),s.queryKey=ys0(s,s.query),s}function ms0(r,t){let n=/\/{2,9}/g,i=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function ys0(r,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,s){o&&(n[o]=s)}),n}var $hs=yt(Ule(),1);var Zhs=yt(FI(),1),c0=(0,Zhs.default)("engine.io-client:socket"),Van=typeof addEventListener=="function"&&typeof removeEventListener=="function",KVe=[];Van&&addEventListener("offline",()=>{c0("closing %d connection(s) because the network was lost",KVe.length),KVe.forEach(r=>r())},!1);var Hle=class r extends $hs.Emitter{constructor(t,n){if(super(),this.binaryType=kfs,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){let i=bwe(t);n.hostname=i.host,n.secure=i.protocol==="https"||i.protocol==="wss",n.port=i.port,i.query&&(n.query=i.query)}else n.host&&(n.hostname=bwe(n.host).host);cF(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(i=>{let o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=zfs(this.opts.query)),Van&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(c0("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},KVe.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=Qfs()),this._open()}createTransport(t){c0('creating transport "%s"',t);let n=Object.assign({},this.opts.query);n.EIO=Ean,n.transport=t,this.id&&(n.sid=this.id);let i=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return c0("options: %j",i),new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){c0("setting transport %s",t.name),this.transport&&(c0("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){c0("socket open"),this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(c0('socket receive: type "%s", data "%s"',t.type,t.data),this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}else c0('packet received with socket readyState "%s"',this.readyState)}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();c0("flushing %d packets in socket",t.length),this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let i=0;i<this.writeBuffer.length;i++){let o=this.writeBuffer[i].data;if(o&&(n+=Lfs(o)),i>0&&n>this._maxPayload)return c0("only send %d out of %d packets",i,this.writeBuffer.length),this.writeBuffer.slice(0,i);n+=2}return c0("payload size is %d (max: %d)",n,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(c0("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,lF(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,i){return this._sendPacket("message",t,n,i),this}send(t,n,i){return this._sendPacket("message",t,n,i),this}_sendPacket(t,n,i,o){if(typeof n=="function"&&(o=n,n=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let s={type:t,data:n,options:i};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),o&&this.once("flush",o),this.flush()}close(){let t=()=>{this._onClose("forced close"),c0("socket closing - telling transport to close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},i=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(c0("socket error %j",t),r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return c0("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(c0('socket close with reason: "%s"',t),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Van&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=KVe.indexOf(this._offlineEventListener);i!==-1&&(c0("removing listener for the 'offline' event"),KVe.splice(i,1))}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}};Hle.protocol=Ean;var Bkt=class extends Hle{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){c0("starting upgrade probes");for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}}_probe(t){c0('probing transport "%s"',t);let n=this.createTransport(t),i=!1;Hle.priorWebsocketSuccess=!1;let o=()=>{i||(c0('probe transport "%s" opened',t),n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!i)if(p.type==="pong"&&p.data==="probe"){if(c0('probe transport "%s" pong',t),this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Hle.priorWebsocketSuccess=n.name==="websocket",c0('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{i||this.readyState!=="closed"&&(c0("changing transport and sending upgrade packet"),d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{c0('probe transport "%s" failed',t);let A=new Error("probe error");A.transport=n.name,this.emitReserved("upgradeError",A)}}))};function s(){i||(i=!0,d(),n.close(),n=null)}let a=p=>{let A=new Error("probe error: "+p);A.transport=n.name,s(),c0('probe transport "%s" failed because of error: %s',t,p),this.emitReserved("upgradeError",A)};function l(){a("transport closed")}function u(){a("socket closed")}function c(p){n&&p.name!==n.name&&(c0('"%s" works - aborting "%s"',p.name,n.name),s())}let d=()=>{n.removeListener("open",o),n.removeListener("error",a),n.removeListener("close",l),this.off("close",u),this.off("upgrading",c)};n.once("open",o),n.once("error",a),n.once("close",l),this.once("close",u),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let n=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&n.push(t[i]);return n}},Cwe=class extends Bkt{constructor(t,n={}){let i=typeof t=="object"?t:n;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>Gan[o]).filter(o=>!!o)),super(t,i)}};var Z$p=Cwe.protocol;var tgs=yt(FI(),1),egs=(0,tgs.default)("socket.io-client:url");function rgs(r,t="",n){let i=r;n=n||typeof location<"u"&&location,r==null&&(r=n.protocol+"//"+n.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=n.protocol+r:r=n.host+r),/^(https?|wss?):\/\//.test(r)||(egs("protocol-less url %s",r),typeof n<"u"?r=n.protocol+"//"+r:r="https://"+r),egs("parse %s",r),i=bwe(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let s=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+s+":"+i.port+t,i.href=i.protocol+"://"+s+(n&&n.port===i.port?"":":"+i.port),i}var Zan={};o3(Zan,{Decoder:()=>Xan,Encoder:()=>Jan,PacketType:()=>ml,protocol:()=>cgs});var ags=yt(Ule(),1);var Is0=typeof ArrayBuffer=="function",vs0=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,ngs=Object.prototype.toString,Ss0=typeof Blob=="function"||typeof Blob<"u"&&ngs.call(Blob)==="[object BlobConstructor]",Os0=typeof File=="function"||typeof File<"u"&&ngs.call(File)==="[object FileConstructor]";function JVe(r){return Is0&&(r instanceof ArrayBuffer||vs0(r))||Ss0&&r instanceof Blob||Os0&&r instanceof File}function YVe(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let n=0,i=r.length;n<i;n++)if(YVe(r[n]))return!0;return!1}if(JVe(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return YVe(r.toJSON(),!0);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&YVe(r[n]))return!0;return!1}function igs(r){let t=[],n=r.data,i=r;return i.data=Han(n,t),i.attachments=t.length,{packet:i,buffers:t}}function Han(r,t){if(!r)return r;if(JVe(r)){let n={_placeholder:!0,num:t.length};return t.push(r),n}else if(Array.isArray(r)){let n=new Array(r.length);for(let i=0;i<r.length;i++)n[i]=Han(r[i],t);return n}else if(typeof r=="object"&&!(r instanceof Date)){let n={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=Han(r[i],t));return n}return r}function ogs(r,t){return r.data=Kan(r.data,t),delete r.attachments,r}function Kan(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let n=0;n<r.length;n++)r[n]=Kan(r[n],t);else if(typeof r=="object")for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(r[n]=Kan(r[n],t));return r}var lgs=yt(FI(),1),Yan=(0,lgs.default)("socket.io-parser"),ws0=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],cgs=5,ml;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(ml||(ml={}));var Jan=class{constructor(t){this.replacer=t}encode(t){return Yan("encoding packet %j",t),(t.type===ml.EVENT||t.type===ml.ACK)&&YVe(t)?this.encodeAsBinary({type:t.type===ml.EVENT?ml.BINARY_EVENT:ml.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===ml.BINARY_EVENT||t.type===ml.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),Yan("encoded %j as %s",t,n),n}encodeAsBinary(t){let n=igs(t),i=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(i),o}};function sgs(r){return Object.prototype.toString.call(r)==="[object Object]"}var Xan=class r extends ags.Emitter{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);let i=n.type===ml.BINARY_EVENT;i||n.type===ml.BINARY_ACK?(n.type=i?ml.EVENT:ml.ACK,this.reconstructor=new $an(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(JVe(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0,i={type:Number(t.charAt(0))};if(ml[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ml.BINARY_EVENT||i.type===ml.BINARY_ACK){let s=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);let a=t.substring(s,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");i.attachments=Number(a)}if(t.charAt(n+1)==="/"){let s=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););i.nsp=t.substring(s,n)}else i.nsp="/";let o=t.charAt(n+1);if(o!==""&&Number(o)==o){let s=n+1;for(;++n;){let a=t.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===t.length)break}i.id=Number(t.substring(s,n+1))}if(t.charAt(++n)){let s=this.tryParse(t.substr(n));if(r.isPayloadValid(i.type,s))i.data=s;else throw new Error("invalid payload")}return Yan("decoded %s as %j",t,i),i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case ml.CONNECT:return sgs(n);case ml.DISCONNECT:return n===void 0;case ml.CONNECT_ERROR:return typeof n=="string"||sgs(n);case ml.EVENT:case ml.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ws0.indexOf(n[0])===-1);case ml.ACK:case ml.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},$an=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let n=ogs(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function hS(r,t,n){return r.on(t,n),function(){r.off(t,n)}}var ugs=yt(Ule(),1),dgs=yt(FI(),1),Bh=(0,dgs.default)("socket.io-client:socket"),_s0=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Iwe=class extends ugs.Emitter{constructor(t,n,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[hS(t,"open",this.onopen.bind(this)),hS(t,"packet",this.onpacket.bind(this)),hS(t,"error",this.onerror.bind(this)),hS(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var i,o,s;if(_s0.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;let a={type:ml.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){let d=this.ids++;Bh("emitting packet with ack id %d",d);let p=n.pop();this._registerAckCallback(d,p),a.id=d}let l=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,u=this.connected&&!(!((s=this.io.engine)===null||s===void 0)&&s._hasPingExpired());return this.flags.volatile&&!l?Bh("discard packet as the transport is not currently writable"):u?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a),this.flags={},this}_registerAckCallback(t,n){var i;let o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[t]=n;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&(Bh("removing packet with ack id %d from the buffer",t),this.sendBuffer.splice(l,1));Bh("event with ack id %d has timed out after %d ms",t,o),n.call(this,new Error("operation has timed out"))},o),a=(...l)=>{this.io.clearTimeoutFn(s),n.apply(this,l)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((i,o)=>{let s=(a,l)=>a?o(a):i(l);s.withError=!0,n.push(s),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...s)=>i!==this._queue[0]?void 0:(o!==null?i.tryCount>this._opts.retries&&(Bh("packet [%d] is discarded after %d tries",i.id,i.tryCount),this._queue.shift(),n&&n(o)):(Bh("packet [%d] was successfully sent",i.id),this._queue.shift(),n&&n(null,...s)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(Bh("draining queue"),!this.connected||this._queue.length===0)return;let n=this._queue[0];if(n.pending&&!t){Bh("packet [%d] has already been sent and is waiting for an ack",n.id);return}n.pending=!0,n.tryCount++,Bh("sending packet [%d] (try n\xB0%d)",n.id,n.tryCount),this.flags=n.flags,this.emit.apply(this,n.args)}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){Bh("transport is open - connecting"),typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ml.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){Bh("close (%s)",t),this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){let i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ml.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ml.EVENT:case ml.BINARY_EVENT:this.onevent(t);break;case ml.ACK:case ml.BINARY_ACK:this.onack(t);break;case ml.DISCONNECT:this.ondisconnect();break;case ml.CONNECT_ERROR:this.destroy();let i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){let n=t.data||[];Bh("emitting event %j",n),t.id!=null&&(Bh("attaching ack callback to event"),n.push(this.ack(t.id))),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let n=this._anyListeners.slice();for(let i of n)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let n=this,i=!1;return function(...o){i||(i=!0,Bh("sending ack %j",o),n.packet({type:ml.ACK,id:t,data:o}))}}onack(t){let n=this.acks[t.id];if(typeof n!="function"){Bh("bad ack %s",t.id);return}delete this.acks[t.id],Bh("calling ack %s with %j",t.id,t.data),n.withError&&t.data.unshift(null),n.apply(this,t.data)}onconnect(t,n){Bh("socket connected with id %s",t),this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){Bh("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(Bh("performing disconnect (%s)",this.nsp),this.packet({type:ml.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let n=this._anyListeners;for(let i=0;i<n.length;i++)if(t===n[i])return n.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let n=this._anyOutgoingListeners;for(let i=0;i<n.length;i++)if(t===n[i])return n.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let n=this._anyOutgoingListeners.slice();for(let i of n)i.apply(this,t.data)}}};function Kle(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Kle.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*r);r=Math.floor(t*10)&1?r+n:r-n}return Math.min(r,this.max)|0};Kle.prototype.reset=function(){this.attempts=0};Kle.prototype.setMin=function(r){this.ms=r};Kle.prototype.setMax=function(r){this.max=r};Kle.prototype.setJitter=function(r){this.jitter=r};var pgs=yt(Ule(),1),Ags=yt(FI(),1),m2=(0,Ags.default)("socket.io-client:manager"),vwe=class extends pgs.Emitter{constructor(t,n){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,cF(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((i=n.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Kle({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;let o=n.parser||Zan;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(m2("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;m2("opening %s",this.uri),this.engine=new Cwe(this.uri,this.opts);let n=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let o=hS(n,"open",function(){i.onopen(),t&&t()}),s=l=>{m2("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},a=hS(n,"error",s);if(this._timeout!==!1){let l=this._timeout;m2("connect attempt will timeout after %d",l);let u=this.setTimeoutFn(()=>{m2("connect attempt timed out after %d",l),o(),s(new Error("timeout")),n.close()},l);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(o),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){m2("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(hS(t,"ping",this.onping.bind(this)),hS(t,"data",this.ondata.bind(this)),hS(t,"error",this.onerror.bind(this)),hS(t,"close",this.onclose.bind(this)),hS(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){lF(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){m2("error",t),this.emitReserved("error",t)}socket(t,n){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new Iwe(this,t,n),this.nsps[t]=i),i}_destroy(t){let n=Object.keys(this.nsps);for(let i of n)if(this.nsps[i].active){m2("socket %s is still active, skipping close",i);return}this._close()}_packet(t){m2("writing packet %j",t);let n=this.encoder.encode(t);for(let i=0;i<n.length;i++)this.engine.write(n[i],t.options)}cleanup(){m2("cleanup"),this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){m2("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var i;m2("closed due to %s",t),this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)m2("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let n=this.backoff.duration();m2("will wait %dms before reconnect attempt",n),this._reconnecting=!0;let i=this.setTimeoutFn(()=>{t.skipReconnect||(m2("attempting reconnect"),this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(m2("reconnect attempt error"),t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):(m2("reconnect success"),t.onreconnect())}))},n);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var hgs=yt(FI(),1),fgs=(0,hgs.default)("socket.io-client"),XVe={};function $Ve(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};let n=rgs(r,t.path||"/socket.io"),i=n.source,o=n.id,s=n.path,a=XVe[o]&&s in XVe[o].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||a,u;return l?(fgs("ignoring socket cache for %s",i),u=new vwe(i,t)):(XVe[o]||(fgs("new io instance for %s",i),XVe[o]=new vwe(i,t)),u=XVe[o]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign($Ve,{Manager:vwe,Socket:Iwe,io:$Ve,connect:$Ve});qt();bm();Ft();df();var Yy=class extends XE{constructor(n,i,o,s,a,l){super(n,n,[],i,s,l);this.dataTransform=o;this.EntityRepositoryConstructor=a}async addAuthHeader(n={}){let i=await this.getToken();return i&&(n.Authorization=`Bearer ${i}`),n}get path(){return`${this.parent.path}/${this.id}`}get bulkUri(){throw new Vl("This entity does not support bulk operations")}get(n){return new this.EntityRepositoryConstructor(n,this.parent,this.serviceOperations,this.logContext)}encodeQueryComponent(n){if(n!==void 0)return Buffer.from(JSON.stringify(n)).toString("base64")}async select(n,i){let o=await this.addAuthHeader(),s=n?.startingFrom,a=!1,l=0,u=[],c=this.encodeQueryComponent(n?.where),d=this.encodeQueryComponent(n?.orderBy),p=500,A=n?.limit??1/0;for(;!a;){let h=Math.min(p,A-l),y=await(await hd).get(`${this.serviceOperations.hostname}${this.baseUri}`,{headers:o,params:{limit:h,startAfter:s,where:c,orderBy:d}}),C=y.data.data.map(O=>this.dataTransform.fromStorage(O.id.toString(),this.path,O,i));u.push(...C),l+=h,s=y.data.nextCursor,(C.length<h||l>=A)&&(a=!0)}let f=n?.selectFields;return f?u.map(h=>XA(h,f)):u}async selectInBatches(n,i,o,s){return this.select({where:[...s,[n,i,o]]})}async createEntity(n,i){let o=await this.generateID(n),s=this.dataTransform.toStorage(o.toString(),`${this.path}/${o}`,n,i),a=await this.addAuthHeader(),u=(await(await hd).post(`${this.serviceOperations.hostname}${this.baseUri}`,s,{headers:a,method:"post"})).data;return new this.EntityRepositoryConstructor(u.id,this.parent,this.serviceOperations,this.logContext)}listenCollection(n,i,o){let s;try{s=$Ve(void 0,{auth:async a=>{let l=await this.getToken();md(!!l,"Cookie-based auth is not yet supported for service-backed repositories","COMMON"),a({token:"Bearer "+l})},path:this.baseWsUri,transports:["websocket"],query:this.wsQuery}),s.on("change",a=>{if(a.type==="added"||a.type==="modified"){let l=this.dataTransform.fromStorage(a.id,`${this.path}/${a.id}`,a.value,o);n([{type:a.type,value:l,id:a.id,hasPendingWrites:!1}])}else n([{type:"removed",value:{},id:a.id,hasPendingWrites:!1}])}),this.select().then(a=>n(a.map(l=>({type:"added",value:l,id:String(l.id),hasPendingWrites:!1}))))}catch(a){if(a instanceof Error&&i)i(a);else throw a}return()=>{s?.close()}}listenQuery(n,i,o,s){throw new Vl("Not used by supported entities")}async generateID(n){return n.id??xs()}async bulkSave(n){qe.COMMON.warnContext(this.logContext,"Using default bulk save operation",{path:this.path});for(let i of n)await this.createEntity(i)}async bulkUpdate(n){qe.COMMON.warnContext(this.logContext,"Using default bulk update operation",{path:this.path});for(let i of n){if(!i.id)throw qe.COMMON.errorContext(this.logContext,"Tried to bulk update entity without entity ID",{path:this.path}),new Ye("Tried to bulk update entity without entity ID");await this.get(i.id).merge(i)}}async bulkDelete(n){qe.COMMON.warnContext(this.logContext,"Using default bulk delete operation",{path:this.path});for(let i of n){if(!i.id)throw qe.COMMON.errorContext(this.logContext,"Tried to bulk delete entity without entity ID",{path:this.path}),new Ye("Tried to bulk delete entity without entity ID");await this.get(i.id).delete()}}async getCount(){throw new Vl}};Zn();pr();Hi();qt();bm();Zn();No();f1();var ZVe=class{fromStorage(t,n,i,o){try{return this.transformFromStorage(t,n,i,o)}catch(s){if(o?.onDataTransformError&&o.onDataTransformError(n,s),!o?.ignoreDataTransformErrors)throw ua().debug(`Error transforming repository entity ${n} from storage`,s),s}return i}toStorage(t,n,i,o){try{return this.transformToStorage(t,n,{id:t,...i},o)}catch(s){if(o?.onDataTransformError&&o.onDataTransformError(n,s),!o?.ignoreDataTransformErrors)throw ua().debug(`Error transforming repository entity ${n} to storage`,s),s}return i}mergeToStorage(t,n,i,o){try{return this.mergeTransformToStorage(t,n,i,o)}catch(s){if(o?.onDataTransformError&&o.onDataTransformError(n,s),!o?.ignoreDataTransformErrors)throw ua().debug(`Error merge transforming repository entity ${n} to storage`,s),s}return i}},eln=class extends ZVe{constructor(n){super();this.validators=n}transformFromStorage(n,i,o,s){let a=this.getValidatorOptions(n,s?.validatorOptions);return s?.enableStrictValidation?this.validators.strict.assert(o,a):this.validators.standard.assert(o,a)}transformToStorage(n,i,o,s){let a=this.getValidatorOptions(n,s?.validatorOptions);return s?.enableStrictValidation?this.validators.strict.assert(o,a):this.validators.standard.assert(o,a)}mergeTransformToStorage(n,i,o,s){return o}getValidatorOptions(n,i,o=500){let s={...i,statusCode:o};return s.errorMessage||(s.errorMessage=a=>`Found ${a.failures.length} validation failure(s) for ${this.validators.standard.name} ${n}`),s}},tln=class{transforms;constructor(...t){this.transforms=t}fromStorage(t,n,i,o){return this.transforms.reduce((s,a)=>a.fromStorage(t,n,s,o),i)}toStorage(t,n,i,o){return this.transforms.reduceRight((s,a)=>a.toStorage(t,n,s,o),i)}mergeToStorage(t,n,i,o){return this.transforms.reduceRight((s,a)=>a.mergeToStorage(t,n,s,o),i)}},rln=class extends ZVe{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}},Swe=class extends rln{constructor(n){super();this.fieldName=n}transformToStorage(n,i,o){return{id:o[this.fieldName],...f3(o,[this.fieldName])}}mergeTransformToStorage(n,i,o){return o}transformFromStorage(n,i,o){return{...o,[this.fieldName]:o.id}}},nln=class extends ZVe{transformToStorage(t,n,i){let{createdAt:o,createdBy:s,updatedAt:a,updatedBy:l,...u}=i;return u}mergeTransformToStorage(t,n,i){let{createdAt:o,createdBy:s,updatedAt:a,updatedBy:l,...u}=i;return u}transformFromStorage(t,n,i){return i}},bI=(r,t)=>{let n=[new nln,new eln(r)];return t&&n.unshift(t),new tln(...n)};var Ts0=_.discriminatedUnion("type",[Gn.merge(Sn.merge(e8)),Gn.merge(Sn.merge(t8))]),Bs0=Fi("Node",Ts0),ggs=bI(Bs0),iln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/nodes`}get baseWsUri(){return"/api/metadata/ws/v1/nodes"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i,o){super(t,"nodes",ggs,n,o,[],i)}async fetchAndMerge(t){let n=await this.addAuthHeader();await(await hd).patch(`${this.baseUri}/${this.id}`,{...this.mapDataToPatchPayload(t),type:t.type},{headers:n})}mergeMetadata(t){return this.fetchAndMerge({metadata:t})}getCollection(){return new eHe(this.parent,this.serviceOperations,this.logContext)}},eHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/nodes`}get bulkUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/nodes_bulk`}get baseWsUri(){return"/api/metadata/ws/v1/nodes"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("nodes",t,ggs,i,iln,n)}listenCollectionOverride(t,n,i,o,s){return this.listenCollection(t,o,s),()=>{}}convertFromRestAPIStorage(t,n){return this.dataTransform.fromStorage(n,`${this.path}/${n}`,t)}async getNodesLocationInfo(){throw new Vl}async bulkSave(t){let n=await this.addAuthHeader(),i=t.map(o=>this.dataTransform.toStorage(o.id||"",`${this.path}/${o.id}`,o));await(await hd).post(this.bulkUri,{nodes:i},{headers:n})}async bulkUpdate(t){let n=await this.addAuthHeader({}),i=t.map(o=>this.dataTransform.mergeToStorage(o.id||"",`${this.path}/${o.id}`,o));await(await hd).post(this.bulkUri,{nodes:i},{headers:n})}async bulkDelete(t){let n=await this.addAuthHeader();await(await hd).delete(this.bulkUri,{headers:n,data:t.map(i=>i.id)})}};Zn();var Rs0=Gn.merge(r8),Ms0=Fi("Job",Rs0),mgs=bI(Ms0,new Swe("jobCounter")),oln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/jobs`}get baseWsUri(){return"/api/metadata/ws/v1/jobs"}get wsQuery(){return{}}getCollection(){return new tHe(this.parent,this.serviceOperations,this.logContext)}constructor(t,n,i,o){super(t,"jobs",mgs,n,o,[],i)}},tHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/jobs`}get baseWsUri(){return"/api/metadata/ws/v1/jobs"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("jobs",t,mgs,i,oln,n)}async generateID(t){if(t.id)return t.id;if(t.jobCounter)return t.jobCounter;let n=await this.select();if(n.length<1)return 1;let o=n.sort((a,l)=>l.id-a.id)[0];return o?o.id+1:1}};Zn();var xs0=Gn.merge(XAe),Ds0=Fi("NodeType",xs0),ygs=bI(Ds0),sln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/templates`}get baseWsUri(){return"/api/metadata/ws/v1/templates"}get wsQuery(){return{}}getCollection(){return new rHe(this.parent,this.serviceOperations,this.logContext)}constructor(t,n,i,o){super(t,"templates",ygs,n,o,[],i)}},rHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/templates`}get baseWsUri(){return"/api/metadata/ws/v1/templates"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("templates",t,ygs,i,sln,n)}};Zn();var Ns0=Gn.merge(Jte),Ps0=Fi("Subgraph",Ns0),Egs=bI(Ps0,new Swe("folderCounter")),aln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/subgraphs`}get baseWsUri(){return"/api/metadata/ws/v1/subgraphs"}get wsQuery(){return{}}getCollection(){return new nHe(this.parent,this.serviceOperations,this.logContext)}constructor(t,n,i,o){super(t,"subgraphs",Egs,n,o,[],i)}},nHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/subgraphs`}get baseWsUri(){return"/api/metadata/ws/v1/subgraphs"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("subgraphs",t,Egs,i,aln,n)}};pr();Zn();var ks0=_.union([Gn.merge(tDe),Gn.merge(rDe),Gn.merge(nDe)]),Qs0=Fi("WorkspaceUser",ks0),bgs=bI(Qs0),lln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/platform-authentications`}get baseWsUri(){return"/api/metadata/ws/v1/platform-authentications"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i,o){super(t,"users",bgs,n,o,[],i)}getCollection(){return new iHe(this.parent,this.serviceOperations,this.logContext)}},iHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/platform-authentications`}get baseWsUri(){return"/api/metadata/ws/v1/platform-authentications"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("users",t,bgs,i,lln,n)}};var Ls0=Gn.merge(put),Fs0=Fi("Workspace",Ls0),Cgs=bI(Fs0),cln=class extends Hg{get baseUri(){return"/api/metadata/v1/workspaces"}get baseWsUri(){return"/api/metadata/ws/v1/workspaces"}get wsQuery(){return{}}getCollection(){return new oHe(this.parent,this.serviceOperations,this.logContext)}constructor(t,n,i,o){super(t,"workspaces",Cgs,n,o,["jobs","macros","nodes","nodeTypes","subgraphs","users","installedPackages","nodesLastRefreshed"],i)}get nodes(){return this.getSubCollection("nodes",eHe)}node(t){return this.nodes.get(t)}installedPackages=void 0;installedPackage=void 0;get jobs(){return this.getSubCollection("jobs",tHe)}job(t){return this.jobs.get(t)}macros=void 0;macro=void 0;nodesLastRefreshed=void 0;nodeLastRefreshed=void 0;get nodeTypes(){return this.getSubCollection("templates",rHe)}nodeType(t){return this.nodeTypes.get(t)}get subgraphs(){return this.getSubCollection("subgraphs",nHe)}subgraph(t){return this.subgraphs.get(t)}get users(){return this.getSubCollection("users",iHe)}user(t){return this.users.get(t)}isDevEnv=void 0;removeDeletedSteps=void 0},oHe=class extends Yy{get baseUri(){return"/api/metadata/v1/workspaces"}get baseWsUri(){return"/api/metadata/ws/v1/workspaces"}get wsQuery(){return{}}async fetchWorkspacesForPermissions(t){return this.select({where:[["devEnv","==",t]],selectFields:["id","project"]})}constructor(t,n,i){super("workspaces",t,Cgs,i,cln,n)}};var zs0=Gn.merge(xut),qs0=Fi("Org",zs0),Igs=bI(qs0),uln=class extends Hg{constructor(t,n,i,o){super(t,"orgs",Igs,n,{...o,orgID:t},["devRuns","globalUsersSettings","projects","runs","userRoles","workspaces"],i)}get baseUri(){return"orgs"}getCollection(){return new sHe(this.parent,this.serviceOperations,this.logContext)}get baseWsUri(){return"orgs"}get wsQuery(){return{}}get workspaces(){return this.getSubCollection("workspaces",oHe)}workspace(t){return this.workspaces.get(t)}devRuns=void 0;devRun=void 0;globalUsersSettings=void 0;globalUsersSetting=void 0;projects=void 0;project=void 0;runs=void 0;run=void 0;userRoles=void 0;userRole=void 0;getNextCounter=void 0;releaseWorkspaceStatusAndEndRun=void 0;updateLastLoginTime=void 0},sHe=class extends Yy{get baseUri(){return"orgs"}get baseWsUri(){return"orgs"}get wsQuery(){return{}}constructor(t,n,i){super("orgs",t,Igs,i,uln,n)}};var Rkt=class extends XE{constructor(t,n){super("root","root",["orgs","users","packagesRegistry","events"],void 0,n,t)}get path(){return"root"}get baseUri(){return"root"}get baseWsUri(){return"root"}get wsQuery(){return{}}get orgs(){return this.getSubCollection("orgs",sHe)}org(t){return this.orgs.get(t)}orgsPublic=void 0;orgPublic=void 0;users=void 0;user=void 0;packagesRegistry=void 0;registryPackage=void 0;events=void 0;event=void 0;oauthStates=void 0;oauthState=void 0;activePrompts=void 0;activePrompt=void 0;promptVersions=void 0;promptVersion=void 0;storage=void 0;batch=()=>new lkt;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)return;o=void 0}}return i||o||this}};var Mkt=class{constructor(t,n,i){this.getMutateAllRepositories=i;this.firestoreBatch=t.batch(),this.serviceBatch=n.batch()}firestoreBatch;serviceBatch;async save(t,n){if(t instanceof XE)return this.serviceBatch.save(t,n);if(t instanceof qle){let i=t.flaggedRepositoryParent,o=this.getMutateAllRepositories();return i instanceof XE?(o&&this.firestoreBatch.save(t.providers.firebase,n),this.serviceBatch.save(t.providers.service,n)):(o&&t.providers.service&&this.serviceBatch.save(t.providers.service,n),this.firestoreBatch.save(t.providers.firebase,n))}return this.firestoreBatch.save(t,n)}async merge(t,n){if(t instanceof XE)return this.serviceBatch.merge(t,n);if(t instanceof qle){let i=t.flaggedRepositoryParent,o=this.getMutateAllRepositories();return i instanceof XE?(o&&this.firestoreBatch.merge(t.providers.firebase,n),this.serviceBatch.merge(t.providers.service,n)):(o&&t.providers.service&&this.serviceBatch.merge(t.providers.service,n),this.firestoreBatch.merge(t.providers.firebase,n))}return this.firestoreBatch.merge(t,n)}async delete(t,n){if(t instanceof XE)return this.serviceBatch.delete(t,n);if(t instanceof qle){let i=t.flaggedRepositoryParent,o=this.getMutateAllRepositories();return i instanceof XE?(o&&this.firestoreBatch.delete(t.providers.firebase,n),this.serviceBatch.delete(t.providers.service,n)):(o&&t.providers.service&&this.serviceBatch.delete(t.providers.service,n),this.firestoreBatch.delete(t.providers.firebase,n))}return this.firestoreBatch.delete(t,n)}async commit(){let t=await this.serviceBatch.commit(),n=await this.firestoreBatch.commit();return t+n}};var dln=(r,t,n)=>{let i=new akt(r),o=new Rkt(t,{});return vfs(i,{firebase:i,service:o},n,()=>new Mkt(i,o,()=>n("",{}).shouldMutateBoth))};var Ot1=ysn(process.env.SERVICE_BACKED_REPOSITORIES),wt1=ysn(process.env.MUTATE_ALL_REPOSITORIES);cte();qt();var qB=av.getTracer("repository"),pln=class{constructor(t){this.transaction=t}async get(t){return Iar(t.path),qB.startActiveSpan(`get ${t.path}`,async n=>{n.setAttribute("repositoryType","web"),n.setAttribute("path",t.path),n.setAttribute("operation","get");let i=await this.transaction.get(t);return n.end(),i})}set(t,n){return Sar(t.path),qB.startActiveSpan(`set ${t.path}`,i=>(i.setAttribute("repositoryType","web"),i.setAttribute("path",t.path),i.setAttribute("operation","set"),this.transaction.set(t,n),i.end(),this))}async update(t,n){return Oar(t.path),qB.startActiveSpan(`update ${t.path}`,i=>(i.setAttribute("repositoryType","web"),i.setAttribute("path",t.path),i.setAttribute("operation","update"),this.transaction.update(t,n),i.end(),this))}delete(t){return war(t.path),qB.startActiveSpan(`delete ${t.path}`,n=>(n.setAttribute("repositoryType","web"),n.setAttribute("path",t.path),n.setAttribute("operation","delete"),this.transaction.delete(t),n.end(),this))}getQuery(t){throw new Vl("getQuery is not supported with the web sdk.")}},xkt=class r extends RVe{constructor(n,i=new yOe(n.storage())){super();this.app=n;this.storage=i}get db(){return this.app.firestore()}currentUser(){return this.db.app.auth().currentUser?.uid}currentLogContext(){return{userID:this.db.app.auth().currentUser?.uid}}collectionRef(n,i){return n.collection(i)}data(n){return n.data()}docRef(n,i){return n.doc(i)}exists(n){return n.exists}hasPendingWrites(n){return n.metadata.hasPendingWrites}async getDoc(n,i){let o=n;return Car(o.path),qB.startActiveSpan(`get ${n.path}`,async s=>{s.setAttribute("repositoryType","web"),s.setAttribute("path",n.path),s.setAttribute("operation","get");let a=await o.get();if(!a.metadata.hasPendingWrites)return s.end(),a;let l=Hjn(o,i?.pendingWritesTimeoutMs);return s.end(),l})}async addDoc(n,i){let o=n;tst(o.path),await qB.startActiveSpan(`set ${n.path}`,async s=>{s.setAttribute("repositoryType","web"),s.setAttribute("path",n.path),s.setAttribute("operation","set"),await o.set(i),s.end()})}async saveDoc(n,i){let o=n;return tst(n.path),qB.startActiveSpan(`set ${n.path}`,async s=>{s.setAttribute("repositoryType","web"),s.setAttribute("path",n.path),s.setAttribute("operation","set"),await o.set(i),s.end()})}async updateDoc(n,i){let o=n;return bar(n.path),qB.startActiveSpan(`update ${n.path}`,async s=>{s.setAttribute("repositoryType","web"),s.setAttribute("path",n.path),s.setAttribute("operation","update"),await o.update(i),s.end()})}async getChildren(n){throw new Vl("getChildren() is not possible in the firestore web sdk as it lacks listDocuments()")}async deleteDoc(n){let i=n;return Ear(n.path),qB.startActiveSpan(`delete ${n.path}`,async o=>{o.setAttribute("repositoryType","web"),o.setAttribute("path",n.path),o.setAttribute("operation","delete"),await i.delete(),o.end()})}createQuery(n,i){let o=n,s=i?.where?.filter(a=>a[2]!==void 0);if(s&&s.forEach(a=>o=o.where(r.replaceIDSentinel(a[0]),a[1],a[2])),i?.orderBy?.forEach(a=>o=o.orderBy(a[0],a[1])),i?.startingFrom!==void 0&&(i.orderBy?.length?o=o.startAfter(i.startingFrom):(o=o.orderBy(ru.firestore.FieldPath.documentId()),o=o.startAfter(i.startingFrom.toString()))),i?.limit&&(o=o.limit(i.limit)),i?.selectFields)throw new Vl("Selecting specific fields is not supported with the Firebase web SDK");return o}runQuery(n){return qB.startActiveSpan("get query.unknown",async i=>{i.setAttribute("repositoryType","web"),i.setAttribute("path","query.unknown"),i.setAttribute("operation","get");let o=await n.get();return i.end(),o})}onDocSnapshot(n,i,o){return n.onSnapshot(i,o)}onCollectionSnapshot(n,i,o){return this.onQuerySnapshot(n,i,o)}onQuerySnapshot(n,i,o){return n.onSnapshot(i,o)}snapShotChanges(n){return n.docChanges()}runTransaction(n){return this.db.runTransaction(i=>n(new pln(i)))}batch(){return this.db.batch()}saveDocBatch(n,i,o){n.set(i,o)}updateDocBatch(n,i,o){n.update(i,o)}deleteDocBatch(n,i){n.delete(i)}commitBatch(n){return _ar(),qB.startActiveSpan("batch",async i=>{i.setAttribute("repositoryType","web"),i.setAttribute("operation","batch commit"),await n.commit(),i.end()})}getServerTimestampSentinel(){return ru.firestore.FieldValue.serverTimestamp()}getDeleteSentinel(){return ru.firestore.FieldValue.delete()}uploadToStorage(n,i){return this.storage.uploadToStorage(n,i)}downloadFromStorage(n){return this.storage.downloadFromStorage(n)}deleteFileFromStorage(n){return this.storage.deleteFileFromStorage(n)}getCount(n){throw new Vl("getCount is not supported with the web sdk.")}async checkIfStorageReferenceExists(n){return this.storage.checkIfStorageReferenceExists(n)}static replaceIDSentinel(n){return n instanceof iDe?ru.firestore.FieldPath.documentId():n}};var Aln=new Map,js0=r=>id().featureFlags.getStringValue("serviceBackedRepositories","").split(",").includes(r)?"service":"firebase",Ws0=()=>id().featureFlags.isFeatureEnabled("mutateAllRepositories",!1),Gs0=r=>({providerId:js0(r),shouldMutateBoth:Ws0()}),vgs=({app:r,storage:t,hostname:n="localhost",token:i})=>{r||(r=ru.app());let o=Aln.get(r.name);return o||(o=dln(new xkt(r,t),{getToken:async()=>typeof i=="string"?i:i(),hostname:n},Gs0),Aln.set(r.name,o)),o},Sgs=()=>{Aln.clear()};var Vs0=qe.RUNNER_BACKEND,Hs0=async r=>{try{return await qii(r),ru.app()}catch(t){throw Vs0.error("GetOrSetupFirebase",t),t}},Ks0=async(r,t,n)=>{let i;return B_()||(i=new Oxt({storage:ru.storage(),backendUrl:t.emulatorInfo?.storage,bucket:t.storageBucket})),vgs({app:r,storage:i,hostname:n.origin,token:Up.resolveAuthToken})},Ys0=async(r,t,n,i)=>{let o,s=new bxt(ua(),i.apiKey,!!i.emulatorInfo,n);return await s.initialize(),Up.setInstance(s),t?o=await s.loginWithIdToken(t):(md(!!r,"refresh_token or ID token is required","AUTH"),o=await s.loginWithRefreshToken(r)),{token:await s.getAuthToken(),uid:o.id}},Dkt=async(r,t,n)=>{let o=await xv(n.origin).GetDatabase(),s=w0t().instance,a=s_n(n.hostname);return process.env.SCHEDULER_ADDRESS=n.origin,s.isInitialized||await s.initializeDefaultFlags(a),LU({logContext:id().logContext,featureFlags:s.currentFlags},async()=>(await ons(),cns(r,t,()=>Hs0(o),(l,u,c)=>Ys0(l,u,c,o),(l,u)=>Ks0(l,o,n),async(l,u,c)=>(a&&(l.subdomain={id:a}),fO&&(l.version={id:fO.version}),await s.initialize({context:l,rootRepository:()=>u,apiClient:xv(void 0,c)}),s.currentFlags))))};Ft();var us=qe.CLI,hF=qe.CLI_INTERNAL,Owe,Ogs=r=>{Owe||(Owe=console.log),console.log=r},wgs=()=>{Owe&&(console.log=Owe,Owe=void 0)},_gs=(...r)=>{(Owe||console.log)(...r)};var Js0=async(r,t,n,i,o)=>{us.infoContext(o,`Starting deploy job coa-${r}`);let s=DYi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),a=new K3e(s),l=gOe(a.runDetails.environmentID),u=OU(i,`Unable to parse runID: ${i}`),c={...o,runID:u,workspaceID:l},{teamInfo:{fbTeamID:d,fbUserID:p},rootRepository:A}=t,f=A.org(d),h=await BL(f.workspace(l).user(p),c),y=id().featureFlags;await WJ(d,p,l,a.userCredentials,h,y);let C=await $4(A,d,p,l,kae(a.userCredentials),c),O=y$r(a,C,p,r);O.id=u;let w=f.run(u);await w.updateHeartbeat({runStatus:"initializing"});let T=Mae(c,w,O.runType);try{let R=a.runDetails.version===2?a.runDetails.phasedNodeEdits:a.runDetails.dividedStepDataWithWorkspaceEdits,P=Math.max(...Object.values(R).map(H=>Object.keys(H).length)),{connectionManager:z,platform:q}=await RL(C,t,ML(P,a.runDetails.parallelism),!1,c);return Y8t({allWorkspaceData:O.runDetails.fromWorkspaceData,connectionManager:z,logContext:c,platform:q,renderer:tI(y),runID:u,runInfo:O,nodesInRun:zJ(R),teamInfoAndFirebase:t,workspaceID:l},T)}catch(R){try{await T()}catch(P){us.error("Unable to clean up hearbeat after handling error",R,"innerError",P)}throw R}},Xs0=async(r,t,n,i,o)=>{us.infoContext(o,`Starting refresh job coa-${r}`);let a=kYi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),l=gOe(a.runDetails.environmentID),u=OU(i,`Unable to parse runID: ${i}`),c={...o,runID:u,workspaceID:l},{teamInfo:{fbTeamID:d,fbUserID:p},rootRepository:A}=t,f=A.org(d),h=await BL(f.workspace(l).user(p),c),y=id().featureFlags;await WJ(d,p,l,a.userCredentials,h,y);let C=await $4(A,d,p,l,kae(a.userCredentials),c);a.runTimeParameters=await xL(A,d,l,a.runTimeParameters),E$r(a);let O=b$r(a,C,p,r);O.id=u;let w=f.run(u);await w.updateHeartbeat({runStatus:"initializing"});let T=Mae(c,w,O.runType);try{let R=await Pae(l,f),P=fOe(O.runDetails,R);O.runDetails.refreshDescription=cWe(O.runDetails,R.jobs),await w.merge({runDetails:O.runDetails});let z=Lae(C,p);R.userConnections[l][p]=z;let{connectionManager:q,platform:H}=await RL(C,t,ML(P.size,a.runDetails.parallelism),!1,c);return lWe({allWorkspaceData:R,connectionManager:q,logContext:c,platform:H,renderer:tI(y),runID:u,runInfo:O,nodesInRun:P,teamInfoAndFirebase:t,workspaceID:l},T)}catch(R){try{await T()}catch(P){us.error("Unable to clean up hearbeat after handling error",R,"innerError",P)}throw R}},$s0=async(r,t,n,i,o)=>{let s="[CloudReRun]";us.infoContext(o,`Starting re-run job coa-${r}`);let a=LYi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),l=new Y3e(a);ay(l);let{teamInfo:u,teamInfo:{fbTeamID:c,fbUserID:d},rootRepository:p}=t,A=p.org(c),f=Krs(l.runDetails.runID),h=await A.run(f).fetch();if(!h)throw new Error(`Could not find runInfo for teamID=${c}, oldRunID=${f}`);if(!Fut(h))throw new Error("Run is not eligible for rerun or a dev run");let y=gOe(h.runDetails.environmentID),C=OU(i,`Unable to parse runID: ${i}`),O={...o,runID:C,workspaceID:y},w=await BL(A.workspace(y).user(d),O),T=id().featureFlags;await WJ(c,d,y,l.userCredentials,w,T);let R=await $4(p,c,d,y,kae(l.userCredentials),O),P=await C$r(p,l,h,R,u,r);if(P.id=C,!zut(P)){let V=`Invalid rerun ID ${P.reRunID}`;throw us.errorContext(O,s,V),new Qi(V)}let z=gOe(P.runDetails.environmentID);sl("RUNNER_BACKEND",z===y,O,"Unexpected mismatch between workspace IDs for re-run and original run; workspace for re-run:",z,"workspace for original run:",y);let q=A.run(C);await q.updateHeartbeat({runStatus:"initializing"});let H=Mae(O,q,P.runType);try{let V=await Pae(z,A),U=cWe(P.runDetails,V.jobs);await q.merge({runDetails:{...P.runDetails,refreshDescription:U}});let Q=await J8t(A,P,V),Y=Lae(R,d);V.userConnections[z][d]=Y;let{connectionManager:j,platform:k}=await RL(R,t,ML(Q.size,P.runDetails.parallelism),!1,O);return lWe({allWorkspaceData:V,connectionManager:j,logContext:O,platform:k,renderer:tI(T),runID:C,runInfo:P,nodesInRun:Q,teamInfoAndFirebase:t,workspaceID:z},H)}catch(V){try{await H()}catch(U){us.error("Unable to clean up hearbeat after handling error",V,"innerError",U)}}},Zs0=async(r,t,n,i,o)=>{let s="CloudDevRun:";us.infoContext(o,s,`Starting dev run job coa-${r}`);let a=NYi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),l=gOe(a.runDetails.environmentID),u=OU(i,`Unable to parse runID: ${i}`),c={...o,runID:u,workspaceID:l},{rootRepository:d,teamInfo:{fbTeamID:p,fbUserID:A}}=t,f=d.org(p),h=await BL(f.workspace(l).user(A),c),y=id().featureFlags;await WJ(p,A,l,a.userCredentials,h,y);let C=await $4(d,p,A,l,kae(a.userCredentials),c),O=f.devRun(u);await O.updateHeartbeat({runStatus:"initializing"});let w={...jrs(a,C,A,r),id:u},T=Mae(c,O,w.runType);try{let R=await Pae(l,f);R.userConnections[l][A]=Lae(C,A);let P=fOe(w.runDetails,R),{connectionManager:z,platform:q}=await RL(C,t,ML(P.size,a.runDetails.parallelism),!1,c);return irs({allWorkspaceData:R,connectionManager:z,logContext:c,platform:q,renderer:tI(y),runID:u,runInfo:w,nodesInRun:P,teamInfoAndFirebase:t,workspaceID:l},T)}catch(R){try{await T()}catch(P){us.errorContext(c,s,"unable to clean up heartbeat with error",P,"following run error",R)}throw R}},ea0=async(r,t,n,i,o)=>{let s="[CloudPlan]",{rootRepository:a,teamInfo:{fbTeamID:l,fbUserID:u}}=t,c=id().featureFlags,{currentWorkspaceData:d,desiredWorkspaceData:p,disablePresync:A,enablePlanRendering:f,workspaceID:h,parameters:y,userCredentials:C,skippedBeforeCollection:O}=n,w={...o,planID:i,workspaceID:h},T={currentWorkspaceData:d,desiredWorkspaceData:p,skippedBeforeCollection:O},R=await qrs(u,l,h,a,C,c,w);us.infoContext(w,s,`Starting plan job coa-${r}`),await zrs(!!f,tI(c),i,h,u,R,y,A,T,a,w,c.isFeatureEnabled("skipPlanContextUpload"))},Tgs=async r=>{let t="[CloudEntry]";if(us.debug("Cloud entrypoint."),!process.env.SCHEDULER_ADDRESS){let f="No SCHEDULER_ADDRESS defined for cloud entrypoint";throw us.emerg(f),new Ye(f)}let n=await Dkt(process.env.COALESCE_COA_CLOUD_TOKEN,void 0,new URL(process.env.SCHEDULER_ADDRESS)),{rootRepository:i,teamInfo:{fbTeamID:o,fbUserID:s},featureFlags:a}=n,l={kubernetesJobUuid:r,orgID:o,userID:s};us.infoContext(l,t,"authenticated user");let u,{action:c,id:d,cloudRunAction:p}=ta0(l);c==="plan"?l.planID=d:l.runID=OU(d,`Unable to parse runID: ${d}`);let A=l;try{await $rs(i,o)&&(Ilr(),us.debugContext(A,t,"super Debug enabled"));let f=process.env.COALESCE_COA_CLOUD_REQUEST_PATH;if(!f){let y="COALESCE_COA_CLOUD_REQUEST_PATH not set!";throw us.emergContext(A,t,y),new Ye(y)}let h=await ra0(f,i,A);u=LU({userID:s,orgID:o,logContext:A,featureFlags:a},()=>(us.infoContext(A,t,`${c} job ${d} started, waiting for completion`),p(r,n,h,d,A))),await u,us.infoContext(A,t,"job completed without exception")}catch(f){return us.errorContext(A,t,"error starting coa run",f),c==="plan"?us.infoContext(A,t,"plan job failed, no run or workspace related state to clean up"):u?(us.infoContext(A,t,"run was initialized, cleaning up run and workspace"),await jts(d,c,i.org(o),f,A),us.infoContext(A,t,"run and workspace cleaned up")):us.infoContext(A,t,"run was not initialized, no run related state to clean up"),await DO(1)}await DO(0)},ta0=r=>{let t="[getCloudRunAction]",n=process.env.COALESCE_COA_CLOUD_ACTION,i=()=>{let o=process.env.COALESCE_COA_CLOUD_RUN_COUNTER;if(!o)throw new Ye("COALESCE_COA_CLOUD_RUN_COUNTER not set!");return o};switch(n){case"deploy":return{id:i(),action:n,cloudRunAction:Js0};case"refresh":return{id:i(),action:n,cloudRunAction:Xs0};case"rerun":return{id:i(),action:n,cloudRunAction:$s0};case"devRun":return{id:i(),action:n,cloudRunAction:Zs0};case"plan":{let o=process.env.COALESCE_COA_CLOUD_PLAN_ID;if(!o){let s=`Plan ID was not set! planID: ${o}`;throw us.emergContext(r,t,s),new Ye(s)}return{id:o,action:n,cloudRunAction:ea0}}default:{let o=n;throw us.emergContext(r,t,`received unexpected COALESCE_COA_CLOUD_ACTION value ${o}`),new Ye(`Error: COALESCE_COA_CLOUD_ACTION is invalid! value=${o}`)}}},ra0=async(r,t,n)=>{let i="[downloadAndCleanupFile]";us.infoContext(n,i,"downloading request data from",r);let o=await t.storage().downloadFile(r),s=wR(o);us.infoContext(n,i,"finished parsing request data as JSON completed; deleting stored request",s);try{await t.storage().deleteFile(r),us.infoContext(n,i,"finished deleting stored request; dispatching cloud run")}catch(a){us.assertContext(n,i,`error deleting stored request at ${r}...continuing`,a)}return o};var jgs=yt(Ugs(),1),{program:$r1,createCommand:Zr1,createArgument:en1,createOption:tn1,CommanderError:rn1,InvalidArgumentError:Wgs,InvalidOptionArgumentError:nn1,Command:Ggs,Argument:in1,Option:CI,Help:on1}=jgs.default;v1e();var F_e=yt(require("fs")),PIs=yt(Ygs());No();qt();kn();KM();var Jgs={openapi:"3.1.0",info:{version:"1.0.0",title:"Coalesce API",description:"REST API for performing operations with the Coalesce backend."},servers:[{url:"https://app.coalescesoftware.io",description:"US primary"},{url:"https://app.eu.coalescesoftware.io",description:"Europe primary"},{url:"https://app.australia-southeast1.gcp.coalescesoftware.io",description:"Australia primary"},{url:"https://app.us-east-1.aws.coalescesoftware.io",description:"US AWS US East"},{url:"https://app.us-east-1.aws.privatelink.coalescesoftware.io",description:"US AWS US East with PrivateLink"},{url:"https://app.us-west-2.aws.coalescesoftware.io",description:"US AWS US West"},{url:"https://app.us-west-2.aws.privatelink.coalescesoftware.io",description:"US AWS US West with PrivateLink"},{url:"https://app.northamerica-northeast1.gcp.coalescesoftware.io",description:"Canada Primary"},{url:"https://app.westus2.azure.coalescesoftware.io",description:"US Azure West 2"},{url:"https://app.eastus2.azure.coalescesoftware.io",description:"US Azure East 2"}],security:[{BearerAuth:[]}],"x-coa-private-pointers":["/paths/~1api~1v2~1render","/paths/~1api~1v2~1render~1health","/components/schemas/PackageDefinition","/components/schemas/RenderRequestV2"],components:{schemas:{DatabaseInfo:{type:"object",required:["apiKey","authDomain","projectId","storageBucket","messagingSenderId","appId","measurementId"],properties:{apiKey:{type:"string"},authDomain:{type:"string"},projectId:{type:"string"},storageBucket:{type:"string"},messagingSenderId:{type:"string"},appId:{type:"string"},measurementId:{type:"string"},emulatorInfo:{type:"object",required:["auth","firestore","storage"],properties:{auth:{type:"string"},firestore:{type:"string"},storage:{type:"string"}}}}},EnvironmentsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of environment information.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/Environment"}},{type:"array",items:{$ref:"#/components/schemas/EnvironmentSummary"}}]},total:{type:"integer",description:"The size of the result set."},startingFrom:{type:"string",description:"The cursor value used in the request."},limit:{type:"integer",description:"The requested page size."},next:{type:["number","null"],description:"The field value representing the start of the next page of results."}}},FeatureFlagsClientConfig:{type:"object",description:"Information a client needs to connect to the feature flag service.",required:["launchDarklyClientID"],properties:{launchDarklyClientID:{type:"string"}}},FeatureFlagsValues:{type:"object",description:"Feature flag values.",properties:{featureFlags:{additionalProperties:{oneOf:[{type:"boolean"},{type:"string"},{type:"number"},{type:"object"},{type:"array"}]}}},required:["featureFlags"]},ProjectsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of project information.",type:"array",items:{$ref:"#/components/schemas/Project"}}}},ProjectResponse:{type:"object",required:["data"],properties:{data:{description:"Information about a project.",$ref:"#/components/schemas/Project"}}},ProjectGitAccountResponse:{$ref:"#/components/schemas/ProjectGitAccountResponseData"},ProjectGitAccountsResponse:{type:"object",required:["data"],properties:{data:{description:"A colleciton of project git accounts",type:"array",items:{$ref:"#/components/schemas/ProjectGitAccountResponseData"}}}},TypesenseConfigResponse:{description:"Summary of configuration data for Typesense in a given org.","x-coa-private":!0,type:"object",required:["typesenseKey","typesenseHosts"],properties:{typesenseKey:{description:"The Typesense access key scoped to a users org.",type:"string"},typesenseHosts:{description:"The Typesense host address(es) for our cluster(s).",type:"array",items:{type:"string"}}}},EnvironmentSummary:{type:"object",description:"Summary information about an environment.",additionalProperties:!1,properties:{createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},id:{type:"string",description:"The Environment ID."},name:{type:"string",description:"Name of the Environment."},project:{type:"string",description:"The Project ID."},status:{$ref:"#/components/schemas/EnvironmentHealth",description:"Status of the Environment."}},required:["createdAt","id","name","project","status"]},ErrorResponse:{description:"Error detail in addition to the HTTP status code and text.",type:"object",required:["error"],properties:{error:{$ref:"#/components/schemas/Error"}}},NodesResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of nodes for an environment.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/NodeSummary"}},{type:"array",items:{$ref:"#/components/schemas/Node"}}]},total:{type:"integer",description:"The size of the result set."},startingFrom:{type:"string",description:"The cursor value used in the request."},limit:{type:"integer",description:"The requested page size."},next:{type:["string","null"],description:"The field value representing the start of the next page of results."}}},NodeSummary:{type:"object",properties:{database:{type:"string",description:"The Snowflake database name."},id:{type:"string",description:"The Coalesce Node ID."},locationName:{type:"string",description:"The Storage Mapping location."},name:{type:"string",description:"The Node name."},nodeType:{$ref:"#/components/schemas/NodeType"},schema:{type:"string",description:"The database schema name."}},required:["database","id","locationName","name","nodeType","schema"]},OrderByDirection:{description:"The sort order for query results.",type:"string",enum:["asc","desc"]},PackageCreateEntity:{description:"A single package entity to be created.","x-coa-private":!0,type:"object",properties:{macros:{type:"string"},dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}},nodeTypes:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageNodeType"}}},required:["macros","dependencies","nodeTypes"]},PackageDependency:{description:"A package dependency.","x-coa-private":!0,type:"object",required:["version","macros","dependencies","releaseID","alias","packageID"],properties:{packageID:{type:"string",minLength:1},alias:{type:"string"},version:{type:"string"},releaseID:{type:"string",minLength:1},macros:{type:"string"},dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}}},examples:[{name:"foo",version:"1.2.3",macros:"{% macro bar() %}hello,{% endmacro %}",nodeTypes:{},dependencies:{dep:{name:"baz",version:"1.1.1",macros:"{% macro bar() %}world!{% endmacro %}",dependencies:{}}}}]},PackageEntityTagV1:{description:"Identifies the package from which the entity came. (Deprecated, see PackageEntityTagV2).","x-coa-private":!0,type:"object",required:["id","version"],properties:{id:{type:"string"},version:{type:"string"}}},PackageEntityTagV2:{description:"Identifies the package from which the entity came.","x-coa-private":!0,type:"object",required:["id","releaseID"],properties:{id:{type:"string"},releaseID:{type:"string"}}},PackageMacro:{description:"A macro in a package.","x-coa-private":!0,type:"string"},PackageNodeType:{description:"A node type in a collection of nodeTypes to be packaged.","x-coa-private":!0,type:"object",required:["name","version","isDisabled","metadata","id"],properties:{name:{type:"string"},version:{type:"number"},id:{type:"string"},isDisabled:{type:"boolean"},metadata:{type:"object"}}},PackageCreateReleaseInfo:{description:"Package release information for a create operation.","x-coa-private":!0,type:"object",properties:{changeLog:{type:"string"},version:{type:"string"},certified:{type:"boolean"}},required:["changeLog","version"]},PackageCreateEntities:{description:"Entities that are part of a package release.","x-coa-private":!0,required:["dependencies","nodeTypes","macros"],properties:{dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}},nodeTypes:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageNodeType"}},macros:{type:"string"}}},RunsOrderBy:{description:"The field used to sort query results. Defaults to `id`, but must be explicitly provided when also using `startingFrom`. Make sure to match data type.",type:"string",enum:["id","runStartTime","runEndTime"]},RunsResponse:{description:"A collection of runs.",type:"object",required:["limit","next","orderBy","orderByDirection","data"],properties:{limit:{description:"The maximum number of runs returned by this query.",type:"integer"},next:{description:"The field value representing the start of the next page of results.",type:["number","string","null"]},orderByDirection:{$ref:"#/components/schemas/OrderByDirection"},orderBy:{$ref:"#/components/schemas/RunsOrderBy"},data:{description:"A collection of runs.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/RunSummary"}},{type:"array",items:{$ref:"#/components/schemas/RunInfo"}}]}}},RunResultsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of run results.",type:"array",items:{$ref:"#/components/schemas/RunResult"}}}},RunSummary:{type:"object",properties:{id:{description:"The run ID.",type:"integer"},reRunID:{description:"If this is a re-run, the ID of the original operation.",type:"string"},runStartTime:{description:"The datetime the run started.",type:"string",format:"date-time"},runEndTime:{description:"The datetime the run ended.",type:"string",format:"date-time"},runType:{$ref:"#/components/schemas/RunType"},runStatus:{$ref:"#/components/schemas/RunStatus"},environmentID:{description:"The environment in which the run operation was applied.",type:"string"},runFailureReason:{description:"Information about the cause of a run failure.",type:"string"}},required:["id","runType","runStatus"]},UserEnvironmentRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserEnvironmentRoles"},additionalProperties:!1},UserProjectRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserProjectRoles"},additionalProperties:!1},UserRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserOrgRoles"},additionalProperties:!1},SingleUserRoleResponseV2:{$ref:"#/components/schemas/UserOrgRolesV2"},UserRoleResponseV2:{type:"object",properties:{userRoles:{type:"array",items:{$ref:"#/components/schemas/UserOrgRolesV2"}}},required:["userRoles"],additionalProperties:!1},FivetranProjectsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of project information.",type:"array",items:{$ref:"#/components/schemas/FivetranProject"}}}},FivetranProjectResponse:{type:"object",required:["data"],properties:{data:{description:"Fivetran project data.",$ref:"#/components/schemas/FivetranProject"}}},FivetranJobsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of job information.",type:"array",items:{$ref:"#/components/schemas/FivetranJob"}}}},FivetranJobHistoryResponse:{type:"object",required:["data"],properties:{data:{description:"Fivetran job history data.",$ref:"#/components/schemas/FivetranJobHistory"}}},FivetranRefreshJobResponse:{type:"object",required:["data"],properties:{data:{description:"A fivetran job",$ref:"#/components/schemas/FivetranJobHistory"}}},MetricsItem:{type:"object",required:["name","tags","count"],properties:{name:{type:"string"},tags:{type:"array",items:{type:"string"}},count:{type:"integer"}}},MetricsRequest:{type:"object",required:["metrics"],properties:{metrics:{type:"array",items:{$ref:"#/components/schemas/MetricsItem"}}}},BaseEnvironment:{type:"object",description:"Environments are used for deploying your data pipelines to production, test, QA, and other environments.",additionalProperties:!0,properties:{connectionAccount:{type:"string",description:"The account name for the environment connection."},defaultStorageMapping:{type:"string",nullable:!0},description:{type:"string",description:"The Environment description."},name:{type:"string",description:"The Environment name."},oauthEnabled:{type:"boolean",description:"If OAuth is enabled."},runTimeParameters:{type:"object",additionalProperties:!0,description:"The default Environment parameters. Parameters changed during deploy will not show here."},tagColors:{$ref:"#/components/schemas/TagColor"},project:{type:"string"}},required:["name","oauthEnabled","project"]},Environment:{description:"Environments are used for deploying your data pipelines to production, test, QA, and other environments.",allOf:[{$ref:"#/components/schemas/BaseWorkspaceEnv"},{type:"object",additionalProperties:!0,properties:{runTimeParameters:{type:"object",additionalProperties:!0,description:"The default Environment parameters. Parameters changed during deploy will not show here."},currentMappings:{$ref:"#/components/schemas/EnvironmentStorageLocationMappings"}},required:["createdAt","id","status"]}]},EnvironmentCreateRequest:{"x-coa-private":!0,type:"object",description:"Initial values to set on a newly created environment.",allOf:[{$ref:"#/components/schemas/BaseEnvironment"},{type:"object",properties:{mappings:{$ref:"#/components/schemas/EnvironmentStorageLocationMappings"}},additionalProperties:!0}]},EnvironmentHealth:{type:"string",enum:["Deleting","Deploying","Failed Deploy","Failed Dev Run","Failed Refresh","Initializing","Refreshing","Running Dev Run","Waiting"]},EnvironmentStorageLocationMappings:{type:"object",description:"The Storage Mapping name.",additionalProperties:{type:"object",properties:{database:{type:"string",description:"The database name."},schema:{type:"string",description:"The database schema."}}}},BaseProject:{type:"object",description:"A project groups environments and workspaces for easier management and access control.",properties:{platformKind:{$ref:"#/components/schemas/PlatformKind"},description:{type:"string"},gitRepoURL:{type:"string"},name:{type:"string"}},required:["name"]},Project:{description:"A project groups environments and workspaces for easier management and access control.",allOf:[{$ref:"#/components/schemas/BaseProject"},{type:"object",additionalProperties:!0,properties:{createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},updatedAt:{type:"string",format:"date-time"},updatedBy:{$ref:"#/components/schemas/UserSummary"},id:{type:"string"},status:{$ref:"#/components/schemas/ProjectStatus"},workspaces:{type:"array",items:{$ref:"#/components/schemas/WorkspaceSummary"}}},required:["createdAt","updatedAt","id","status","name"]}]},ProjectCreateRequest:{type:"object",description:"A project groups environments and workspaces for easier management and access control.",properties:{platformKind:{$ref:"#/components/schemas/PlatformKind"},description:{type:"string"},gitRepoURL:{type:"string"},name:{type:"string"}},additionalProperties:!1,required:["name","platformKind"]},ProjectPatchRequest:{type:"object",description:"A project groups environments and workspaces for easier management and access control.",properties:{platformKind:{$ref:"#/components/schemas/PlatformKind"},description:{type:"string"},gitRepoURL:{type:"string"},name:{type:"string"}},additionalProperties:!1},ProjectStatus:{type:"string",enum:["active","deleted"]},ProjectGitAccountResponseData:{type:"object",required:["gitAccountID","userID"],properties:{gitAccountID:{type:"string"},userID:{type:"string"}}},ProjectGitAccountSetRequest:{required:["gitAccountID"],properties:{gitAccountID:{type:"string"}}},UserSummary:{type:"object",description:"Summary information about a user.",additionalProperties:!1,properties:{id:{type:"string",description:"The user ID."},firstName:{type:"string",description:"User first name."},lastName:{type:"string",description:"User last name."},email:{type:"string"},accountType:{type:"string",enum:["SSO","normal"]}},required:["id"]},FirestoreWebTimestamp:{type:"object",description:"Timestamp from the web Firestore SDK.",additionalProperties:!1,properties:{seconds:{type:"number"},nanoseconds:{type:"number"}},required:["seconds","nanoseconds"]},FirestoreAdminTimestamp:{type:"object",description:"Timestamp from the admin Firestore SDK.",additionalProperties:!1,properties:{_seconds:{type:"number"},_nanoseconds:{type:"number"}},required:["_seconds","_nanoseconds"]},FirestoreTimestamp:{type:"object",description:"Timestamp from either the web admin Firestore SDKs.",oneOf:[{$ref:"#/components/schemas/FirestoreWebTimestamp"},{$ref:"#/components/schemas/FirestoreAdminTimestamp"}]},PlatformKind:{type:"string",enum:["snowflake","databricks","fabric"]},Error:{type:"object",additionalProperties:!1,properties:{errorString:{description:"The error message.",type:"string"},errorDetail:{description:"Additional detail about the error.",type:"string"}},required:["errorString"]},Node:{type:"object",oneOf:[{$ref:"#/components/schemas/SourceNode"},{$ref:"#/components/schemas/SQLNode"}]},NodeCreateRequest:{type:"object",properties:{nodeType:{$ref:"#/components/schemas/NodeType"},predecessorNodeIDs:{default:[],type:"array",items:{type:"string"},description:"The IDs of the nodes that are predecessors to this node. It can also be empty if it has no predecessors"}},additionalProperties:!1,required:["nodeType","predecessorNodeIDs"]},AliasToStepIDMapping:{type:"object",additionalProperties:{type:"string"}},AppliedColumnTests:{type:"object",description:"Will return `hasNull` or `isDistinct` as true or false if testing is enabled.",additionalProperties:{type:"boolean"}},BaseNode:{type:"object",additionalProperties:!0,properties:{database:{type:"string",description:"The Snowflake database name."},description:{type:"string",description:"The Node description."},id:{type:"string",description:"The Node ID."},locationName:{type:"string",description:"The Storage Mapping location."},name:{type:"string",description:"The Node name."},nodeType:{$ref:"#/components/schemas/NodeType"},schema:{type:"string",description:"The Snowflake schema name."}},required:["database","description","id","locationName","name","nodeType","schema"]},ColumnMetadata:{type:"object",additionalProperties:!1,properties:{appliedColumnTests:{$ref:"#/components/schemas/AppliedColumnTests"},columnID:{type:"string",description:"The column ID."},columnReferences:{items:{$ref:"#/components/schemas/IntermediateColumnRefResult"},type:"array"},config:{type:"object",description:"Returns any configuration options from the Node Config Tab.",additionalProperties:!0},dataType:{type:"string",description:"Column data type."},defaultValue:{type:"string",description:"The default column value."},description:{type:"string",description:"The column description."},hashDetails:{$ref:"#/components/schemas/HashMetadata"},hashedColumns:{type:"array",items:{$ref:"#/components/schemas/ColumnReference"}},isBusinessKey:{type:"boolean",description:"Tags the column as a business key."},isChangeTracking:{type:"boolean",description:"Tags the column as a change tracking column in type 2 dimensions."},isSurrogateKey:{type:"boolean",description:"Tags the column as a surrogate key, e.g. DIM_CUSTOMER_KEY."},keyColumnType:{type:"string",enum:["None","primaryBusinessKey","surrogateKey"]},name:{type:"string",description:"The column name."},nullable:{type:"boolean",description:"If the column can contain null values."},primaryKey:{description:"Tags the column as a primary key.",type:"boolean"},sources:{items:{$ref:"#/components/schemas/SourceColumnReferenceV1"},type:"array"},systemColumnType:{type:"string",enum:["None","sysCreateDate","sysCurrentFlag","sysEndDate","sysStartDate","sysUpdateDate","sysVersion"]},transform:{type:"string"},uniqueKey:{type:"boolean"},isSystemCreateDate:{type:"boolean"},isSystemUpdateDate:{type:"boolean"},isSystemStartDate:{type:"boolean"},isSystemEndDate:{type:"boolean"},isSystemVersion:{type:"boolean"},isSystemCurrentFlag:{type:"boolean"}},required:["columnID","dataType","description","name","nullable"]},ColumnReference:{type:"object",additionalProperties:!1,properties:{columnID:{type:"string",description:"Column ID of the source column."},nodeID:{type:"string",description:"Node ID of the source columm."}},required:["columnID","nodeID"]},CustomSQL:{type:"object",additionalProperties:!1,properties:{customSQL:{type:"string"}},required:["customSQL"]},HashAlgorithm:{type:"string",enum:["MD5","SHA1","SHA256"]},HashMetadata:{type:"object",additionalProperties:!1,properties:{hashAlgorithm:{$ref:"#/components/schemas/HashAlgorithm"},hashType:{enum:["ChangeHash","Hash","HubHash","LinkHash","None"],type:"string"},hubHashes:{items:{$ref:"#/components/schemas/ColumnReference"},type:"array"}},required:["hashAlgorithm"]},IntermediateColumnRefResult:{additionalProperties:!1,properties:{columnName:{type:"string"},tableName:{type:"string",nullable:!0}},required:["columnName","tableName"],type:"object"},JoinCondition:{type:"object",additionalProperties:!1,properties:{joinCondition:{type:"string"}},required:["joinCondition"]},NodeType:{anyOf:[{type:"string",enum:["Dimension","Fact","Hub","Link","Satellite","Source","Stage","View","persistentStage"]},{type:"string"}]},RefLink:{type:"object",additionalProperties:!1,properties:{locationName:{type:"string"},nodeName:{type:"string"}},required:["locationName","nodeName"]},SourceColumnReference:{anyOf:[{$ref:"#/components/schemas/SourceColumnReferenceV1"},{$ref:"#/components/schemas/SourceColumnReferenceV2"}]},SourceColumnReferenceV1:{type:"object",additionalProperties:!1,properties:{columnReferences:{items:{$ref:"#/components/schemas/ColumnReference"},type:"array"},transform:{type:"string",description:"Returns the SQL of any column transformations."}},required:["columnReferences","transform"]},SourceColumnReferenceV2:{type:"object",additionalProperties:!1,properties:{transform:{type:"string",description:"Returns the SQL of any column transformations."}},required:["transform"]},SourceMap:{additionalProperties:!1,properties:{aliases:{$ref:"#/components/schemas/AliasToStepIDMapping"},customSQL:{$ref:"#/components/schemas/CustomSQL"},dependencies:{items:{$ref:"#/components/schemas/RefLink"},type:"array"},join:{$ref:"#/components/schemas/JoinCondition"},name:{type:"string"},noLinkRefs:{items:{$ref:"#/components/schemas/RefLink"},type:"array"}},required:["dependencies","join","name","noLinkRefs"],type:"object"},RunStatus:{enum:["canceled","completed","failed","initializing","rendering","running","waitingToRun"],type:"string"},RunType:{enum:["deploy","refresh"],type:"string"},DatabricksUserConnectionType:{type:"string",enum:["Token","Cloud","OAuthU2M","OAuthM2M"]},FabricUserConnectionType:{type:"string",enum:["oauth"]},SnowflakeUserConnectionType:{type:"string",enum:["Basic","Cloud","KeyPair","OAuth"]},DeployRunDetails:{type:"object",additionalProperties:!1,description:"Deployment run details.",properties:{canceled:{type:"boolean",description:"If the run was canceled."},deployCommit:{type:"string",description:"The full commit hash."},deployCommitMessage:{type:"string",description:"The commit message."},environmentID:{type:"string",description:"The Environment ID for this run."},parallelism:{type:"integer",description:"The parallelism parameter determines how many nodes are processed simultaneously (in parallel) by the Snowflake compute warehouse."},nodesInRun:{type:"integer",description:"The number of Nodes deployed."}},required:["deployCommit","environmentID"]},RefreshRunDetails:{type:"object",additionalProperties:!1,description:"Refresh run details.",properties:{canceled:{type:"boolean",description:"If the run was canceled."},environmentID:{type:"string",description:"The Environment ID for this run."},excludeNodesSelector:{type:"string",description:"A selector string of nodes to exclude."},forceIgnoreEnvironmentStatus:{type:"boolean"},includeNodesSelector:{type:"string",description:"A selector string of nodes to include."},jobID:{type:"integer",description:"The Job ID."},parallelism:{type:"integer",description:"The parallelism parameter determines how many nodes are processed simultaneously (in parallel) by the Snowflake compute warehouse."},refreshDescription:{type:"string",description:"The Job name."},nodesForRefresh:{type:"integer"},nodesInRun:{type:"integer",description:"The number of Nodes deployed."},executor:{type:"string"}},required:["environmentID"]},RunDetails:{description:"Detailed information about a run.",anyOf:[{$ref:"#/components/schemas/DeployRunDetails"},{$ref:"#/components/schemas/RefreshRunDetails"}]},RunInfo:{description:"The full details of a run, without the run results.",type:"object",additionalProperties:!1,properties:{id:{type:"integer"},reRunID:{type:"string",description:"If this is a re-run, the ID of the original operation."},runDetails:{$ref:"#/components/schemas/RunDetails"},runEndTime:{format:"date-time",type:"string",description:"The datetime when the run ended."},runHistory:{items:{type:"integer"},type:"array"},runStartTime:{format:"date-time",type:"string",description:"The datetime the run started."},runStatus:{$ref:"#/components/schemas/RunStatus"},runTimeParameters:{type:"object",description:"The default Environment parameters. Parameters changed during deploy will not show here.",additionalProperties:!0},runType:{$ref:"#/components/schemas/RunType"},userCredentials:{oneOf:[{$ref:"#/components/schemas/SnowflakeUserCredentials"},{$ref:"#/components/schemas/DatabricksUserCredentials"},{$ref:"#/components/schemas/FabricUserCredentials"}]},userID:{type:"string"},projectID:{type:"string"},hasTestFailures:{type:"boolean",description:"Whether the run has test failures."},version:{type:"integer"}},required:["id","runDetails","runStatus","runTimeParameters","runType","projectID"]},FabricUserCredentials:{description:"Information about the Fabric account used to perform a run.",type:"object",additionalProperties:!1,properties:{fabricConnectionString:{type:"string"},fabricAuthType:{$ref:"#/components/schemas/FabricUserConnectionType"},platformKind:{type:"string"}},required:["fabricConnectionString","fabricAuthType"]},DatabricksUserCredentials:{description:"Information about the Databricks account used to perform a run.",type:"object",additionalProperties:!1,properties:{databricksHost:{type:"string"},databricksAuthType:{$ref:"#/components/schemas/DatabricksUserConnectionType"},databricksPath:{type:"string"}},required:["databricksHost","databricksAuthType","databricksPath"]},SnowflakeUserCredentials:{description:"Information about the Snowflake account used to perform a run.",type:"object",additionalProperties:!1,properties:{snowflakeAccount:{type:"string"},snowflakeAuthType:{$ref:"#/components/schemas/SnowflakeUserConnectionType"},snowflakeRole:{type:"string"},snowflakeUsername:{type:"string"},snowflakeWarehouse:{type:"string"}},required:["snowflakeAccount","snowflakeAuthType","snowflakeUsername"]},QueryResult:{type:"object",additionalProperties:!1,properties:{endTime:{type:"string",format:"date-time"},error:{$ref:"#/components/schemas/Error"},isRunning:{type:"boolean",description:"If the queried run is still running."},name:{type:"string",description:"The name of the Stage the query ran on."},queryID:{type:"string"},rowsDeleted:{type:"integer"},rowsInserted:{type:"integer"},rowsUpdated:{type:"integer"},sql:{type:"string",description:"The SQL query run during the stage."},startTime:{type:"string",format:"date-time"},status:{type:"string",description:"The query status."},success:{type:"boolean",description:"If the query results were run successfully."},type:{type:"string",enum:["sql","sqlTest"]},warehouse:{type:"string",description:"Name of the warehouse."}},required:["isRunning","name","sql","status","success"]},RunResult:{type:"object",additionalProperties:!1,description:"The result output describing each query processed during a run.",properties:{isRunning:{type:"boolean",description:"If the queried run is still running."},name:{type:"string"},nodeID:{type:"string"},runState:{type:"string"},hasTestFailures:{type:"boolean"},origin:{$ref:"#/components/schemas/RunOrigins"},queryResults:{description:"The query result returns the status of different stages such as Delete Table or Rename Table. See the queryResults name for the stage.",items:{$ref:"#/components/schemas/QueryResult"},type:"array"},renderQueryResult:{$ref:"#/components/schemas/QueryResult"}},required:["isRunning","name","nodeID","queryResults"]},RunOrigins:{enum:["API","CLI","UI","fivetranAPI"]},OrgRoles:{type:"object",description:"Specifies role assignments.",required:["organizationRoles","projects"],properties:{organizationRoles:{description:"The organization roles assigned to the user.",type:"array",items:{type:"string"}},projects:{description:"A dictionary of project role assignments keyed by project ID.",type:"object",additionalProperties:{$ref:"#/components/schemas/ProjectRoles"}}},additionalProperties:!0},ProjectRoles:{type:"object",description:"Specifies project role assignments.",required:["projectRoles","environments"],properties:{projectRoles:{type:"array",items:{type:"string"}},environments:{description:"A dictionary of environment role assignments keyed by environment ID.",type:"object",additionalProperties:{$ref:"#/components/schemas/EnvironmentRoles"}}},additionalProperties:!0},EnvironmentRoles:{type:"object",description:"Specifies environment role assignments.",required:["environmentRoles"],properties:{environmentRoles:{description:"The environment roles assigned to the user.",type:"array",items:{type:"string"}}},additionalProperties:!0},UserOrgRoles:{description:"The roles assigned to a user.",allOf:[{$ref:"#/components/schemas/OrgRoles"},{type:"object",required:["user","organizationRoles","projects"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserProjectRoles:{description:"The project roles assigned to the user.",allOf:[{$ref:"#/components/schemas/ProjectRoles"},{type:"object",required:["user","projectRoles","environments"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserEnvironmentRoles:{description:"The environment roles assigned to the user.",allOf:[{$ref:"#/components/schemas/EnvironmentRoles"},{type:"object",required:["user"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserOrgRolesV2:{description:"The roles assigned to a user.",type:"object",properties:{userID:{type:"string"},organizationRole:{description:`The user role for the org. If the user's organization role does not grant any project permissions and an
|
|
7120
|
+
To be sure the content is the same, you should try uploading the file again.`,r.MD5_RESUMED_UPLOAD="MD5 cannot be used with a continued resumable upload as MD5 cannot be extended from an existing value",r.MISSING_RESUME_CRC32C_FINAL_UPLOAD="The CRC32C is missing for the final portion of a resumed upload, which is required for validation. Please provide `resumeCRC32C` if validation is required, or disable `validation`."})(g2||(g2={}));var zN=class r extends EI{constructor(t,n,i={}){var o,s;let a={},l;i.generation!==null&&(typeof i.generation=="string"?l=Number(i.generation):l=i.generation,isNaN(l)||(a.generation=l)),Object.assign(a,i.preconditionOpts);let u=i.userProject||t.userProject;typeof u=="string"&&(a.userProject=u);let c={delete:{reqOpts:{qs:a}},exists:{reqOpts:{qs:a}},get:{reqOpts:{qs:a}},getMetadata:{reqOpts:{qs:a}},setMetadata:{reqOpts:{qs:a}}};if(super({parent:t,baseUrl:"/o",id:encodeURIComponent(n),methods:c}),Bsn.add(this),this.bucket=t,this.storage=t.parent,i.generation!==null){let d;typeof i.generation=="string"?d=Number(i.generation):d=i.generation,isNaN(d)||(this.generation=d)}this.kmsKeyName=i.kmsKeyName,this.userProject=u,this.name=n,i.encryptionKey&&this.setEncryptionKey(i.encryptionKey),this.acl=new jX({request:this.request.bind(this),pathPrefix:"/acl"}),this.crc32cGenerator=i.crc32cGenerator||this.bucket.crc32cGenerator,this.instanceRetryValue=(s=(o=this.storage)===null||o===void 0?void 0:o.retryOptions)===null||s===void 0?void 0:s.autoRetry,this.instancePreconditionOpts=i?.preconditionOpts}get cloudStorageURI(){let t=this.bucket.cloudStorageURI;return t.pathname=this.name,t}shouldRetryBasedOnPreconditionAndIdempotencyStrat(t){var n;return!(t?.ifGenerationMatch===void 0&&((n=this.instancePreconditionOpts)===null||n===void 0?void 0:n.ifGenerationMatch)===void 0&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)}copy(t,n,i){var o,s;let a=new Error(g2.DESTINATION_NO_NAME);if(!t)throw a;let l={};typeof n=="function"?i=n:n&&(l={...n}),i=i||wl.noop;let u,c,d;if(typeof t=="string"){let f=An0.exec(t);f!==null&&f.length===3?(u=this.storage.bucket(f[1]),c=f[2]):(u=this.bucket,c=t)}else if(t instanceof qN)u=t,c=this.name;else if(t instanceof r)u=t.bucket,c=t.name,d=t;else throw a;let p={};this.generation!==void 0&&(p.sourceGeneration=this.generation),l.token!==void 0&&(p.rewriteToken=l.token),l.userProject!==void 0&&(p.userProject=l.userProject,delete l.userProject),l.predefinedAcl!==void 0&&(p.destinationPredefinedAcl=l.predefinedAcl,delete l.predefinedAcl),d=d||u.file(c);let A={};if(this.encryptionKey!==void 0&&(A["x-goog-copy-source-encryption-algorithm"]="AES256",A["x-goog-copy-source-encryption-key"]=this.encryptionKeyBase64,A["x-goog-copy-source-encryption-key-sha256"]=this.encryptionKeyHash),d.encryptionKey!==void 0?this.setEncryptionKey(d.encryptionKey):l.destinationKmsKeyName!==void 0?(p.destinationKmsKeyName=l.destinationKmsKeyName,delete l.destinationKmsKeyName):d.kmsKeyName!==void 0&&(p.destinationKmsKeyName=d.kmsKeyName),p.destinationKmsKeyName){this.kmsKeyName=p.destinationKmsKeyName;let f=this.interceptors.indexOf(this.encryptionKeyInterceptor);f>-1&&this.interceptors.splice(f,1)}this.shouldRetryBasedOnPreconditionAndIdempotencyStrat(l?.preconditionOpts)||(this.storage.retryOptions.autoRetry=!1),((o=l.preconditionOpts)===null||o===void 0?void 0:o.ifGenerationMatch)!==void 0&&(p.ifGenerationMatch=(s=l.preconditionOpts)===null||s===void 0?void 0:s.ifGenerationMatch,delete l.preconditionOpts),this.request({method:"POST",uri:`/rewriteTo/b/${u.name}/o/${encodeURIComponent(d.name)}`,qs:p,json:l,headers:A},(f,h)=>{if(this.storage.retryOptions.autoRetry=this.instanceRetryValue,f){i(f,null,h);return}if(h.rewriteToken){let y={token:h.rewriteToken};p.userProject&&(y.userProject=p.userProject),p.destinationKmsKeyName&&(y.destinationKmsKeyName=p.destinationKmsKeyName),this.copy(d,y,i);return}i(null,d,h)})}createReadStream(t={}){t=Object.assign({decompress:!0},t);let n=typeof t.start=="number"||typeof t.end=="number",i=t.end<0,o,s,a=new SVe,l=!0,u=!1;if(typeof t.validation=="string"){let f=t.validation.toLowerCase().trim();l=f==="crc32c",u=f==="md5"}else t.validation===!1&&(l=!1);let c=!n&&(l||u);if(n){if(typeof t.validation=="string"||t.validation===!0)throw new Error(g2.INVALID_VALIDATION_FILE_RANGE);l=!1,u=!1}let d=f=>{f&&(s?.agent&&s.agent.destroy(),a.destroy(f))},p=(f,h,y)=>{if(f){this.getBufferFromReadable(y).then(P=>{f.message=P.toString("utf8"),a.destroy(f)});return}s=y.request;let C=y.toJSON().headers,O=C["content-encoding"]==="gzip",w={},T=C["x-goog-stored-content-encoding"]==="gzip"&&O||C["x-goog-stored-content-encoding"]==="identity",R=[];if(c&&(typeof C["x-goog-hash"]=="string"&&C["x-goog-hash"].split(",").forEach(P=>{let z=P.indexOf("="),q=P.substring(0,z),H=P.substring(z+1);w[q]=H}),o=new BVe({crc32c:l,md5:u,crc32cGenerator:this.crc32cGenerator,crc32cExpected:w.crc32c,md5Expected:w.md5})),u&&!w.md5){let P=new Qle(g2.MD5_NOT_AVAILABLE);P.code="MD5_NOT_AVAILABLE",a.destroy(P);return}T&&c&&o&&R.push(o),O&&t.decompress&&R.push(mPt.createGunzip()),(0,lwe.pipeline)(y,...R,a,d)},A=()=>{let f={alt:"media"};this.generation&&(f.generation=this.generation),t.userProject&&(f.userProject=t.userProject);let h={"Accept-Encoding":"gzip","Cache-Control":"no-store"};if(n){let C=typeof t.start=="number"?t.start:"0",O=typeof t.end=="number"?t.end:"";h.Range=`bytes=${i?O:`${C}-${O}`}`}let y={uri:"",headers:h,qs:f};t[Vg]&&(y[Vg]=t[Vg]),this.requestStream(y).on("error",C=>{a.destroy(C)}).on("response",C=>{a.emit("response",C),wl.handleResp(null,C,null,p)}).resume()};return a.on("reading",A),a}createResumableUpload(t,n){var i,o;let s=typeof t=="object"?t:{};n=typeof t=="function"?t:n;let a=this.storage.retryOptions;(((i=s?.preconditionOpts)===null||i===void 0?void 0:i.ifGenerationMatch)===void 0&&((o=this.instancePreconditionOpts)===null||o===void 0?void 0:o.ifGenerationMatch)===void 0&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(a.autoRetry=!1),CAs({authClient:this.storage.authClient,apiEndpoint:this.storage.apiEndpoint,bucket:this.bucket.name,customRequestOptions:this.getRequestInterceptors().reduce((l,u)=>u(l),{}),file:this.name,generation:this.generation,key:this.encryptionKey,kmsKeyName:this.kmsKeyName,metadata:s.metadata,offset:s.offset,origin:s.origin,predefinedAcl:s.predefinedAcl,private:s.private,public:s.public,userProject:s.userProject||this.userProject,retryOptions:a,params:s?.preconditionOpts||this.instancePreconditionOpts,universeDomain:this.bucket.storage.universeDomain,[Vg]:s[Vg]},n),this.storage.retryOptions.autoRetry=this.instanceRetryValue}createWriteStream(t={}){var n;if((n=t.metadata)!==null&&n!==void 0||(t.metadata={}),t.contentType&&(t.metadata.contentType=t.contentType),!t.metadata.contentType||t.metadata.contentType==="auto"){let f=NAs.default.getType(this.name);f&&(t.metadata.contentType=f)}let i=t.gzip;i==="auto"&&(i=(0,xAs.default)(t.metadata.contentType||"")),i&&(t.metadata.contentEncoding="gzip");let o=!0,s=!1;if(typeof t.validation=="string"?(t.validation=t.validation.toLowerCase(),o=t.validation==="crc32c",s=t.validation==="md5"):t.validation===!1&&(o=!1,s=!1),t.offset){if(s)throw new RangeError(g2.MD5_RESUMED_UPLOAD);if(o&&!t.isPartialUpload&&!t.resumeCRC32C)throw new RangeError(g2.MISSING_RESUME_CRC32C_FINAL_UPLOAD)}let a=f=>{l.destroy(f||void 0)},l=new lwe.Writable({final(f){a=f,c.end()},write(f,h,y){c.write(f,h,y)}}),u=[];i&&u.push(mPt.createGzip());let c=new SVe,d=null;if(o||s){let f=t.resumeCRC32C?GX.from(t.resumeCRC32C):void 0;d=new BVe({crc32c:o,crc32cInstance:f,md5:s,crc32cGenerator:this.crc32cGenerator,updateHashesOnly:!0}),u.push(d)}let p=(0,PAs.default)(),A=!1;return c.on("reading",()=>l.emit("reading")),c.on("writing",()=>l.emit("writing")),p.on("uri",f=>l.emit("uri",f)),p.on("progress",f=>l.emit("progress",f)),p.on("response",f=>l.emit("response",f)),p.once("metadata",()=>{A=!0}),l.once("writing",()=>{t.resumable===!1?this.startSimpleUpload_(p,t):this.startResumableUpload_(p,t),(0,lwe.pipeline)(c,...u,p,async f=>{if(f)return a(f);if(!A)try{await new Promise((h,y)=>{p.once("metadata",h),p.once("error",y)})}catch(h){return a(h)}d?.crc32c&&l.emit("crc32c",d.crc32c);try{let h=t.isPartialUpload&&!this.metadata;d&&!h&&await pn0(this,Bsn,"m",RAs).call(this,d,{crc32c:o,md5:s}),a()}catch(h){a(h)}})}),l}delete(t,n){let i=typeof t=="object"?t:{};n=typeof t=="function"?t:n,this.disableAutoRetryConditionallyIdempotent_(this.methods.delete,kB.delete,i),super.delete(i).then(o=>n(null,...o)).catch(n).finally(()=>{this.storage.retryOptions.autoRetry=this.instanceRetryValue})}download(t,n){let i;typeof t=="function"?(n=t,i={}):i=t;let o=!1,s=(...c)=>{o||n(...c),o=!0},a=i.destination;delete i.destination;let l=this.createReadStream(i),u=!1;a?l.on("error",s).once("data",c=>{u=!0;let d=gPt.createWriteStream(a);d.write(c),l.pipe(d).on("error",s).on("finish",s)}).on("end",()=>{if(!u){let c=Buffer.alloc(0);try{gPt.writeFileSync(a,c),s(null,c)}catch(d){s(d,c)}}}):this.getBufferFromReadable(l).then(c=>s?.(null,c)).catch(s)}setEncryptionKey(t){return this.encryptionKey=t,this.encryptionKeyBase64=Buffer.from(t).toString("base64"),this.encryptionKeyHash=DAs.createHash("sha256").update(this.encryptionKeyBase64,"base64").digest("base64"),this.encryptionKeyInterceptor={request:n=>(n.headers=n.headers||{},n.headers["x-goog-encryption-algorithm"]="AES256",n.headers["x-goog-encryption-key"]=this.encryptionKeyBase64,n.headers["x-goog-encryption-key-sha256"]=this.encryptionKeyHash,n)},this.interceptors.push(this.encryptionKeyInterceptor),this}getExpirationDate(t){this.getMetadata((n,i,o)=>{if(n){t(n,null,o);return}if(!i.retentionExpirationTime){let s=new Error(g2.EXPIRATION_TIME_NA);t(s,null,o);return}t(null,new Date(i.retentionExpirationTime),o)})}generateSignedPostPolicyV2(t,n){let i=Zw(t,n),o=i.options,s=i.callback,a=new Date(o.expires);if(isNaN(a.getTime()))throw new Error(FN.EXPIRATION_DATE_INVALID);if(a.valueOf()<Date.now())throw new Error(FN.EXPIRATION_DATE_PAST);o=Object.assign({},o);let l=[["eq","$key",this.name],{bucket:this.bucket.name}];if(Array.isArray(o.equals)&&(Array.isArray(o.equals[0])||(o.equals=[o.equals]),o.equals.forEach(p=>{if(!Array.isArray(p)||p.length!==2)throw new Error(g2.EQUALS_CONDITION_TWO_ELEMENTS);l.push(["eq",p[0],p[1]])})),Array.isArray(o.startsWith)&&(Array.isArray(o.startsWith[0])||(o.startsWith=[o.startsWith]),o.startsWith.forEach(p=>{if(!Array.isArray(p)||p.length!==2)throw new Error(g2.STARTS_WITH_TWO_ELEMENTS);l.push(["starts-with",p[0],p[1]])})),o.acl&&l.push({acl:o.acl}),o.successRedirect&&l.push({success_action_redirect:o.successRedirect}),o.successStatus&&l.push({success_action_status:o.successStatus}),o.contentLengthRange){let p=o.contentLengthRange.min,A=o.contentLengthRange.max;if(typeof p!="number"||typeof A!="number")throw new Error(g2.CONTENT_LENGTH_RANGE_MIN_MAX);l.push(["content-length-range",p,A])}let u={expiration:a.toISOString(),conditions:l},c=JSON.stringify(u),d=Buffer.from(c).toString("base64");this.storage.authClient.sign(d,o.signingEndpoint).then(p=>{s(null,{string:c,base64:d,signature:p})},p=>{s(new kle(p.message))})}generateSignedPostPolicyV4(t,n){let i=Zw(t,n),o=i.options,s=i.callback,a=new Date(o.expires);if(isNaN(a.getTime()))throw new Error(FN.EXPIRATION_DATE_INVALID);if(a.valueOf()<Date.now())throw new Error(FN.EXPIRATION_DATE_PAST);if(a.valueOf()-Date.now()>BAs*1e3)throw new Error(`Max allowed expiration is seven days (${BAs} seconds).`);o=Object.assign({},o);let l=Object.assign({},o.fields),u=new Date,c=Dle(u,!0),d=Dle(u);(async()=>{let{client_email:A}=await this.storage.authClient.getCredentials(),f=`${A}/${d}/auto/storage/goog4_request`;l={...l,bucket:this.bucket.name,key:this.name,"x-goog-date":c,"x-goog-credential":f,"x-goog-algorithm":"GOOG4-RSA-SHA256"};let h=o.conditions||[];Object.entries(l).forEach(([T,R])=>{T.startsWith("x-ignore-")||h.push({[T]:R})}),delete l.bucket;let y=Dle(a,!0,"-",":"),O=aAs({conditions:h,expiration:y}),w=Buffer.from(O).toString("base64");try{let T=await this.storage.authClient.sign(w,o.signingEndpoint),R=Buffer.from(T,"base64").toString("hex"),P=this.parent.storage.universeDomain;l.policy=w,l["x-goog-signature"]=R;let z;return this.storage.customEndpoint?z=this.storage.apiEndpoint:o.virtualHostedStyle?z=`https://${this.bucket.name}.storage.${P}/`:o.bucketBoundHostname?z=`${o.bucketBoundHostname}/`:z=`https://storage.${P}/${this.bucket.name}/`,{url:z,fields:l}}catch(T){throw new kle(T.message)}})().then(A=>s(null,A),s)}getSignedUrl(t,n){let i=Rsn[t.action],o=sAs(t.extensionHeaders||{});t.action==="resumable"&&(o["x-goog-resumable"]="start");let s=Object.assign({},t.queryParams);typeof t.responseType=="string"&&(s["response-content-type"]=t.responseType),typeof t.promptSaveAs=="string"&&(s["response-content-disposition"]='attachment; filename="'+t.promptSaveAs+'"'),typeof t.responseDisposition=="string"&&(s["response-content-disposition"]=t.responseDisposition),this.generation&&(s.generation=this.generation.toString());let a={method:i,expires:t.expires,accessibleAt:t.accessibleAt,extensionHeaders:o,queryParams:s,contentMd5:t.contentMd5,contentType:t.contentType,host:t.host};t.cname&&(a.cname=t.cname),t.version&&(a.version=t.version),t.virtualHostedStyle&&(a.virtualHostedStyle=t.virtualHostedStyle),this.signer||(this.signer=new awe(this.storage.authClient,this.bucket,this,this.storage)),this.signer.getSignedUrl(a).then(l=>n(null,l),n)}isPublic(t){var n;let i=((n=this.storage)===null||n===void 0?void 0:n.interceptors)||[],o=this.interceptors||[],a=i.concat(o).reduce((l,u)=>{let c=u.request({uri:`${this.storage.apiEndpoint}/${this.bucket.name}/${encodeURIComponent(this.name)}`});return Object.assign(l,c.headers),l},{});wl.makeRequest({method:"GET",uri:`${this.storage.apiEndpoint}/${this.bucket.name}/${encodeURIComponent(this.name)}`,headers:a},{retryOptions:this.storage.retryOptions},l=>{l?l.code===403?t(null,!1):t(l):t(null,!0)})}makePrivate(t,n){var i,o;let s=typeof t=="object"?t:{};n=typeof t=="function"?t:n;let a={predefinedAcl:s.strict?"private":"projectPrivate"};((i=s.preconditionOpts)===null||i===void 0?void 0:i.ifMetagenerationMatch)!==void 0&&(a.ifMetagenerationMatch=(o=s.preconditionOpts)===null||o===void 0?void 0:o.ifMetagenerationMatch,delete s.preconditionOpts),s.userProject&&(a.userProject=s.userProject);let l={...s.metadata,acl:null};this.setMetadata(l,a,n)}makePublic(t){t=t||wl.noop,this.acl.add({entity:"allUsers",role:"READER"},(n,i,o)=>{t(n,o)})}publicUrl(){return`${this.storage.apiEndpoint}/${this.bucket.name}/${encodeURIComponent(this.name)}`}move(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,i=i||wl.noop,this.copy(t,o,(s,a,l)=>{if(s){s.message="file#copy failed with an error - "+s.message,i(s,null,l);return}this.name!==a.name||this.bucket.name!==a.bucket.name?this.delete(o,(u,c)=>{if(u){u.message="file#delete failed with an error - "+u.message,i(u,a,c);return}i(null,a,l)}):i(null,a,l)})}rename(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,i=i||wl.noop,this.move(t,o,i)}request(t,n){return this.parent.request.call(this,t,n)}rotateEncryptionKey(t,n){var i;n=typeof t=="function"?t:n;let o={};typeof t=="string"||t instanceof Buffer?o={encryptionKey:t}:typeof t=="object"&&(o=t);let s=this.bucket.file(this.id,o),a=((i=o.preconditionOpts)===null||i===void 0?void 0:i.ifGenerationMatch)!==void 0?{preconditionOpts:o.preconditionOpts}:{};this.copy(s,a,n)}save(t,n,i){i=typeof n=="function"?n:i;let o=typeof n=="object"?n:{},s=this.storage.retryOptions.maxRetries;this.shouldRetryBasedOnPreconditionAndIdempotencyStrat(o?.preconditionOpts)||(s=0);let a=(0,kAs.default)(async l=>new Promise((u,c)=>{s===0&&(this.storage.retryOptions.autoRetry=!1);let d=this.createWriteStream(o);o.onUploadProgress&&d.on("progress",o.onUploadProgress);let p=A=>this.storage.retryOptions.autoRetry&&this.storage.retryOptions.retryableErrorFn(A)?c(A):l(A);typeof t=="string"||Buffer.isBuffer(t)?d.on("error",p).on("finish",()=>u()).end(t):(0,lwe.pipeline)(t,d,A=>{if(A){if(typeof t!="function")return l(A);p(A)}else u()})}),{retries:s,factor:this.storage.retryOptions.retryDelayMultiplier,maxTimeout:this.storage.retryOptions.maxRetryDelay*1e3,maxRetryTime:this.storage.retryOptions.totalTimeout*1e3});return i?a.then(()=>{if(i)return i()}).catch(i):a}setMetadata(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,this.disableAutoRetryConditionallyIdempotent_(this.methods.setMetadata,kB.setMetadata,o),super.setMetadata(t,o).then(s=>i(null,...s)).catch(i).finally(()=>{this.storage.retryOptions.autoRetry=this.instanceRetryValue})}setStorageClass(t,n,i){i=typeof n=="function"?n:i;let s={...typeof n=="object"?n:{},storageClass:t.replace(/-/g,"_").replace(/([a-z])([A-Z])/g,(a,l,u)=>l+"_"+u).toUpperCase()};this.copy(this,s,(a,l,u)=>{if(a){i(a,u);return}this.metadata=l.metadata,i(null,u)})}setUserProject(t){this.bucket.setUserProject.call(this,t)}startResumableUpload_(t,n={}){var i;(i=n.metadata)!==null&&i!==void 0||(n.metadata={});let o=this.storage.retryOptions;this.shouldRetryBasedOnPreconditionAndIdempotencyStrat(n.preconditionOpts)||(o.autoRetry=!1);let s=bAs({authClient:this.storage.authClient,apiEndpoint:this.storage.apiEndpoint,bucket:this.bucket.name,customRequestOptions:this.getRequestInterceptors().reduce((a,l)=>l(a),{}),file:this.name,generation:this.generation,isPartialUpload:n.isPartialUpload,key:this.encryptionKey,kmsKeyName:this.kmsKeyName,metadata:n.metadata,offset:n.offset,predefinedAcl:n.predefinedAcl,private:n.private,public:n.public,uri:n.uri,userProject:n.userProject||this.userProject,retryOptions:{...o},params:n?.preconditionOpts||this.instancePreconditionOpts,chunkSize:n?.chunkSize,highWaterMark:n?.highWaterMark,universeDomain:this.bucket.storage.universeDomain,[Vg]:n[Vg]});s.on("response",a=>{t.emit("response",a)}).on("uri",a=>{t.emit("uri",a)}).on("metadata",a=>{this.metadata=a,t.emit("metadata")}).on("finish",()=>{t.emit("complete")}).on("progress",a=>t.emit("progress",a)),t.setWritable(s),this.storage.retryOptions.autoRetry=this.instanceRetryValue}startSimpleUpload_(t,n={}){var i;(i=n.metadata)!==null&&i!==void 0||(n.metadata={});let o=this.storage.apiEndpoint,s=this.bucket.name,a=`${o}/upload/storage/v1/b/${s}/o`,l={qs:{name:this.name},uri:a,[Vg]:n[Vg]};this.generation!==void 0&&(l.qs.ifGenerationMatch=this.generation),this.kmsKeyName!==void 0&&(l.qs.kmsKeyName=this.kmsKeyName),typeof n.timeout=="number"&&(l.timeout=n.timeout),(n.userProject||this.userProject)&&(l.qs.userProject=n.userProject||this.userProject),n.predefinedAcl?l.qs.predefinedAcl=n.predefinedAcl:n.private?l.qs.predefinedAcl="private":n.public&&(l.qs.predefinedAcl="publicRead"),Object.assign(l.qs,this.instancePreconditionOpts,n.preconditionOpts),wl.makeWritableStream(t,{makeAuthenticatedRequest:u=>{this.request(u,(c,d,p)=>{if(c){t.destroy(c);return}this.metadata=d,t.emit("metadata",d),t.emit("response",p),t.emit("complete")})},metadata:n.metadata,request:l})}disableAutoRetryConditionallyIdempotent_(t,n,i){var o,s,a,l;(typeof t=="object"&&((s=(o=t?.reqOpts)===null||o===void 0?void 0:o.qs)===null||s===void 0?void 0:s.ifGenerationMatch)===void 0&&i?.ifGenerationMatch===void 0&&n===kB.delete&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(this.storage.retryOptions.autoRetry=!1),(typeof t=="object"&&((l=(a=t?.reqOpts)===null||a===void 0?void 0:a.qs)===null||l===void 0?void 0:l.ifMetagenerationMatch)===void 0&&i?.ifMetagenerationMatch===void 0&&n===kB.setMetadata&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(this.storage.retryOptions.autoRetry=!1)}async getBufferFromReadable(t){let n=[];for await(let i of t)n.push(i);return Buffer.concat(n)}};Bsn=new WeakSet,RAs=async function(t,n={}){let i=this.metadata,o=!!(n.crc32c||n.md5);if(n.crc32c&&i.crc32c&&(o=!t.test("crc32c",i.crc32c)),n.md5&&i.md5Hash&&(o=!t.test("md5",i.md5Hash)),o){let s=[],a="",l="";try{await this.delete(),n.md5&&!i.md5Hash?(a="MD5_NOT_AVAILABLE",l=g2.MD5_NOT_AVAILABLE):(a="FILE_NO_UPLOAD",l=g2.UPLOAD_MISMATCH)}catch(c){let d=c;a="FILE_NO_UPLOAD_DELETE",l=`${g2.UPLOAD_MISMATCH_DELETE_FAIL}${d.message}`,s.push(d)}let u=new Qle(l);throw u.code=a,u.errors=s,u}return!0};(0,MAs.promisifyAll)(zN,{exclude:["cloudStorageURI","publicUrl","request","save","setEncryptionKey","shouldRetryBasedOnPreconditionAndIdempotencyStrat","getBufferFromReadable"]});var QAs=yt(wh(),1);var yPt;(function(r){r.POLICY_OBJECT_REQUIRED="A policy object is required.",r.PERMISSIONS_REQUIRED="Permissions are required."})(yPt||(yPt={}));var cwe=class{constructor(t){this.request_=t.request.bind(t),this.resourceId_="buckets/"+t.getId()}getPolicy(t,n){let{options:i,callback:o}=Zw(t,n),s={};i.userProject&&(s.userProject=i.userProject),i.requestedPolicyVersion!==null&&i.requestedPolicyVersion!==void 0&&(s.optionsRequestedPolicyVersion=i.requestedPolicyVersion),this.request_({uri:"/iam",qs:s},o)}setPolicy(t,n,i){if(t===null||typeof t!="object")throw new Error(yPt.POLICY_OBJECT_REQUIRED);let{options:o,callback:s}=Zw(n,i),a;t.etag===void 0&&(a=0),this.request_({method:"PUT",uri:"/iam",maxRetries:a,json:Object.assign({resourceId:this.resourceId_},t),qs:o},s)}testPermissions(t,n,i){if(!Array.isArray(t)&&typeof t!="string")throw new Error(yPt.PERMISSIONS_REQUIRED);let{options:o,callback:s}=Zw(n,i),a=Array.isArray(t)?t:[t],l=Object.assign({permissions:a},o);this.request_({uri:"/iam/testPermissions",qs:l,useQuerystring:!0},(u,c)=>{if(u){s(u,null,c);return}let d=Array.isArray(c.permissions)?c.permissions:[],p=a.reduce((A,f)=>(A[f]=d.indexOf(f)>-1,A),{});s(null,p,c)})}};(0,QAs.promisifyAll)(cwe);var LAs=yt(wh(),1),uwe=class extends EI{constructor(t,n){let i={},o={create:!0,delete:{reqOpts:{qs:i}},get:{reqOpts:{qs:i}},getMetadata:{reqOpts:{qs:i}},exists:!0};super({parent:t,baseUrl:"/notificationConfigs",id:n.toString(),createMethod:t.createNotification.bind(t),methods:o})}};(0,LAs.promisifyAll)(uwe);var WAs=require("stream"),GAs=require("url"),Dsn;(function(r){r.list="GET"})(Dsn||(Dsn={}));var kB;(function(r){r[r.setMetadata=0]="setMetadata",r[r.delete=1]="delete"})(kB||(kB={}));var UN;(function(r){r.PROVIDE_SOURCE_FILE="You must provide at least one source file.",r.DESTINATION_FILE_NOT_SPECIFIED="A destination file must be specified.",r.CHANNEL_ID_REQUIRED="An ID is required to create a channel.",r.TOPIC_NAME_REQUIRED="A valid topic name is required.",r.CONFIGURATION_OBJECT_PREFIX_REQUIRED="A configuration object with a prefix is required.",r.SPECIFY_FILE_NAME="A file name must be specified.",r.METAGENERATION_NOT_PROVIDED="A metageneration must be provided.",r.SUPPLY_NOTIFICATION_ID="You must supply a notification ID."})(UN||(UN={}));var qN=class r extends EI{getFilesStream(t){return new WAs.Readable}constructor(t,n,i){var o,s,a,l;i=i||{},n=n.replace(/^gs:\/\//,"").replace(/\/+$/,"");let u={};!((o=i?.preconditionOpts)===null||o===void 0)&&o.ifGenerationMatch&&(u.ifGenerationMatch=i.preconditionOpts.ifGenerationMatch),!((s=i?.preconditionOpts)===null||s===void 0)&&s.ifGenerationNotMatch&&(u.ifGenerationNotMatch=i.preconditionOpts.ifGenerationNotMatch),!((a=i?.preconditionOpts)===null||a===void 0)&&a.ifMetagenerationMatch&&(u.ifMetagenerationMatch=i.preconditionOpts.ifMetagenerationMatch),!((l=i?.preconditionOpts)===null||l===void 0)&&l.ifMetagenerationNotMatch&&(u.ifMetagenerationNotMatch=i.preconditionOpts.ifMetagenerationNotMatch);let c=i.userProject;typeof c=="string"&&(u.userProject=c);let d={create:{reqOpts:{qs:u}},delete:{reqOpts:{qs:u}},exists:{reqOpts:{qs:u}},get:{reqOpts:{qs:u}},getMetadata:{reqOpts:{qs:u}},setMetadata:{reqOpts:{qs:u}}};super({parent:t,baseUrl:"/b",id:n,createMethod:t.createBucket.bind(t),methods:d}),this.name=n,this.storage=t,this.userProject=i.userProject,this.acl=new jX({request:this.request.bind(this),pathPrefix:"/acl"}),this.acl.default=new jX({request:this.request.bind(this),pathPrefix:"/defaultObjectAcl"}),this.crc32cGenerator=i.crc32cGenerator||this.storage.crc32cGenerator,this.iam=new cwe(this),this.getFilesStream=Nsn.paginator.streamify("getFiles"),this.instanceRetryValue=t.retryOptions.autoRetry,this.instancePreconditionOpts=i?.preconditionOpts}get cloudStorageURI(){let t=new GAs.URL("gs://");return t.host=this.name,t}addLifecycleRule(t,n,i){let o={};typeof n=="function"?i=n:n&&(o=n),o=o||{};let s=Array.isArray(t)?t:[t];for(let a of s)a.condition.createdBefore instanceof Date&&(a.condition.createdBefore=a.condition.createdBefore.toISOString().replace(/T.+$/,"")),a.condition.customTimeBefore instanceof Date&&(a.condition.customTimeBefore=a.condition.customTimeBefore.toISOString().replace(/T.+$/,"")),a.condition.noncurrentTimeBefore instanceof Date&&(a.condition.noncurrentTimeBefore=a.condition.noncurrentTimeBefore.toISOString().replace(/T.+$/,""));if(o.append===!1){this.setMetadata({lifecycle:{rule:s}},o,i);return}this.getMetadata((a,l)=>{var u,c;if(a){i(a);return}let d=Array.isArray((u=l.lifecycle)===null||u===void 0?void 0:u.rule)?(c=l.lifecycle)===null||c===void 0?void 0:c.rule:[];this.setMetadata({lifecycle:{rule:d.concat(s)}},o,i)})}combine(t,n,i,o){var s;if(!Array.isArray(t)||t.length===0)throw new Error(UN.PROVIDE_SOURCE_FILE);if(!n)throw new Error(UN.DESTINATION_FILE_NOT_SPECIFIED);let a={};typeof i=="function"?o=i:i&&(a=i),this.disableAutoRetryConditionallyIdempotent_(this.methods.setMetadata,kB.setMetadata,a);let l=d=>d instanceof zN?d:this.file(d);t=t.map(l);let u=l(n);if(o=o||wl.noop,!u.metadata.contentType){let d=qAs.contentType(u.name);d&&(u.metadata.contentType=d)}let c=this.storage.retryOptions.maxRetries;(((s=u?.instancePreconditionOpts)===null||s===void 0?void 0:s.ifGenerationMatch)===void 0&&a.ifGenerationMatch===void 0&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(c=0),a.ifGenerationMatch===void 0&&Object.assign(a,u.instancePreconditionOpts,a),u.request({method:"POST",uri:"/compose",maxRetries:c,json:{destination:{contentType:u.metadata.contentType},sourceObjects:t.map(d=>{let p={name:d.name};return d.metadata&&d.metadata.generation&&(p.generation=parseInt(d.metadata.generation.toString())),p})},qs:a},(d,p)=>{if(this.storage.retryOptions.autoRetry=this.instanceRetryValue,d){o(d,null,p);return}o(null,u,p)})}createChannel(t,n,i,o){if(typeof t!="string")throw new Error(UN.CHANNEL_ID_REQUIRED);let s={};typeof i=="function"?o=i:i&&(s=i),this.request({method:"POST",uri:"/o/watch",json:Object.assign({id:t,type:"web_hook"},n),qs:s},(a,l)=>{if(a){o(a,null,l);return}let u=l.resourceId,c=this.storage.channel(t,u);c.metadata=l,o(null,c,l)})}createNotification(t,n,i){let o={};if(typeof n=="function"?i=n:n&&(o=n),t!==null&&typeof t=="object"&&wl.isCustomType(t,"pubsub/topic")&&(t=t.name),typeof t!="string")throw new Error(UN.TOPIC_NAME_REQUIRED);let a=Object.assign({topic:t},o);a.topic.indexOf("projects")!==0&&(a.topic="projects/{{projectId}}/topics/"+a.topic),a.topic=`//pubsub.${this.storage.universeDomain}/`+a.topic,a.payloadFormat||(a.payloadFormat="JSON_API_V1");let l={};a.userProject&&(l.userProject=a.userProject,delete a.userProject),this.request({method:"POST",uri:"/notificationConfigs",json:sPt(a),qs:l,maxRetries:0},(u,c)=>{if(u){i(u,null,c);return}let d=this.notification(c.id);d.metadata=c,i(null,d,c)})}deleteFiles(t,n){let i={};typeof t=="function"?n=t:t&&(i=t);let o=10,s=1e3,a=[],l=u=>u.delete(i).catch(c=>{if(!i.force)throw c;a.push(c)});(async()=>{try{let u=[],c=(0,Msn.default)(o),d=this.getFilesStream(i);for await(let p of d)u.length>=s&&(await Promise.all(u),u=[]),u.push(c(()=>l(p)).catch(A=>{throw d.destroy(),A}));await Promise.all(u),n(a.length>0?a:null)}catch(u){n(u);return}})()}deleteLabels(t,n,i){let o=new Array,s={};typeof t=="function"?i=t:typeof t=="string"?o=[t]:Array.isArray(t)?o=t:t&&(s=t),typeof n=="function"?i=n:n&&(s=n);let a=l=>{let u=l.reduce((c,d)=>(c[d]=null,c),{});s?.ifMetagenerationMatch!==void 0?this.setLabels(u,s,i):this.setLabels(u,i)};o.length===0?this.getLabels((l,u)=>{if(l){i(l);return}a(Object.keys(u))}):a(o)}disableRequesterPays(t,n){let i={};typeof t=="function"?n=t:t&&(i=t),this.setMetadata({billing:{requesterPays:!1}},i,n)}enableLogging(t,n){if(!t||typeof t=="function"||typeof t.prefix>"u")throw new Error(UN.CONFIGURATION_OBJECT_PREFIX_REQUIRED);let i=this.id;t.bucket&&t.bucket instanceof r?i=t.bucket.id:t.bucket&&typeof t.bucket=="string"&&(i=t.bucket);let o={};t?.ifMetagenerationMatch&&(o.ifMetagenerationMatch=t.ifMetagenerationMatch),t?.ifMetagenerationNotMatch&&(o.ifMetagenerationNotMatch=t.ifMetagenerationNotMatch),(async()=>{try{let[s]=await this.iam.getPolicy();s.bindings.push({members:["group:cloud-storage-analytics@google.com"],role:"roles/storage.objectCreator"}),await this.iam.setPolicy(s),this.setMetadata({logging:{logBucket:i,logObjectPrefix:t.prefix}},o,n)}catch(s){n(s);return}})()}enableRequesterPays(t,n){let i={};typeof t=="function"?n=t:t&&(i=t),this.setMetadata({billing:{requesterPays:!0}},i,n)}file(t,n){if(!t)throw Error(UN.SPECIFY_FILE_NAME);return new zN(this,t,n)}getFiles(t,n){let i=typeof t=="object"?t:{};n||(n=t),i=Object.assign({},i),this.request({uri:"/o",qs:i},(o,s)=>{if(o){n(o,null,null,s);return}let l=(s.items?s.items:[]).map(c=>{let d={};i.versions&&(d.generation=c.generation),c.kmsKeyName&&(d.kmsKeyName=c.kmsKeyName);let p=this.file(c.name,d);return p.metadata=c,p}),u=null;s.nextPageToken&&(u=Object.assign({},i,{pageToken:s.nextPageToken})),n(null,l,u,s)})}getLabels(t,n){let i={};typeof t=="function"?n=t:t&&(i=t),this.getMetadata(i,(o,s)=>{if(o){n(o,null);return}n(null,s?.labels||{})})}getNotifications(t,n){let i={};typeof t=="function"?n=t:t&&(i=t),this.request({uri:"/notificationConfigs",qs:i},(o,s)=>{if(o){n(o,null,s);return}let l=(s.items?s.items:[]).map(u=>{let c=this.notification(u.id);return c.metadata=u,c});n(null,l,s)})}getSignedUrl(t,n){let o={method:Dsn[t.action],expires:t.expires,version:t.version,cname:t.cname,extensionHeaders:t.extensionHeaders||{},queryParams:t.queryParams||{},host:t.host,signingEndpoint:t.signingEndpoint};this.signer||(this.signer=new awe(this.storage.authClient,this,void 0,this.storage)),this.signer.getSignedUrl(o).then(s=>n(null,s),n)}lock(t,n){let i=typeof t;if(i!=="number"&&i!=="string")throw new Error(UN.METAGENERATION_NOT_PROVIDED);this.request({method:"POST",uri:"/lockRetentionPolicy",qs:{ifMetagenerationMatch:t}},n)}makePrivate(t,n){var i,o,s,a;let l=typeof t=="object"?t:{};n=typeof t=="function"?t:n,l.private=!0;let u={predefinedAcl:"projectPrivate"};l.userProject&&(u.userProject=l.userProject),!((i=l.preconditionOpts)===null||i===void 0)&&i.ifGenerationMatch&&(u.ifGenerationMatch=l.preconditionOpts.ifGenerationMatch),!((o=l.preconditionOpts)===null||o===void 0)&&o.ifGenerationNotMatch&&(u.ifGenerationNotMatch=l.preconditionOpts.ifGenerationNotMatch),!((s=l.preconditionOpts)===null||s===void 0)&&s.ifMetagenerationMatch&&(u.ifMetagenerationMatch=l.preconditionOpts.ifMetagenerationMatch),!((a=l.preconditionOpts)===null||a===void 0)&&a.ifMetagenerationNotMatch&&(u.ifMetagenerationNotMatch=l.preconditionOpts.ifMetagenerationNotMatch);let c={...l.metadata,acl:null};this.setMetadata(c,u,d=>{d&&n(d),(l.includeFiles?(0,xsn.promisify)(this.makeAllFilesPublicPrivate_).call(this,l):Promise.resolve([])).then(A=>n(null,A)).catch(n)})}makePublic(t,n){let i=typeof t=="object"?t:{};n=typeof t=="function"?t:n;let o={public:!0,...i};this.acl.add({entity:"allUsers",role:"READER"}).then(()=>this.acl.default.add({entity:"allUsers",role:"READER"})).then(()=>o.includeFiles?(0,xsn.promisify)(this.makeAllFilesPublicPrivate_).call(this,o):[]).then(s=>n(null,s),n)}notification(t){if(!t)throw new Error(UN.SUPPLY_NOTIFICATION_ID);return new uwe(this,t)}removeRetentionPeriod(t,n){let i=typeof t=="object"?t:{};n=typeof t=="function"?t:n,this.setMetadata({retentionPolicy:null},i,n)}request(t,n){return this.userProject&&(!t.qs||!t.qs.userProject)&&(t.qs={...t.qs,userProject:this.userProject}),super.request(t,n)}setLabels(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,i=i||wl.noop,this.setMetadata({labels:t},o,i)}setMetadata(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,this.disableAutoRetryConditionallyIdempotent_(this.methods.setMetadata,kB.setMetadata,o),super.setMetadata(t,o).then(s=>i(null,...s)).catch(i).finally(()=>{this.storage.retryOptions.autoRetry=this.instanceRetryValue})}setRetentionPeriod(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,this.setMetadata({retentionPolicy:{retentionPeriod:t.toString()}},o,i)}setCorsConfiguration(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,this.setMetadata({cors:t},o,i)}setStorageClass(t,n,i){let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,t=t.replace(/-/g,"_").replace(/([a-z])([A-Z])/g,(s,a,l)=>a+"_"+l).toUpperCase(),this.setMetadata({storageClass:t},o,i)}setUserProject(t){this.userProject=t,["create","delete","exists","get","getMetadata","setMetadata"].forEach(i=>{let o=this.methods[i];typeof o=="object"&&(typeof o.reqOpts=="object"?Object.assign(o.reqOpts.qs,{userProject:t}):o.reqOpts={qs:{userProject:t}})})}upload(t,n,i){var o,s;let a=d=>{let p=(0,jAs.default)(async A=>{await new Promise((f,h)=>{var y,C;d===0&&(!((C=(y=c?.storage)===null||y===void 0?void 0:y.retryOptions)===null||C===void 0)&&C.autoRetry)&&(c.storage.retryOptions.autoRetry=!1);let O=c.createWriteStream(l);l.onUploadProgress&&O.on("progress",l.onUploadProgress),zAs.createReadStream(t).on("error",A).pipe(O).on("error",w=>this.storage.retryOptions.autoRetry&&this.storage.retryOptions.retryableErrorFn(w)?h(w):A(w)).on("finish",()=>f())})},{retries:d,factor:this.storage.retryOptions.retryDelayMultiplier,maxTimeout:this.storage.retryOptions.maxRetryDelay*1e3,maxRetryTime:this.storage.retryOptions.totalTimeout*1e3});return i?p.then(()=>{if(i)return i(null,c,c.metadata)}).catch(i):p};if(global.GCLOUD_SANDBOX_ENV)return;let l=typeof n=="object"?n:{};i=typeof n=="function"?n:i,l=Object.assign({metadata:{}},l);let u=this.storage.retryOptions.maxRetries;(((o=l?.preconditionOpts)===null||o===void 0?void 0:o.ifGenerationMatch)===void 0&&((s=this.instancePreconditionOpts)===null||s===void 0?void 0:s.ifGenerationMatch)===void 0&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional||this.storage.retryOptions.idempotencyStrategy===rA.RetryNever)&&(u=0);let c;if(l.destination instanceof zN)c=l.destination;else if(l.destination!==null&&typeof l.destination=="string")c=this.file(l.destination,{encryptionKey:l.encryptionKey,kmsKeyName:l.kmsKeyName,preconditionOpts:this.instancePreconditionOpts});else{let d=UAs.basename(t);c=this.file(d,{encryptionKey:l.encryptionKey,kmsKeyName:l.kmsKeyName,preconditionOpts:this.instancePreconditionOpts})}a(u)}makeAllFilesPublicPrivate_(t,n){let o=[],s=[],a=typeof t=="object"?t:{};n=typeof t=="function"?t:n;let l=async u=>{try{await(a.public?u.makePublic():u.makePrivate(a)),s.push(u)}catch(c){if(!a.force)throw c;o.push(c)}};this.getFiles(a).then(([u])=>{let c=(0,Msn.default)(10),d=u.map(p=>c(()=>l(p)));return Promise.all(d)}).then(()=>n(o.length>0?o:null,s),u=>n(u,s))}getId(){return this.id}disableAutoRetryConditionallyIdempotent_(t,n,i){var o,s;typeof t=="object"&&((s=(o=t?.reqOpts)===null||o===void 0?void 0:o.qs)===null||s===void 0?void 0:s.ifMetagenerationMatch)===void 0&&i?.ifMetagenerationMatch===void 0&&(n===kB.setMetadata||n===kB.delete)&&this.storage.retryOptions.idempotencyStrategy===rA.RetryConditional?this.storage.retryOptions.autoRetry=!1:this.storage.retryOptions.idempotencyStrategy===rA.RetryNever&&(this.storage.retryOptions.autoRetry=!1)}};Nsn.paginator.extend(qN,"getFiles");(0,FAs.promisifyAll)(qN,{exclude:["cloudStorageURI","request","file","notification"]});var VAs=yt(wh(),1),Lle=class extends EI{constructor(t,n,i){let o={parent:t,baseUrl:"/channels",id:"",methods:{}};super(o),this.metadata.id=n,this.metadata.resourceId=i}stop(t){t=t||wl.noop,this.request({method:"POST",uri:"/stop",json:this.metadata},(n,i)=>{t(n,i)})}};(0,VAs.promisifyAll)(Lle);var YAs=yt(iwe(),1);var HAs=yt(wh(),1),Fle=class extends EI{constructor(t,n,i){let o={delete:!0,get:!0,getMetadata:!0,setMetadata:{reqOpts:{method:"PUT"}}},s=i&&i.projectId||t.projectId;super({parent:t,id:n,baseUrl:`/projects/${s}/hmacKeys`,methods:o}),this.storage=t,this.instanceRetryValue=t.retryOptions.autoRetry}setMetadata(t,n,i){this.storage.retryOptions.idempotencyStrategy!==rA.RetryAlways&&(this.storage.retryOptions.autoRetry=!1);let o=typeof n=="object"?n:{};i=typeof n=="function"?n:i,super.setMetadata(t,o).then(s=>i(null,...s)).catch(i).finally(()=>{this.storage.retryOptions.autoRetry=this.instanceRetryValue})}};(0,HAs.promisifyAll)(Fle);var JAs=yt(Vb(),1),rA;(function(r){r[r.RetryAlways=0]="RetryAlways",r[r.RetryConditional=1]="RetryConditional",r[r.RetryNever=2]="RetryNever"})(rA||(rA={}));var FN;(function(r){r.EXPIRATION_DATE_INVALID="The expiration date provided was invalid.",r.EXPIRATION_DATE_PAST="An expiration date cannot be in the past."})(FN||(FN={}));var dwe;(function(r){r.BUCKET_NAME_REQUIRED="A bucket name is needed to use Cloud Storage.",r.BUCKET_NAME_REQUIRED_CREATE="A name is required to create a bucket.",r.HMAC_SERVICE_ACCOUNT="The first argument must be a service account email to create an HMAC key.",r.HMAC_ACCESS_ID="An access ID is needed to create an HmacKey object."})(dwe||(dwe={}));var fn0=/^(\w*):\/\//,hn0=!0,gn0=3,mn0=2,yn0=600,En0=64,bn0=rA.RetryConditional,Cn0=function(r){var t;let n=i=>i.includes("eai_again")||i==="econnreset"||i==="unexpected connection closure"||i==="epipe"||i==="socket connection timeout";if(r){if([408,429,500,502,503,504].indexOf(r.code)!==-1)return!0;if(typeof r.code=="string"){if(["408","429","500","502","503","504"].indexOf(r.code)!==-1)return!0;let i=r.code.toLowerCase();if(n(i))return!0}if(r.errors)for(let i of r.errors){let o=(t=i?.reason)===null||t===void 0?void 0:t.toString().toLowerCase();if(o&&n(o))return!0}}return!1};var e_=class r extends wVe{getBucketsStream(){return new Psn.Readable}getHmacKeysStream(){return new Psn.Readable}constructor(t={}){var n,i,o,s,a,l,u,c,d,p,A,f,h,y;let O=`https://storage.${t.universeDomain||JAs.DEFAULT_UNIVERSE}`,w=!1,T=process.env.STORAGE_EMULATOR_HOST;typeof T=="string"&&(O=r.sanitizeEndpoint(T),w=!0),t.apiEndpoint&&(O=r.sanitizeEndpoint(t.apiEndpoint),w=!0),t=Object.assign({},t,{apiEndpoint:O});let R=T||`${t.apiEndpoint}/storage/v1`,P={apiEndpoint:t.apiEndpoint,retryOptions:{autoRetry:((n=t.retryOptions)===null||n===void 0?void 0:n.autoRetry)!==void 0?(i=t.retryOptions)===null||i===void 0?void 0:i.autoRetry:hn0,maxRetries:!((o=t.retryOptions)===null||o===void 0)&&o.maxRetries?(s=t.retryOptions)===null||s===void 0?void 0:s.maxRetries:gn0,retryDelayMultiplier:!((a=t.retryOptions)===null||a===void 0)&&a.retryDelayMultiplier?(l=t.retryOptions)===null||l===void 0?void 0:l.retryDelayMultiplier:mn0,totalTimeout:!((u=t.retryOptions)===null||u===void 0)&&u.totalTimeout?(c=t.retryOptions)===null||c===void 0?void 0:c.totalTimeout:yn0,maxRetryDelay:!((d=t.retryOptions)===null||d===void 0)&&d.maxRetryDelay?(p=t.retryOptions)===null||p===void 0?void 0:p.maxRetryDelay:En0,retryableErrorFn:!((A=t.retryOptions)===null||A===void 0)&&A.retryableErrorFn?(f=t.retryOptions)===null||f===void 0?void 0:f.retryableErrorFn:Cn0,idempotencyStrategy:((h=t.retryOptions)===null||h===void 0?void 0:h.idempotencyStrategy)!==void 0?(y=t.retryOptions)===null||y===void 0?void 0:y.idempotencyStrategy:bn0},baseUrl:R,customEndpoint:w,useAuthWithCustomEndpoint:t?.useAuthWithCustomEndpoint,projectIdRequired:!1,scopes:["https://www.googleapis.com/auth/iam","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/devstorage.full_control"],packageJson:(0,YAs.getPackageJSON)()};super(P,t),this.acl=r.acl,this.crc32cGenerator=t.crc32cGenerator||APt,this.retryOptions=P.retryOptions,this.getBucketsStream=EPt.paginator.streamify("getBuckets"),this.getHmacKeysStream=EPt.paginator.streamify("getHmacKeys")}static sanitizeEndpoint(t){return fn0.test(t)||(t=`https://${t}`),t.replace(/\/+$/,"")}bucket(t,n){if(!t)throw new Error(dwe.BUCKET_NAME_REQUIRED);return new qN(this,t,n)}channel(t,n){return new Lle(this,t,n)}createBucket(t,n,i){if(!t)throw new Error(dwe.BUCKET_NAME_REQUIRED_CREATE);let o;i?o=n:(i=n,o={});let s={...o,name:t},a={archive:"ARCHIVE",coldline:"COLDLINE",dra:"DURABLE_REDUCED_AVAILABILITY",multiRegional:"MULTI_REGIONAL",nearline:"NEARLINE",regional:"REGIONAL",standard:"STANDARD"},l=Object.keys(a);for(let c of l)if(s[c]){if(o.storageClass&&o.storageClass!==c)throw new Error(`Both \`${c}\` and \`storageClass\` were provided.`);s.storageClass=a[c],delete s[c]}s.requesterPays&&(s.billing={requesterPays:s.requesterPays},delete s.requesterPays);let u={project:this.projectId};s.userProject&&(u.userProject=s.userProject,delete s.userProject),s.enableObjectRetention&&(u.enableObjectRetention=s.enableObjectRetention,delete s.enableObjectRetention),this.request({method:"POST",uri:"/b",qs:u,json:s},(c,d)=>{if(c){i(c,null,d);return}let p=this.bucket(t);p.metadata=d,i(null,p,d)})}createHmacKey(t,n,i){if(typeof t!="string")throw new Error(dwe.HMAC_SERVICE_ACCOUNT);let{options:o,callback:s}=Zw(n,i),a=Object.assign({},o,{serviceAccountEmail:t}),l=a.projectId||this.projectId;delete a.projectId,this.request({method:"POST",uri:`/projects/${l}/hmacKeys`,qs:a,maxRetries:0},(u,c)=>{if(u){s(u,null,null,c);return}let d=c.metadata,p=this.hmacKey(d.accessId,{projectId:d.projectId});p.metadata=c.metadata,s(null,p,c.secret,c)})}getBuckets(t,n){let{options:i,callback:o}=Zw(t,n);i.project=i.project||this.projectId,this.request({uri:"/b",qs:i},(s,a)=>{if(s){o(s,null,null,a);return}let u=(a.items?a.items:[]).map(d=>{let p=this.bucket(d.id);return p.metadata=d,p}),c=a.nextPageToken?Object.assign({},i,{pageToken:a.nextPageToken}):null;o(null,u,c,a)})}getHmacKeys(t,n){let{options:i,callback:o}=Zw(t,n),s=Object.assign({},i),a=s.projectId||this.projectId;delete s.projectId,this.request({uri:`/projects/${a}/hmacKeys`,qs:s},(l,u)=>{if(l){o(l,null,null,u);return}let d=(u.items?u.items:[]).map(A=>{let f=this.hmacKey(A.accessId,{projectId:A.projectId});return f.metadata=A,f}),p=u.nextPageToken?Object.assign({},i,{pageToken:u.nextPageToken}):null;o(null,d,p,u)})}getServiceAccount(t,n){let{options:i,callback:o}=Zw(t,n);this.request({uri:`/projects/${this.projectId}/serviceAccount`,qs:i},(s,a)=>{if(s){o(s,null,a);return}let l={};for(let u in a)if(a.hasOwnProperty(u)){let c=u.replace(/_(\w)/g,(d,p)=>p.toUpperCase());l[c]=a[u]}o(null,l,a)})}hmacKey(t,n){if(!t)throw new Error(dwe.HMAC_ACCESS_ID);return new Fle(this,t,n)}};e_.Bucket=qN;e_.Channel=Lle;e_.File=zN;e_.HmacKey=Fle;e_.acl={OWNER_ROLE:"OWNER",READER_ROLE:"READER",WRITER_ROLE:"WRITER"};EPt.paginator.extend(e_,["getBuckets","getHmacKeys"]);(0,KAs.promisifyAll)(e_,{exclude:["bucket","channel","hmacKey"]});var On0=yt(Vse(),1);var wn0=yt(Vb(),1),XAs=yt(uCe(),1),_n0=yt(q4(),1);var $As=yt(iwe(),1);var In0,vn0,Sn0,Tn0=(0,$As.getPackageJSON)();var dGp=32*1024*1024,pGp=32*1024*1024,AGp=32*1024*1024;var ksn={UPLOAD_MANY:"tm.upload_many",DOWNLOAD_MANY:"tm.download_many",UPLOAD_SHARDED:"tm.upload_sharded",DOWNLOAD_SHARDED:"tm.download_sharded"};In0=new WeakSet,vn0=function(t={}){let n=!1,i=!1;for(let[o,s]of Object.entries(t))o.toLocaleLowerCase().trim()==="x-goog-api-client"?(n=!0,s.includes(ksn.UPLOAD_SHARDED)||(t[o]=`${s} gccl-gcs-cmd/${ksn.UPLOAD_SHARDED}`)):o.toLocaleLowerCase().trim()==="user-agent"&&(i=!0);return n||(t["x-goog-api-client"]=`${QN()} gccl/${Tn0.version} gccl-gcs-cmd/${ksn.UPLOAD_SHARDED}`),i||(t["User-Agent"]=LN()),t},Sn0=function(t,n){if(this.bucket.storage.retryOptions.autoRetry&&this.bucket.storage.retryOptions.retryableErrorFn(t))throw t;n(t)};cte();var Bn0=yt(msn());PS();qt();f1();var RVe=class{whereClauseDisjunctionLimits={in:30,"not-in":10,"array-contains-any":30};async selectInBatches(t,n,i,o,s){let a=[],l=this.whereClauseDisjunctionLimits[i];for(let u=0;u<o.length;u+=l){let c=o.slice(u,u+l),d=this.createQuery(t,{where:[...s,[n,i,c]]}),p=await this.runQuery(d);a.push(p)}return a.flat()}};var kGp=av.getTracer("repository");Hi();f1();var Rn0=500,Mn0=10*1024*1024,xn0=.7*Mn0,bPt=class{constructor(t){this.firestoreOperations=t;this.batch=t.batch(),this.batchSize=0,this.requestSize=0,this.batchesCommitted=0,this.batchesToCommit=[this.batch]}batch;batchSize;requestSize;batchesCommitted;batchesToCommit;batchIncrement=async(t,n)=>{let i=lut(t)+lut(n),o=this.requestSize+i>=xn0,s=this.batchSize+1>=Rn0;o||s?(this.batchSize=1,this.requestSize=i,this.batch=this.firestoreOperations.batch(),this.batchesToCommit.push(this.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(){if(ua().info("committing batches!"),this.batchSize)for(let t of this.batchesToCommit)this.batchesCommitted+=1,await this.firestoreOperations.commitBatch(t);return this.batchesCommitted}};qt();var CPt=r=>r?r?.message??"":"",Dn0=r=>/(PERMISSION_DENIED)|(false for 'get')|(false for 'list')|(false for 'update')|(false for 'delete')|(Missing or insufficient permissions.)/.test(CPt(r)),Nn0=r=>/NOT_FOUND/.test(CPt(r)),MVe=r=>Dn0(r)?new D2("Permission denied",CPt(r)):Nn0(r)?new $s("Not found",CPt(r)):r,QB=async r=>{try{return await r}catch(t){throw MVe(t)}};var HX=class extends XP{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 QB(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}};var IPt=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)}};pr();Hi();KP();No();f1();var bo=class extends HX{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 QB(o.getQuery(s)):a=await QB(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 QB(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={...ca(n),id:i,createdAt:m6(),createdBy:s,updatedAt:m6(),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,u)=>{try{let c=this.transformDataFromStorage(u.doc.ref,u.doc.data(),o);l.push({type:u.type==="added"?"added":u.type==="removed"?"removed":"modified",value:c,id:c.id.toString(),hasPendingWrites:this.firestoreOperations.hasPendingWrites(u.doc)})}catch(c){i&&i(c)}return l},[]);ua().debug(`Listener notification for ${a.length} changes in collection ${this.path}`),n(a)},s=>{ua().error(`Firestore error listening to collection ${this.path}`,s),i&&i(MVe(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,o,s=[]){return(await this.firestoreOperations.selectInBatches(this.collectionRef,n,i,o,s)).map(u=>u.docs).flat().map(u=>this.transformDataFromStorage(u.ref,this.firestoreOperations.data(u)))}};No();qt();f1();m7();f1();var ZAs=async(r,t)=>{let{attempts:n,tags:i,waitSeconds:o}=t,s=ua().child({retryOptions:{maxAttempts:n,waitSeconds:o},tags:["[withRetries]",...i]});Np(n>=2,`Retry attempts value must be at least '2', but was '${n}'`,s);try{let a=await r();return s.info("Operation succeeded without retrying"),a}catch(a){s.error("Operation initial attempt failed; retrying. Error:",a);let l,u=n-1;do{u--,await new Promise(c=>setTimeout(c,o*(n-u)*1e3));try{let c=await r();return s.info(`Operation succeeded on retry (attempt ${n-u})`),c}catch(c){s.error(`Operation failed on retry (attempt ${n-u}). Error:`,c),l=c}}while(u);throw s.error("Exhausted all retry attempts; exiting"),l}};var Co=class extends HX{constructor(n,i,o,s,a,l,u=[]){super(n,i,u,s,a,l);this.docRef=i;this.dataTransform=o}get path(){return this.docRef.path}async fetch(n){let i=n?.transaction,o=i?()=>i.get(this.docRef):()=>this.firestoreOperations.getDoc(this.docRef,n),s=n?.retryOptions,l=await QB((s?()=>ZAs(o,{...s,tags:[...s.tags,"[FirestoreEntityRepository.fetch()]",`[${this.path}]`]}):o)());if(!l.exists)throw ua().info(`Document ${this.path} not found`),new $s(`Entity ${this.path} not found`);return this.dataTransform.fromStorage(this.id.toString(),this.path,this.firestoreOperations.data(l),this.firestoreOperations,n)}async save(n,i){let o=i?.transaction,s=this.prepareDataForSave(n,i);o?o.set(this.docRef,s):await QB(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 QB(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 QB(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{ua().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 ua().debug(`Listener notification for document ${this.path} removed`),n({type:"removed",id:a.id,hasPendingWrites:this.firestoreOperations.hasPendingWrites(a)})},a=>{ua().error(`Firestore error listening to document ${this.path}`,a),i&&i(MVe(a))})}prepareDataForSave(n,i){if(n.id&&n.id?.toString()!==this.docRef.id)throw new Qi(`Attempt to assign a new ID to entity ${this.path} `);let o=this.firestoreOperations.currentUser(),s=this.id.toString(),a={id:this.id,...ca(n),createdAt:n.createdAt??m6(),createdBy:n.createdBy??o,updatedAt:m6(),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 Qi(`Attempt to assign a new ID to entity ${this.path} `);let s={...ca(n),updatedAt:m6(),updatedBy:this.firestoreOperations.currentUser()};return this.dataTransform.mergeToStorage(this.id.toString(),this.path,s,this.firestoreOperations)}mergeWithDeletes(n,i){return tie(this.path,o=>o instanceof $te?[void 0,!0]:[o,!1],gGt(n,i))}};m1r();y1r();E1r();b1r();w1r();_1r();var Pn0=_.discriminatedUnion("type",[Gn.merge(Sn.merge(Im)),Gn.merge(Sn.merge(gut)),Gn.merge(Sn.merge(mut)),Gn.merge(Sn.merge(yut)),Gn.merge(Sn.merge(Eut)),Gn.merge(Sn.merge(vut)),Gn.merge(Sn.merge(Sut)),Gn.merge(Sn.merge(Out))]),kn0=Fi("Event",Pn0),efs=Vo(kn0),Qsn=class extends Co{constructor(t,n,i,o,s){super(t,n,efs,i,o,s)}},vPt=class extends bo{constructor(t,n,i,o){super(t,efs,n,i,o,Qsn)}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,u){let d={...this.createEventCore(t,"workspaces.nodeType.duplicate","NodeType",n,i,o,u),type:"duplicate",packageID:s,releaseID:a,workspaceID:l};return(await this.createEntity(d)).id}async createInstallPkgNodeTypeEvent(t,n,i,o,s,a){let u={...this.createEventCore(t,"workspaces.nodeType.install","NodeType",n,"",s,a),type:"install",packageID:n,releaseID:i,workspaceID:o};return(await this.createEntity(u)).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,u){let d={...this.createEventCore(t,"ai.description.columnDescriptions","AI","Description",n,n,u),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,u,c,d){let p=this.createEventCore(t,"workspaces.create.newWorkspace","NewWorkspace",i.toString(),c?.toString()??"",u,d),A=typeof s=="string"?new Date(s):s,f={...p,type:"create",projectID:n,stepNumber:o,startTime:A,endTime:a,status:l};return(await this.createEntity(f)).id}async createAINodeDescriptionTypeEvent(t,n,i,o,s,a){let u={...this.createEventCore(t,"ai.description.nodeDescription","AI",o,"",n,a),type:"update_node_description",workspaceID:i,nodeID:o,action:s};return(await this.createEntity(u)).id}async createAIGitCommitMessageRequestEvent(t,n,i,o,s,a,l){let c={...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(c)).id}async createAIGitCommitMessageActionEvent(t,n,i,o,s,a,l){let c={...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(c)).id}};Zn();var Qn0=Fi("Event",cai),tfs=Vo(Qn0),Lsn=class extends Co{constructor(t,n,i,o,s){super(t,n,tfs,i,o,s)}},SPt=class extends bo{constructor(t,n,i,o){super(t,tfs,n,i,o,Lsn)}};qt();Zn();Zn();df();Zn();var Ln0=Gn.merge(Poi),Fn0=Fi("GitAccount",Ln0),rfs=Vo(Fn0),Fsn=class extends Co{constructor(t,n,i,o,s){super(t,n,rfs,i,o,s)}},OPt=class extends bo{constructor(t,n,i,o){super(t,rfs,n,i,o,Fsn)}async generateID(t){return t.id??xs()}};df();Zn();var zn0=Gn.merge(bsi),qn0=Fi("ProjectGitAccount",zn0),nfs=Vo(qn0),zsn=class extends Co{constructor(t,n,i,o,s){super(t,n,nfs,i,o,s)}},wPt=class extends bo{constructor(t,n,i,o){super(t,nfs,n,i,o,zsn)}async generateID(t){return t.id??xs()}};var Un0=Gn.merge(Loi),jn0=Fi("GlobalUserSettings",Un0),ifs=Vo(jn0),qsn=class extends Co{constructor(t,n,i,o,s){super(t,n,ifs,i,o,s,["gitAccounts","projectGitAccounts"])}get gitAccounts(){return this.getSubCollection("gitAccounts",OPt)}gitAccount(t){return this.gitAccounts.get(t)}get projectGitAccounts(){return this.getSubCollection("projectGitAccounts",wPt)}projectGitAccount(t){return this.projectGitAccounts.get(t)}},_Pt=class extends bo{constructor(t,n,i,o){super(t,ifs,n,i,o,qsn)}listUsers(){return this.firestoreOperations.getChildren(this.collectionRef)}};df();Zn();var Wn0=Gn.merge(z1r),Gn0=Fi("Project",Wn0),ofs=Vo(Gn0),Usn=class extends Co{constructor(t,n,i,o,s){super(t,n,ofs,i,o,s)}},TPt=class extends bo{constructor(t,n,i,o){super(t,ofs,n,i,o,Usn)}async generateID(t){return t.id??xs()}};pr();qt();Zn();Ft();Zn();Ft();var Vn0=qe.FIREBASE,BPt=class extends pg{transformFromStorage(t,n,i){let o=i,s=[];return"endTime"in o&&(s.push("Removing property 'endTime'"),delete o.endTime),(!o.version||o.version<rfe)&&(s.push(`Updating version ${o.version} to ${rfe}`),o.version=rfe),o.runDetails&&!o.runDetails.environmentID&&("toWorkspaceID"in o.runDetails&&o.runDetails.toWorkspaceID!=null?(s.push(`Found runDetails.toWorkspaceID with value ${o.runDetails.toWorkspaceID}; setting to runDetails.environmentID`),o.runDetails.environmentID=o.runDetails.toWorkspaceID.toString()):(s.push('Setting missing runDetails.environmentID to "0"'),o.runDetails.environmentID="0")),o.runDetails&&"toWorkspaceID"in o.runDetails&&(s.push("Deleting runDetails.toWorkspaceID"),delete o.runDetails.toWorkspaceID),Vn0.debug(`Patched run ${n}`,s),o}};Zn();Ft();var Hn0=qe.FIREBASE,RPt=class extends pg{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 ${JV.toISOString} for query result ${a}`),s.startTime=JV),s.endTime||(o.push(`Setting 'endTime' to ${JV.toISOString} for query result ${a}`),s.endTime=JV),s.fields?.map((l,u)=>{o.push(`Setting 'type' to 'unknown' for field ${u} 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&&Hn0.debug(`Patched run result ${n}`,o),i}};var Kn0=Gn.merge(Dut),Yn0=Fi("QueryResult",Kn0),DPt=Vo(Yn0),jsn=class extends Co{constructor(t,n,i,o,s){super(t,n,DPt,i,o,s)}},Wsn=class extends bo{constructor(t,n,i,o){super(t,DPt,n,i,o,jsn)}},Gsn=class extends Co{constructor(t,n,i,o,s){super(t,n,DPt,i,o,s)}},Vsn=class extends bo{constructor(t,n,i,o){super(t,DPt,n,i,o,Gsn)}},Jn0=Gn.merge(Put),Xn0=Fi("RunResult",Jn0),NPt=Vo(Xn0,new RPt),Hsn=class extends Co{constructor(t,n,i,o,s){super(t,n,NPt,i,o,s,["queryResults"])}get queryResults(){return this.getSubCollection("queryResults",Wsn)}queryResult(t){return this.queryResults.get(t)}},MPt=class extends bo{constructor(t,n,i,o){super(t,NPt,n,i,o,Hsn)}},Ksn=class extends Co{constructor(t,n,i,o,s){super(t,n,NPt,i,o,s,["queryResults"])}get queryResults(){return this.getSubCollection("queryResults",Vsn)}queryResult(t){return this.queryResults.get(t)}},xPt=class extends bo{constructor(t,n,i,o){super(t,NPt,n,i,o,Ksn)}};var PPt=(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 KX=qe.FIREBASE,$n0=_.discriminatedUnion("runType",[Gn.merge(Z1r),Gn.merge(eAr),Gn.merge(tAr)]),Zn0=Fi("Run",$n0),LPt=Vo(Zn0,new BPt,!0),Ysn=class extends Co{constructor(t,n,i,o,s){super(t,n,LPt,i,{...o,runID:t},s,["runResults"])}get runResults(){return this.getSubCollection("runResults",MPt)}runResult(t){return this.runResults.get(t)}async updateHeartbeat(t={},n){return this.merge({...t,runHeartbeat:m6()},n)}},kPt=class extends bo{constructor(t,n,i,o){super(t,LPt,n,i,o,Ysn)}async createDeployRun(t,n){let i=PPt(t.runDetails.environmentID,Qi,this.logContext),o={...this.logContext,environmentID:i},s=(u,c)=>(SSr(u,"deploy",t.runDetails.forcedDeployment,o),{status:"Deploying",currentlyRunningJobs:u.currentlyRunningJobs?u.currentlyRunningJobs.concat(c):[c]}),a={...t,runDetails:{...t.runDetails}};if(delete a.runDetails.fromWorkspaceData,a.runDetails.version===2)for(let u of Lsi)delete a.runDetails[u];else for(let u of ksi)delete a.runDetails[u];let l=await Xsn(this,i,a,s,n);return u1e(o,l.id),KX.infoContext(o,"FirestoreOrgRepo createDeployRun: finished securing workspace"),l}async createRefreshRun(t,n){let i=PPt(t.runDetails.environmentID,Qi,this.logContext),o={...this.logContext,environmentID:i},a=await Xsn(this,i,t,(l,u)=>(SSr(l,"refresh",t.runDetails.forceIgnoreWorkspaceStatus,o),{status:l.status==="Failed Deploy"?l.status:"Refreshing",currentlyRunningJobs:l.currentlyRunningJobs?l.currentlyRunningJobs.concat(u):[u]}),n);return u1e(o,a.id),KX.infoContext(o,"FirestoreOrgRepo createRefreshRun: finished securing workspace"),a}},Jsn=class extends Co{constructor(t,n,i,o,s){super(t,n,LPt,i,{...o,runID:t},s,["runResults"])}get runResults(){return this.getSubCollection("runResults",xPt)}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)}},QPt=class extends bo{constructor(t,n,i,o){super(t,LPt,n,i,o,Jsn)}async createDevRun(t){let n=PPt(t.runDetails.environmentID,Qi,this.logContext),i={...this.logContext,environmentID:n},o=(a,l)=>{if(!a.devEnv)throw new Qi(`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 Xsn(this,n,t,o);return u1e(i,s.id),KX.infoContext(i,"FirestoreOrgRepo createDevRun: finished securing workspace"),s}},Xsn=(r,t,n,i,o)=>{let s=r.parent.workspace(t),a={...r.logContext,environmentID:t};return r.runTransaction(o,async l=>{KX.infoContext(a,"securing workspace status");let[u,c]=await Promise.all([s.fetch(l),r.parent.getNextCounter(r.id.substring(0,r.id.length-1),1,l)]);u1e(a,c),KX.infoContext(a,"got workspace doc data, updating workspace",{status:u?.status,jobs:u?.currentlyRunningJobs});let d=()=>{try{return i(u,c)}catch(f){if(KX.errorContext(a,"createRun: error updating workspace",{error:f}),f instanceof MV){let h=f.detail??`${u.name} is in state ${u.status},`;throw new N2(f.message,h+` context=${JSON.stringify(a)}.`)}throw f}};await s.merge(d(),l),KX.infoContext(a,`Run ${c} will use the following mappings:`,u.mappingsV1),KX.infoContext(a,"reserving run");let p=await r.prepareDataForCreate(n,c);p.runStartTime=r.firestoreOperations.getServerTimestampSentinel(),p.runHeartbeat=r.firestoreOperations.getServerTimestampSentinel();let A=r.get(c);return l.transaction.set(A.docRef,p),A})};Zn();Zn();var ei0=Gn.merge(n8),ti0=Fi("Macro",ei0),sfs=Vo(ti0,void 0,!0),$sn=class extends Co{constructor(t,n,i,o,s){super(t,n,sfs,i,o,s)}},FPt=class extends bo{constructor(t,n,i,o){super(t,sfs,n,i,o,$sn)}};Zn();var ri0=Gn.merge(XAe),ni0=Fi("NodeType",ri0),afs=Vo(ni0),Zsn=class extends Co{constructor(t,n,i,o,s){super(t,n,afs,i,o,s)}},zPt=class extends bo{constructor(t,n,i,o){super(t,afs,n,i,o,Zsn)}async generateID(t){return t.id??(await this.parent.parent.getNextCounter("template")).toString()}};df();pr();Hi();Zn();qt();var ii0=_.discriminatedUnion("type",[Gn.merge(Sn.merge(e8)),Gn.merge(Sn.merge(t8))]),oi0=Fi("Node",ii0),lfs=Vo(oi0,new i3t),ean=class extends Co{constructor(t,n,i,o,s){super(t,n,lfs,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)}},qPt=class extends bo{constructor(t,n,i,o){super(t,lfs,n,i,o,ean)}async generateID(t){return t.id??xs()}listenCollection(t,n,i){throw new Vl("The firestore nodes repository listener is not implemented. Use listenCollectionOverride")}listenCollectionOverride(t,n,i,o,s){let[a,l]=this.getListenCallbacks(t,o,s),u=this.firestoreOperations.onCollectionSnapshot(this.collectionRef.orderBy("updatedAt").startAfter(n),a,l),c=p=>{let f=[...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 O=new Date(C.updatedAt),w=y.deletedAt?y.deletedAt.toDate():O;return O<=w}else return!0;return!1}).map(h=>({type:"removed",value:{id:h.doc.id},id:h.doc.id,hasPendingWrites:!1}));t(f)},d=this.firestoreOperations.onCollectionSnapshot(this.collectionRef.parent.collection("deletedSteps").orderBy("deletedAt").startAfter(n),c,l);return()=>{u(),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=xoi.verify({operation:{...o.data()}});i[o.id]=s}),i}};qt();Zn();var si0=Gn.merge(Jte),ai0=Fi("Subgraph",si0),cfs=Vo(ai0),tan=class extends Co{constructor(t,n,i,o,s){super(t,n,cfs,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 N2(`${n.uniquenessConstraints.field} must be unique`);let a=this.prepareDataForMerge(t,n);return i.transaction.update(this.docRef,a)}):super.fetchAndMerge(t,n)}},UPt=class extends bo{constructor(t,n,i,o){super(t,cfs,n,i,o,tan)}async generateID(t){return t.id??(await this.parent.parent.getNextCounter("subgraph")).toString()}async createEntity(t,n){let i=await this.generateID(t);return n?.uniquenessConstraints?this.runTransaction(n,async o=>{if((await this.select({where:[[n.uniquenessConstraints.field,"in",n.uniquenessConstraints.values]]},o)).length>0)throw new N2(`${n.uniquenessConstraints.field} must be unique`);return super.createEntity({...t,id:i,folderCounter:i},o)}):super.createEntity({...t,id:i,folderCounter:i},n)}};pr();Zn();Ft();var li0=qe.FIREBASE,jPt=class extends pg{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&&li0.debug(`Patched workspace user ${n}`,o),i}};var ci0=_.union([Gn.merge(tDe),Gn.merge(rDe),Gn.merge(nDe)]),ui0=Fi("WorkspaceUser",ci0),ufs=Vo(ui0,new jPt),ran=class extends Co{constructor(t,n,i,o,s){super(t,n,ufs,i,o,s)}},WPt=class extends bo{constructor(t,n,i,o){super(t,ufs,n,i,o,ran)}};Ft();Zn();var di0=qe.FIREBASE,GPt=class extends pg{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 '${jAe}'`),o.version=jAe),o.tagColors||(s.push("Setting missing 'tagColors' property to default"),o.tagColors={backgroundColor:Ivr,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&&di0.debug(`Patched workspace ${n}:`,s),o}};qt();Zn();var pi0=Gn.merge(r8),Ai0=Fi("Job",pi0),dfs=Vo(Ai0),nan=class extends Co{constructor(t,n,i,o,s){super(t,n,dfs,i,o,s)}async fetchAndMerge(t,n){return n?.uniquenessConstraints?this.runTransaction(n,async i=>{let o=await this.fetch(i);if(o.name!==t.name&&(await this.parent.jobs.select({where:[[n.uniquenessConstraints.field,"in",n.uniquenessConstraints.values]]},i)).length>0)throw new N2(`${n.uniquenessConstraints.field} must be unique`);return super.save(super.mergeWithDeletes(o,t),i)}):super.fetchAndMerge(t,n)}},VPt=class extends bo{constructor(t,n,i,o){super(t,dfs,n,i,o,nan)}async generateID(t){return t.id??this.parent.parent.getNextCounter("job")}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 N2(`${n.uniquenessConstraints.field} must be unique`);return await super.createEntity(t,i)}):super.createEntity(t,n)}};Zn();var fi0=Gn.merge($Ae),hi0=Fi("InstalledPackage",fi0),pfs=Vo(hi0),ian=class extends Co{constructor(t,n,i,o,s){super(t,n,pfs,i,o,s)}},HPt=class extends bo{constructor(t,n,i,o){super(t,pfs,n,i,o,ian)}};df();uAr();var gi0=Gn.merge(lai),mi0=Fi("NodeLastRefreshed",gi0),Afs=Vo(mi0,void 0,!0),oan=class extends Co{constructor(t,n,i,o,s){super(t,n,Afs,i,{...o,nodeID:t},s)}},KPt=class extends bo{constructor(t,n,i,o){super(t,Afs,n,i,o,oan)}async generateID(t){return t.id??xs()}};var yi0=Gn.merge(put),Ei0=Fi("Workspace",yi0),ffs=Vo(Ei0,new GPt,!0),san=class extends Co{constructor(t,n,i,o,s){super(t,n,ffs,i,o,s,["jobs","macros","nodes","nodeTypes","subgraphs","users","installedPackages","nodesLastRefreshed"])}get installedPackages(){return this.getSubCollection("installedPackages",HPt)}installedPackage(t){return this.installedPackages.get(t)}get jobs(){return this.getSubCollection("jobs",VPt)}job(t){return this.jobs.get(t)}get macros(){return this.getSubCollection("macros",FPt)}macro(t){return this.macros.get(t)}get nodes(){return this.getSubCollection("steps",qPt)}node(t){return this.nodes.get(t)}get nodesLastRefreshed(){return this.getSubCollection("nodesLastRefreshed",KPt)}nodeLastRefreshed(t){return this.nodesLastRefreshed.get(t)}get nodeTypes(){return this.getSubCollection("templates",zPt)}nodeType(t){return this.nodeTypes.get(t)}get subgraphs(){return this.getSubCollection("folders",UPt)}subgraph(t){return this.subgraphs.get(t)}get users(){return this.getSubCollection("users",WPt)}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 c=[...l.docs].map(d=>({docRef:d.ref}));for(let d of c)await a.delete(d,{});await a.commit(),process.nextTick(()=>{i(o,s)})}catch(a){s(a)}};return new Promise((o,s)=>i(o,s))}},YPt=class extends bo{constructor(t,n,i,o){super(t,ffs,n,i,o,san)}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())}};Ft();var bi0=qe.FIREBASE,JPt=class extends pg{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&&bi0.debug(`Patched org ${n}`,o),i}};No();qt();Zn();Ft();Ft();var Ci0=qe.FIREBASE,XPt=class extends pg{transformFromStorage(t,n,i){let o=i,s=[];o.projects||(o.projects={},s.push("Changing userRoles.projects from undefined to empty object"));let a=(l,u,c,d)=>{let p=u.indexOf(c);p>=0&&(s.push(`Changing ${l} role '${c}' to '${d}'`),u[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 u of Object.values(l?.environments))u.environmentRoles?a("env",u.environmentRoles,"owner","admin"):(u.environmentRoles=[],s.push("Changing env.environmentRoles from undefined to empty array"))}return s.length>0&&Ci0.debug(`Patched userRoles ${n}`,s),i}};var zle=qe.USER_MANAGEMENT,Ii0=Gn.merge(tai),vi0=Fi("UserRoles",Ii0),hfs=Vo(vi0,new XPt),aan=class extends Co{constructor(t,n,i,o,s){super(t,n,hfs,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 u=ca(s.projects[n]);return Object.values(t.environments).forEach(c=>{t.projectRoles.includes("member")?c.environmentRoles=[]:t.projectRoles.includes("admin")?c.environmentRoles=["admin"]:c.environmentRoles=["reader"]}),s.projects[n]=t,await this.save(s,o),zle.infoContext(this.logContext,`User project roles updated for user ${s.id} at project ${n}. Previous roles:`,u,"New roles:",s.projects[n]),s})}async upsertProjectRole(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!=="admin"&&await this.throwIfLastProjectAdmin(n,o);let u=ca(s.projects[n]),c=s.projects[n];return c?c.projectRoles=[t]:s.projects[n]={projectRoles:[t],environments:{}},await this.save(s,o),zle.infoContext(this.logContext,`User project roles updated for user ${s.id} at project ${n}. Previous roles:`,u,"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(c){if(rd(c)&&(c instanceof $s||c instanceof D2))o={id:this.id,organizationRoles:[],projects:{}};else throw c}let s=o.organizationRoles.includes("admin"),a=t.includes("admin");s&&!a&&await this.throwIfLastOrgAdmin(i);let u=ca(o.organizationRoles);return o.organizationRoles=t,await this.save(o,i),zle.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 $s(`Environment ${i} not found`);let l=await this.fetch(s);if(!l.projects[n]?.projectRoles.length)throw new D2("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=ca(l.projects[n].environments[i]);return l.projects[n].environments[i]=t,await this.save(l,s),zle.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 upsertEnvironmentRole(t,n,i,o,s){return await this.runTransaction(s,async a=>{let l=await this.parent.workspace(i).fetch(a);if(l.project!==n||l.devEnv)throw new $s(`Environment ${i} not found`);let u=await this.fetch(a);if((u.projects[n]?.environments[i]?.environmentRoles.includes("admin")??!1)&&t!=="admin"&&await this.throwIfLastEnvironmentAdmin(n,i,a),!u.projects[n]?.projectRoles.length)if(o?.setDefaultProjectRole)u.projects[n]?u.projects[n].projectRoles=[o.setDefaultProjectRole]:u.projects[n]={projectRoles:[o.setDefaultProjectRole],environments:{}};else throw new D2("User must have a project role before being granted any environment roles therein");let p=ca(u.projects[n].environments[i]),A=u.projects[n].environments[i];return A?A.environmentRoles=[t]:u.projects[n].environments[i]={environmentRoles:[t]},await this.save(u,a),zle.infoContext(this.logContext,`User env roles updated for user ${u.id} at envID ${i} in project ${n}. Previous roles:`,p,"New roles:",u.projects[n].environments[i]),u})}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=ca(o.projects[t]);delete o.projects[t],await this.save(o,i),zle.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=ca(s.projects[t].environments[n]);delete s.projects[t].environments[n],await this.save(s,o),zle.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 N2("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 N2("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 N2("Role change failed, at least one environment admin is required")})}},$Pt=class extends bo{constructor(t,n,i,o){super(t,hfs,n,i,o,aan)}};var Si0=Gn.merge(xut),Oi0=Fi("Org",Si0),gfs=Vo(Oi0,new JPt),wi0={gitRepo:"gitRepo",workspace:"workspace",job:"job",subgraph:"folder",location:"location",connection:"connection",template:"template",run:"run",devRun:"devRun"},lan=class extends Co{constructor(t,n,i,o,s){super(t,n,gfs,i,{...o,orgID:t},s,["devRuns","globalUsersSettings","projects","runs","userRoles","workspaces"])}get devRuns(){return this.getSubCollection("devRuns",QPt)}devRun(t){return this.devRuns.get(t)}get globalUsersSettings(){return this.getSubCollection("globalUsersSettings",_Pt)}globalUsersSetting(t){return this.globalUsersSettings.get(t)}get projects(){return this.getSubCollection("projects",TPt)}project(t){return this.projects.get(t)}get runs(){return this.getSubCollection("runs",kPt)}run(t){return this.runs.get(t)}get userRoles(){return this.getSubCollection("userRoles",$Pt)}userRole(t){return this.userRoles.get(t)}get workspaces(){return this.getSubCollection("workspaces",YPt)}workspace(t){return this.workspaces.get(t)}async getNextCounter(t,n=1,i){if(!n||n<=0)throw new X$(`getNextCounter() expected reserveCount value greater than zero, received ${n}`);let o=wi0[t];if(!o)throw new X$(`getNextCounter() received unsupported counter name '${t}'`);return this.runTransaction(i,async s=>{let a=await this.fetch(s),l=`${o}Counter`,u=l in a?a[l]??0:0;return await this.merge({[l]:u+n},s),u+1})}async releaseWorkspaceStatusAndEndRun(t,n,i,o,s,a){return this.runTransaction(a,async l=>{let u=this.workspace(t),c=await u.fetch(l),{newStatus:d,remainingActiveRuns:p}=await o();c.status=d??c.status,i==="run"?c.currentlyRunningJobs=p:c.currentlyRunningDevJobs=p,await u.save(c,l);let A=this[i](n);return l.transaction.update(A.docRef,{...A.prepareDataForMerge(s,l),runEndTime:this.firestoreOperations.getServerTimestampSentinel()}),c.status})}async updateLastLoginTime(){let t=this.prepareDataForMerge({});t.lastLoginTime=this.firestoreOperations.getServerTimestampSentinel(),await this.firestoreOperations.updateDoc(this.docRef,t)}},ZPt=class extends bo{constructor(t,n,i,o){super(t,gfs,n,i,o,lan)}};Zn();var _i0=Gn.merge(hsi),Ti0=Fi("OrgPublic",_i0),mfs=Vo(Ti0),can=class extends Co{constructor(t,n,i,o,s){super(t,n,mfs,i,{...o,orgID:t},s)}},ekt=class extends bo{constructor(t,n,i,o){super(t,mfs,n,i,o,can)}};Zn();Zn();var Bi0=Gn.merge(Aut),Ri0=Fi("RegistryPackageRelease",Bi0),yfs=Vo(Ri0),uan=class extends Co{constructor(t,n,i,o,s){super(t,n,yfs,i,o,s)}},tkt=class extends bo{constructor(t,n,i,o){super(t,yfs,n,i,o,uan)}};var Mi0=Gn.merge(fut),xi0=Fi("RegistryPackage",Mi0),Efs=Vo(xi0),dan=class extends Co{constructor(t,n,i,o,s){super(t,n,Efs,i,o,s,["releases"])}get releases(){return this.getSubCollection("releases",tkt)}release(t){return this.releases.get(t)}},rkt=class extends bo{constructor(t,n,i,o){super(t,Efs,n,i,o,dan)}};Zn();var Di0=Gn.merge(oai),Ni0=Fi("ActivePrompt",Di0),bfs=Vo(Ni0),Pi0=Gn.merge(sai),ki0=Fi("PromptVersion",Pi0),Cfs=Vo(ki0),pan=class extends Co{constructor(t,n,i,o,s){super(t,n,bfs,i,{...o,nodeID:t},s)}},Aan=class extends Co{constructor(t,n,i,o,s){super(t,n,Cfs,i,{...o,nodeID:t},s)}},nkt=class extends bo{constructor(t,n,i,o){super(t,bfs,n,i,o,pan)}},ikt=class extends bo{constructor(t,n,i,o){super(t,Cfs,n,i,o,Aan)}};Zn();Ft();var Qi0=qe.FIREBASE,okt=class extends pg{transformFromStorage(t,n,i){return i.accountType||(Qi0.debug(`Patched user ${n}: Setting accountType to 'normal'`),i.accountType="normal"),i}};var Li0=Gn.merge(lAr),Fi0=Fi("User",Li0),Ifs=Vo(Fi0,new okt),fan=class extends Co{constructor(t,n,i,o,s){super(t,n,Ifs,i,o,s)}},skt=class extends bo{constructor(t,n,i,o){super(t,Ifs,n,i,o,fan)}};var akt=class extends HX{constructor(t){super("root",t.db,["orgs","users","packagesRegistry","events"],void 0,t.currentLogContext(),t)}get path(){return""}get orgs(){return this.getSubCollection("orgs",ZPt)}org(t){return this.orgs.get(t)}get orgsPublic(){return this.getSubCollection("orgsPublic",ekt)}orgPublic(t){return this.orgsPublic.get(t)}get users(){return this.getSubCollection("users",skt)}user(t){return this.users.get(t)}get packagesRegistry(){return this.getSubCollection("packagesRegistry",rkt)}registryPackage(t){return this.packagesRegistry.get(t)}get events(){return this.getSubCollection("events",vPt)}event(t){return this.events.get(t)}get oauthStates(){return this.getSubCollection("oauthState",SPt)}oauthState(t){return this.oauthStates.get(t)}get activePrompts(){return this.getSubCollection("activePrompts",nkt)}activePrompt(t){return this.activePrompts.get(t)}get promptVersions(){return this.getSubCollection("promptVersions",ikt)}promptVersion(t){return this.promptVersions.get(t)}batch(){return new bPt(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)return;o=void 0}}return i||o||this}storage(){return new IPt(this.firestoreOperations)}};qt();var zi0=["run","runs","devRun","devRuns"],qi0=["createEntity","save","delete","merge","fetchAndMerge","mergeMetadata"],qle=class r{providers;flaggedRepositoryParent;constructor(t,n,i,o,s){return this.providers=n,this.flaggedRepositoryParent=t,new Proxy(this,{get:(a,l)=>{if(l==="flaggedRepositoryParent")return t;if(l==="providers")return n;if(zi0.includes(l))return this.providers.firebase[l];if(l==="batch"&&t.id==="root")return s;let{providerId:u,shouldMutateBoth:c}=o(l,i);if(!(u in this.providers))throw new Ye("[FLAGGED_REPOSITORY] Attempted to access a flagged repository implementation that is not configured.",`Provider ID: ${u}`);let d=a.providers[u]?.[l];if(d instanceof XP){let p=Object.fromEntries(Object.entries(this.providers).map(([A,f])=>[A,f?.[l]]));return new r(d,p,{...i},o,s)}return typeof d=="function"?(...p)=>{let A=t?.[l],f=d,h=this.providers.firebase?.[l],y=this.providers.service?.[l],C=A||f,O={};if(c&&l==="createEntity"){let Q=t.generateID?.(p[0]);O.generateID=()=>Q}let w=A?.bind(Object.assign(t,O)),T=f?.bind(Object.assign(a.providers[u],O)),R=h?.bind(Object.assign(this.providers.firebase,O)),P=y?.bind(Object.assign(this.providers.service,O)),q=(w||T)?.(...p);if(q instanceof Promise&&(q=new Promise((Q,Y)=>{let j=q,k=[j];qi0.includes(l)&&c&&(C===h?k.push(P?.(...p)):k.push(R?.(...p))),Promise.allSettled(k).then(()=>{j.then(Q).catch(Y)}).catch(()=>{console.error("Promise allSettled failed unexpectedly")})})),!(q instanceof XP))return q;let H=Object.fromEntries(Object.entries(this.providers).map(([Q,Y])=>[Q,Y?.[l]?.bind(Y)?.(...p)])),V=i.orgId;l==="org"&&(V=p[0]),l==="get"&&t.id==="orgs"&&(V=p[0]);let U=l==="get"?q:T?.(...p);return new r(U,H,{...i,orgId:V},o,s)}:t[l]}})}},vfs=(r,t,n,i)=>new qle(r,t,{},n,i);No();qt();bm();var XE=class extends XP{constructor(n,i,o,s,a,l){super(n);this.id=n;this.collectionName=i;this.subCollectionNames=o;this.parent=s;this.logContext=a;this.serviceOperations=l}subCollections=[];async getToken(){return this.serviceOperations.getToken()}getSubCollection(n,i){let o=this.subCollections[n];return o||(o=new i(this,this.serviceOperations,this.logContext),this.subCollections[n]=o),o}};var Hg=class extends XE{constructor(n,i,o,s,a,l=[],u){super(n,i,l,s,a,u);this.dataTransform=o}async addAuthHeader(n={}){let i=await this.getToken();return i&&(n.Authorization=`Bearer ${i}`),n}get path(){return`${this.parent.path}/${this.collectionName}/${this.id}`}async fetch(n){let i=await this.addAuthHeader({}),s=(await(await hd).get(`${this.serviceOperations.hostname}${this.baseUri}/${this.id}`,{headers:i})).data;return this.dataTransform.fromStorage(this.id.toString(),this.path,s,n)}async save(n,i){let o=await this.addAuthHeader(),s=this.dataTransform.toStorage(this.id.toString(),this.path,n,i);await(await hd).put(`${this.serviceOperations.hostname}${this.baseUri}/${this.id}`,s,{headers:o})}async merge(n,i){let o=Object.entries(n).reduce((s,[a,l])=>(iTe(s,a,l),s),{});await this.fetchAndMerge(o,i)}async fetchAndMerge(n,i){let o=await this.addAuthHeader(),s=this.dataTransform.mergeToStorage(String(this.id),this.path,n,i);await(await hd).patch(`${this.serviceOperations.hostname}${this.baseUri}/${this.id}`,this.mapDataToPatchPayload(s),{headers:o})}async delete(){let n=await this.addAuthHeader({});await(await hd).delete(`${this.serviceOperations.hostname}${this.baseUri}/${this.id}`,{headers:n})}listen(){throw new Vl}mapDataToPatchPayload(n){let i=this.flattenToPaths(n);return Object.entries(i).reduce((s,[a,l])=>(l===Vut()?iTe(s.delete,a,!0):iTe(s.update,a,l),s),{update:{id:this.id},delete:{}})}flattenToPaths(n){let i={};function o(s,a){nTe(s,(l,u)=>{let c=a?`${a}.${u}`:u;Lu(l)&&!Array.isArray(l)?o(l,c):i[c]=l})}return o(n,""),i}};qt();No();var han=r=>r instanceof Hg,lkt=class{batches={save:{},merge:{},delete:{}};async save(t,n){if(!han(t))throw new Ye("Entity must be a ServiceEntityRepository for batch writes");let i=t.getCollection(),o=i.id,s=this.batches.save[o];s?s.data.push(t.dataTransform.toStorage(t.id,t.path,n)):this.batches.save[o]={collection:i,data:[n]}}async merge(t,n){if(!han(t))throw new Ye("Entity must be a ServiceEntityRepository for batch writes");let i=t.getCollection(),o=i.id,s=this.batches.merge[o];s?s.data.push(t.dataTransform.mergeToStorage(t.id,t.path,n)):this.batches.merge[o]={collection:i,data:[n]}}async delete(t){if(!han(t))throw new Ye("Entity must be a ServiceEntityRepository for batch writes");let n=t.getCollection(),i=n.id,o=this.batches.delete[i],s={id:t.id};o?o.data.push(s):this.batches.delete[i]={collection:n,data:[s]}}async commit(){let t=0;return await Promise.allSettled(Object.values(this.batches.delete).map(async n=>{for(let i of X6e(n.data,1e3))await n.collection.bulkDelete(i),t+=i.length})),await Promise.allSettled(Object.values(this.batches.merge).map(async n=>{for(let i of X6e(n.data,1e3))await n.collection.bulkUpdate(i),t+=i.length})),await Promise.allSettled(Object.values(this.batches.save).map(async n=>{for(let i of X6e(n.data,1e3))await n.collection.bulkSave(i),t+=i.length})),t}};Zn();kn();No();var Ian=yt(wfs(),1);var LB=Object.create(null);LB.open="0";LB.close="1";LB.ping="2";LB.pong="3";LB.message="4";LB.upgrade="5";LB.noop="6";var xVe=Object.create(null);Object.keys(LB).forEach(r=>{xVe[LB[r]]=r});var DVe={type:"error",data:"parser error"};var NVe=({type:r,data:t},n,i)=>t instanceof ArrayBuffer||ArrayBuffer.isView(t)?i(n?t:"b"+_fs(t,!0).toString("base64")):i(LB[r]+(t||"")),_fs=(r,t)=>Buffer.isBuffer(r)||r instanceof Uint8Array&&!t?r:r instanceof ArrayBuffer?Buffer.from(r):Buffer.from(r.buffer,r.byteOffset,r.byteLength),man;function Tfs(r,t){if(r.data instanceof ArrayBuffer||ArrayBuffer.isView(r.data))return t(_fs(r.data,!1));NVe(r,!0,n=>{man||(man=new TextEncoder),t(man.encode(n))})}var PVe=(r,t)=>{if(typeof r!="string")return{type:"message",data:Bfs(r,t)};let n=r.charAt(0);if(n==="b"){let i=Buffer.from(r.substring(1),"base64");return{type:"message",data:Bfs(i,t)}}return xVe[n]?r.length>1?{type:xVe[n],data:r.substring(1)}:{type:xVe[n]}:DVe},Bfs=(r,t)=>{switch(t){case"arraybuffer":return r instanceof ArrayBuffer?r:Buffer.isBuffer(r)?r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength):r.buffer;case"nodebuffer":default:return Buffer.isBuffer(r)?r:Buffer.from(r)}};var Rfs="",Mfs=(r,t)=>{let n=r.length,i=new Array(n),o=0;r.forEach((s,a)=>{NVe(s,!1,l=>{i[a]=l,++o===n&&t(i.join(Rfs))})})},xfs=(r,t)=>{let n=r.split(Rfs),i=[];for(let o=0;o<n.length;o++){let s=PVe(n[o],t);if(i.push(s),s.type==="error")break}return i};function Dfs(){return new TransformStream({transform(r,t){Tfs(r,n=>{let i=n.length,o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);let s=new DataView(o.buffer);s.setUint8(0,126),s.setUint16(1,i)}else{o=new Uint8Array(9);let s=new DataView(o.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(o[0]|=128),t.enqueue(o),t.enqueue(n)})}})}var yan;function ckt(r){return r.reduce((t,n)=>t+n.length,0)}function ukt(r,t){if(r[0].length===t)return r.shift();let n=new Uint8Array(t),i=0;for(let o=0;o<t;o++)n[o]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),n}function Nfs(r,t){yan||(yan=new TextDecoder);let n=[],i=0,o=-1,s=!1;return new TransformStream({transform(a,l){for(n.push(a);;){if(i===0){if(ckt(n)<1)break;let u=ukt(n,1);s=(u[0]&128)===128,o=u[0]&127,o<126?i=3:o===126?i=1:i=2}else if(i===1){if(ckt(n)<2)break;let u=ukt(n,2);o=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),i=3}else if(i===2){if(ckt(n)<8)break;let u=ukt(n,8),c=new DataView(u.buffer,u.byteOffset,u.length),d=c.getUint32(0);if(d>Math.pow(2,21)-1){l.enqueue(DVe);break}o=d*Math.pow(2,32)+c.getUint32(4),i=3}else{if(ckt(n)<o)break;let u=ukt(n,o);l.enqueue(PVe(s?u:yan.decode(u),t)),i=0}if(o===0||o>r){l.enqueue(DVe);break}}}})}var Ean=4;var qfs=yt(Ule(),1);var lF=process.nextTick,ZE=global,kfs="nodebuffer";function Qfs(){return new ban}function Wi0(r){let t=r.split("; "),n=t[0].indexOf("=");if(n===-1)return;let i=t[0].substring(0,n).trim();if(!i.length)return;let o=t[0].substring(n+1).trim();o.charCodeAt(0)===34&&(o=o.slice(1,-1));let s={name:i,value:o};for(let a=1;a<t.length;a++){let l=t[a].split("=");if(l.length!==2)continue;let u=l[0].trim(),c=l[1].trim();switch(u){case"Expires":s.expires=new Date(c);break;case"Max-Age":let d=new Date;d.setUTCSeconds(d.getUTCSeconds()+parseInt(c,10)),s.expires=d;break;default:}}return s}var ban=class{constructor(){this._cookies=new Map}parseCookies(t){t&&t.forEach(n=>{let i=Wi0(n);i&&this._cookies.set(i.name,i)})}get cookies(){let t=Date.now();return this._cookies.forEach((n,i)=>{var o;((o=n.expires)===null||o===void 0?void 0:o.getTime())<t&&this._cookies.delete(i)}),this._cookies.entries()}addCookies(t){let n=[];for(let[i,o]of this.cookies)n.push(`${i}=${o.value}`);n.length&&(t.setDisableHeaderCheck(!0),t.setRequestHeader("cookie",n.join("; ")))}appendCookies(t){for(let[n,i]of this.cookies)t.append("cookie",`${n}=${i.value}`)}};function dkt(r,...t){return t.reduce((n,i)=>(r.hasOwnProperty(i)&&(n[i]=r[i]),n),{})}var Gi0=ZE.setTimeout,Vi0=ZE.clearTimeout;function cF(r,t){t.useNativeTimers?(r.setTimeoutFn=Gi0.bind(ZE),r.clearTimeoutFn=Vi0.bind(ZE)):(r.setTimeoutFn=ZE.setTimeout.bind(ZE),r.clearTimeoutFn=ZE.clearTimeout.bind(ZE))}var Hi0=1.33;function Lfs(r){return typeof r=="string"?Ki0(r):Math.ceil((r.byteLength||r.size)*Hi0)}function Ki0(r){let t=0,n=0;for(let i=0,o=r.length;i<o;i++)t=r.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}function pkt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Ffs(r){let t="";for(let n in r)r.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(r[n]));return t}function zfs(r){let t={},n=r.split("&");for(let i=0,o=n.length;i<o;i++){let s=n[i].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}var Ufs=yt(FI(),1),Yi0=(0,Ufs.default)("engine.io-client:transport"),Akt=class extends Error{constructor(t,n,i){super(t),this.description=n,this.context=i,this.type="TransportError"}},uF=class extends qfs.Emitter{constructor(t){super(),this.writable=!1,cF(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,i){return super.emitReserved("error",new Akt(t,n,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"?this.write(t):Yi0("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let n=PVe(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){let t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){let n=Ffs(t);return n.length?"?"+n:""}};var jfs=yt(FI(),1),FB=(0,jfs.default)("engine.io-client:polling"),kVe=class extends uF{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let n=()=>{FB("paused"),this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(FB("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){FB("pre-pause polling complete"),--i||n()})),this.writable||(FB("we are currently writing - waiting to pause"),i++,this.once("drain",function(){FB("pre-pause writing complete"),--i||n()}))}else n()}_poll(){FB("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){FB("polling got data %s",t);let n=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};xfs(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():FB('ignoring poll - transport state "%s"',this.readyState))}doClose(){let t=()=>{FB("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(FB("transport open - closing"),t()):(FB("transport not open - deferring close"),this.once("open",t))}write(t){this.writable=!1,Mfs(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=pkt()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}};var Hfs=yt(Ule(),1);var Wfs=!1;try{Wfs=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Gfs=Wfs;var Kfs=yt(FI(),1),Can=(0,Kfs.default)("engine.io-client:polling");function Ji0(){}var fkt=class extends kVe{constructor(t){if(super(t),typeof location<"u"){let n=location.protocol==="https:",i=location.port;i||(i=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,n){let i=this.request({method:"POST",data:t});i.on("success",n),i.on("error",(o,s)=>{this.onError("xhr post error",o,s)})}doPoll(){Can("xhr poll");let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,i)=>{this.onError("xhr poll error",n,i)}),this.pollXhr=t}},dF=class r extends Hfs.Emitter{constructor(t,n,i){super(),this.createRequest=t,cF(this,i),this._opts=i,this._method=i.method||"GET",this._uri=n,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;let n=dkt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(n);try{Can("xhr open %s: %s",this._method,this._uri),i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&i.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var o;i.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},Can("xhr data %s",this._data),i.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ji0,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};dF.requestsCount=0;dF.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Vfs);else if(typeof addEventListener=="function"){let r="onpagehide"in ZE?"pagehide":"unload";addEventListener(r,Vfs,!1)}}function Vfs(){for(let r in dF.requests)dF.requests.hasOwnProperty(r)&&dF.requests[r].abort()}var o$p=function(){let r=Xi0({xdomain:!1});return r&&r.responseType!==null}();function Xi0(r){let t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Gfs))return new XMLHttpRequest}catch{}if(!t)try{return new ZE[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var $i0=Ian.default||Ian,Awe=class extends fkt{request(t={}){var n;return Object.assign(t,{xd:this.xd,cookieJar:(n=this.socket)===null||n===void 0?void 0:n._cookieJar},this.opts),new dF(i=>new $i0(i),this.uri(),t)}};var ls0=yt($fs(),1),cs0=yt(Dan(),1),us0=yt(Pan(),1),Wan=yt(Uan(),1),ds0=yt(Yhs(),1);var Jhs=yt(FI(),1),As0=(0,Jhs.default)("engine.io-client:websocket"),fs0=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Tkt=class extends uF{get name(){return"websocket"}doOpen(){let t=this.uri(),n=this.opts.protocols,i=fs0?{}:dkt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,i)}catch(o){return this.emitReserved("error",o)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){let i=t[n],o=n===t.length-1;NVe(i,this.supportsBinary,s=>{try{this.doWrite(i,s)}catch{As0("websocket closed before onclose event")}o&&lF(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=pkt()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}},R$p=ZE.WebSocket||ZE.MozWebSocket;var ywe=class extends Tkt{createSocket(t,n,i){var o;if(!((o=this.socket)===null||o===void 0)&&o._cookieJar){i.headers=i.headers||{},i.headers.cookie=typeof i.headers.cookie=="string"?[i.headers.cookie]:i.headers.cookie||[];for(let[s,a]of this.socket._cookieJar.cookies)i.headers.cookie.push(`${s}=${a.value}`)}return new Wan.default(t,n,i)}doWrite(t,n){let i={};t.options&&(i.compress=t.options.compress),this.opts.perMessageDeflate&&(typeof n=="string"?Buffer.byteLength(n):n.length)<this.opts.perMessageDeflate.threshold&&(i.compress=!1),this.ws.send(n,i)}};var Xhs=yt(FI(),1),HVe=(0,Xhs.default)("engine.io-client:webtransport"),Ewe=class extends uF{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{HVe("transport closed gracefully"),this.onClose()}).catch(t=>{HVe("transport closed due to %s",t),this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{let n=Nfs(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(n).getReader(),o=Dfs();o.readable.pipeTo(t.writable),this._writer=o.writable.getWriter();let s=()=>{i.read().then(({done:l,value:u})=>{if(l){HVe("session is closed");return}HVe("received chunk: %o",u),this.onPacket(u),s()}).catch(l=>{HVe("an error occurred while reading: %s",l)})};s();let a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){let i=t[n],o=n===t.length-1;this._writer.write(i).then(()=>{o&&lF(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var Gan={websocket:ywe,webtransport:Ewe,polling:Awe};var hs0=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,gs0=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function bwe(r){if(r.length>8e3)throw"URI too long";let t=r,n=r.indexOf("["),i=r.indexOf("]");n!=-1&&i!=-1&&(r=r.substring(0,n)+r.substring(n,i).replace(/:/g,";")+r.substring(i,r.length));let o=hs0.exec(r||""),s={},a=14;for(;a--;)s[gs0[a]]=o[a]||"";return n!=-1&&i!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=ms0(s,s.path),s.queryKey=ys0(s,s.query),s}function ms0(r,t){let n=/\/{2,9}/g,i=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function ys0(r,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,o,s){o&&(n[o]=s)}),n}var $hs=yt(Ule(),1);var Zhs=yt(FI(),1),c0=(0,Zhs.default)("engine.io-client:socket"),Van=typeof addEventListener=="function"&&typeof removeEventListener=="function",KVe=[];Van&&addEventListener("offline",()=>{c0("closing %d connection(s) because the network was lost",KVe.length),KVe.forEach(r=>r())},!1);var Hle=class r extends $hs.Emitter{constructor(t,n){if(super(),this.binaryType=kfs,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){let i=bwe(t);n.hostname=i.host,n.secure=i.protocol==="https"||i.protocol==="wss",n.port=i.port,i.query&&(n.query=i.query)}else n.host&&(n.hostname=bwe(n.host).host);cF(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(i=>{let o=i.prototype.name;this.transports.push(o),this._transportsByName[o]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=zfs(this.opts.query)),Van&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(c0("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},KVe.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=Qfs()),this._open()}createTransport(t){c0('creating transport "%s"',t);let n=Object.assign({},this.opts.query);n.EIO=Ean,n.transport=t,this.id&&(n.sid=this.id);let i=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return c0("options: %j",i),new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){c0("setting transport %s",t.name),this.transport&&(c0("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){c0("socket open"),this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(c0('socket receive: type "%s", data "%s"',t.type,t.data),this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}else c0('packet received with socket readyState "%s"',this.readyState)}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();c0("flushing %d packets in socket",t.length),this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let i=0;i<this.writeBuffer.length;i++){let o=this.writeBuffer[i].data;if(o&&(n+=Lfs(o)),i>0&&n>this._maxPayload)return c0("only send %d out of %d packets",i,this.writeBuffer.length),this.writeBuffer.slice(0,i);n+=2}return c0("payload size is %d (max: %d)",n,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(c0("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,lF(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,i){return this._sendPacket("message",t,n,i),this}send(t,n,i){return this._sendPacket("message",t,n,i),this}_sendPacket(t,n,i,o){if(typeof n=="function"&&(o=n,n=void 0),typeof i=="function"&&(o=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let s={type:t,data:n,options:i};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),o&&this.once("flush",o),this.flush()}close(){let t=()=>{this._onClose("forced close"),c0("socket closing - telling transport to close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},i=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(c0("socket error %j",t),r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return c0("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(c0('socket close with reason: "%s"',t),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Van&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=KVe.indexOf(this._offlineEventListener);i!==-1&&(c0("removing listener for the 'offline' event"),KVe.splice(i,1))}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}};Hle.protocol=Ean;var Bkt=class extends Hle{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){c0("starting upgrade probes");for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}}_probe(t){c0('probing transport "%s"',t);let n=this.createTransport(t),i=!1;Hle.priorWebsocketSuccess=!1;let o=()=>{i||(c0('probe transport "%s" opened',t),n.send([{type:"ping",data:"probe"}]),n.once("packet",p=>{if(!i)if(p.type==="pong"&&p.data==="probe"){if(c0('probe transport "%s" pong',t),this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Hle.priorWebsocketSuccess=n.name==="websocket",c0('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{i||this.readyState!=="closed"&&(c0("changing transport and sending upgrade packet"),d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{c0('probe transport "%s" failed',t);let A=new Error("probe error");A.transport=n.name,this.emitReserved("upgradeError",A)}}))};function s(){i||(i=!0,d(),n.close(),n=null)}let a=p=>{let A=new Error("probe error: "+p);A.transport=n.name,s(),c0('probe transport "%s" failed because of error: %s',t,p),this.emitReserved("upgradeError",A)};function l(){a("transport closed")}function u(){a("socket closed")}function c(p){n&&p.name!==n.name&&(c0('"%s" works - aborting "%s"',p.name,n.name),s())}let d=()=>{n.removeListener("open",o),n.removeListener("error",a),n.removeListener("close",l),this.off("close",u),this.off("upgrading",c)};n.once("open",o),n.once("error",a),n.once("close",l),this.once("close",u),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let n=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&n.push(t[i]);return n}},Cwe=class extends Bkt{constructor(t,n={}){let i=typeof t=="object"?t:n;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(o=>Gan[o]).filter(o=>!!o)),super(t,i)}};var Z$p=Cwe.protocol;var tgs=yt(FI(),1),egs=(0,tgs.default)("socket.io-client:url");function rgs(r,t="",n){let i=r;n=n||typeof location<"u"&&location,r==null&&(r=n.protocol+"//"+n.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=n.protocol+r:r=n.host+r),/^(https?|wss?):\/\//.test(r)||(egs("protocol-less url %s",r),typeof n<"u"?r=n.protocol+"//"+r:r="https://"+r),egs("parse %s",r),i=bwe(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let s=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+s+":"+i.port+t,i.href=i.protocol+"://"+s+(n&&n.port===i.port?"":":"+i.port),i}var Zan={};o3(Zan,{Decoder:()=>Xan,Encoder:()=>Jan,PacketType:()=>ml,protocol:()=>cgs});var ags=yt(Ule(),1);var Is0=typeof ArrayBuffer=="function",vs0=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,ngs=Object.prototype.toString,Ss0=typeof Blob=="function"||typeof Blob<"u"&&ngs.call(Blob)==="[object BlobConstructor]",Os0=typeof File=="function"||typeof File<"u"&&ngs.call(File)==="[object FileConstructor]";function JVe(r){return Is0&&(r instanceof ArrayBuffer||vs0(r))||Ss0&&r instanceof Blob||Os0&&r instanceof File}function YVe(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let n=0,i=r.length;n<i;n++)if(YVe(r[n]))return!0;return!1}if(JVe(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return YVe(r.toJSON(),!0);for(let n in r)if(Object.prototype.hasOwnProperty.call(r,n)&&YVe(r[n]))return!0;return!1}function igs(r){let t=[],n=r.data,i=r;return i.data=Han(n,t),i.attachments=t.length,{packet:i,buffers:t}}function Han(r,t){if(!r)return r;if(JVe(r)){let n={_placeholder:!0,num:t.length};return t.push(r),n}else if(Array.isArray(r)){let n=new Array(r.length);for(let i=0;i<r.length;i++)n[i]=Han(r[i],t);return n}else if(typeof r=="object"&&!(r instanceof Date)){let n={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=Han(r[i],t));return n}return r}function ogs(r,t){return r.data=Kan(r.data,t),delete r.attachments,r}function Kan(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let n=0;n<r.length;n++)r[n]=Kan(r[n],t);else if(typeof r=="object")for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(r[n]=Kan(r[n],t));return r}var lgs=yt(FI(),1),Yan=(0,lgs.default)("socket.io-parser"),ws0=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],cgs=5,ml;(function(r){r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK"})(ml||(ml={}));var Jan=class{constructor(t){this.replacer=t}encode(t){return Yan("encoding packet %j",t),(t.type===ml.EVENT||t.type===ml.ACK)&&YVe(t)?this.encodeAsBinary({type:t.type===ml.EVENT?ml.BINARY_EVENT:ml.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===ml.BINARY_EVENT||t.type===ml.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),Yan("encoded %j as %s",t,n),n}encodeAsBinary(t){let n=igs(t),i=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(i),o}};function sgs(r){return Object.prototype.toString.call(r)==="[object Object]"}var Xan=class r extends ags.Emitter{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);let i=n.type===ml.BINARY_EVENT;i||n.type===ml.BINARY_ACK?(n.type=i?ml.EVENT:ml.ACK,this.reconstructor=new $an(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(JVe(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0,i={type:Number(t.charAt(0))};if(ml[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===ml.BINARY_EVENT||i.type===ml.BINARY_ACK){let s=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);let a=t.substring(s,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");i.attachments=Number(a)}if(t.charAt(n+1)==="/"){let s=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););i.nsp=t.substring(s,n)}else i.nsp="/";let o=t.charAt(n+1);if(o!==""&&Number(o)==o){let s=n+1;for(;++n;){let a=t.charAt(n);if(a==null||Number(a)!=a){--n;break}if(n===t.length)break}i.id=Number(t.substring(s,n+1))}if(t.charAt(++n)){let s=this.tryParse(t.substr(n));if(r.isPayloadValid(i.type,s))i.data=s;else throw new Error("invalid payload")}return Yan("decoded %s as %j",t,i),i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case ml.CONNECT:return sgs(n);case ml.DISCONNECT:return n===void 0;case ml.CONNECT_ERROR:return typeof n=="string"||sgs(n);case ml.EVENT:case ml.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&ws0.indexOf(n[0])===-1);case ml.ACK:case ml.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},$an=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let n=ogs(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function hS(r,t,n){return r.on(t,n),function(){r.off(t,n)}}var ugs=yt(Ule(),1),dgs=yt(FI(),1),Bh=(0,dgs.default)("socket.io-client:socket"),_s0=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),Iwe=class extends ugs.Emitter{constructor(t,n,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[hS(t,"open",this.onopen.bind(this)),hS(t,"packet",this.onpacket.bind(this)),hS(t,"error",this.onerror.bind(this)),hS(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var i,o,s;if(_s0.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;let a={type:ml.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){let d=this.ids++;Bh("emitting packet with ack id %d",d);let p=n.pop();this._registerAckCallback(d,p),a.id=d}let l=(o=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||o===void 0?void 0:o.writable,u=this.connected&&!(!((s=this.io.engine)===null||s===void 0)&&s._hasPingExpired());return this.flags.volatile&&!l?Bh("discard packet as the transport is not currently writable"):u?(this.notifyOutgoingListeners(a),this.packet(a)):this.sendBuffer.push(a),this.flags={},this}_registerAckCallback(t,n){var i;let o=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(o===void 0){this.acks[t]=n;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===t&&(Bh("removing packet with ack id %d from the buffer",t),this.sendBuffer.splice(l,1));Bh("event with ack id %d has timed out after %d ms",t,o),n.call(this,new Error("operation has timed out"))},o),a=(...l)=>{this.io.clearTimeoutFn(s),n.apply(this,l)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((i,o)=>{let s=(a,l)=>a?o(a):i(l);s.withError=!0,n.push(s),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((o,...s)=>i!==this._queue[0]?void 0:(o!==null?i.tryCount>this._opts.retries&&(Bh("packet [%d] is discarded after %d tries",i.id,i.tryCount),this._queue.shift(),n&&n(o)):(Bh("packet [%d] was successfully sent",i.id),this._queue.shift(),n&&n(null,...s)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(Bh("draining queue"),!this.connected||this._queue.length===0)return;let n=this._queue[0];if(n.pending&&!t){Bh("packet [%d] has already been sent and is waiting for an ack",n.id);return}n.pending=!0,n.tryCount++,Bh("sending packet [%d] (try n\xB0%d)",n.id,n.tryCount),this.flags=n.flags,this.emit.apply(this,n.args)}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){Bh("transport is open - connecting"),typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:ml.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){Bh("close (%s)",t),this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){let i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case ml.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ml.EVENT:case ml.BINARY_EVENT:this.onevent(t);break;case ml.ACK:case ml.BINARY_ACK:this.onack(t);break;case ml.DISCONNECT:this.ondisconnect();break;case ml.CONNECT_ERROR:this.destroy();let i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){let n=t.data||[];Bh("emitting event %j",n),t.id!=null&&(Bh("attaching ack callback to event"),n.push(this.ack(t.id))),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let n=this._anyListeners.slice();for(let i of n)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let n=this,i=!1;return function(...o){i||(i=!0,Bh("sending ack %j",o),n.packet({type:ml.ACK,id:t,data:o}))}}onack(t){let n=this.acks[t.id];if(typeof n!="function"){Bh("bad ack %s",t.id);return}delete this.acks[t.id],Bh("calling ack %s with %j",t.id,t.data),n.withError&&t.data.unshift(null),n.apply(this,t.data)}onconnect(t,n){Bh("socket connected with id %s",t),this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){Bh("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(Bh("performing disconnect (%s)",this.nsp),this.packet({type:ml.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let n=this._anyListeners;for(let i=0;i<n.length;i++)if(t===n[i])return n.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let n=this._anyOutgoingListeners;for(let i=0;i<n.length;i++)if(t===n[i])return n.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let n=this._anyOutgoingListeners.slice();for(let i of n)i.apply(this,t.data)}}};function Kle(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Kle.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*r);r=Math.floor(t*10)&1?r+n:r-n}return Math.min(r,this.max)|0};Kle.prototype.reset=function(){this.attempts=0};Kle.prototype.setMin=function(r){this.ms=r};Kle.prototype.setMax=function(r){this.max=r};Kle.prototype.setJitter=function(r){this.jitter=r};var pgs=yt(Ule(),1),Ags=yt(FI(),1),m2=(0,Ags.default)("socket.io-client:manager"),vwe=class extends pgs.Emitter{constructor(t,n){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,cF(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((i=n.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Kle({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;let o=n.parser||Zan;this.encoder=new o.Encoder,this.decoder=new o.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(m2("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;m2("opening %s",this.uri),this.engine=new Cwe(this.uri,this.opts);let n=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let o=hS(n,"open",function(){i.onopen(),t&&t()}),s=l=>{m2("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",l),t?t(l):this.maybeReconnectOnOpen()},a=hS(n,"error",s);if(this._timeout!==!1){let l=this._timeout;m2("connect attempt will timeout after %d",l);let u=this.setTimeoutFn(()=>{m2("connect attempt timed out after %d",l),o(),s(new Error("timeout")),n.close()},l);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(o),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){m2("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(hS(t,"ping",this.onping.bind(this)),hS(t,"data",this.ondata.bind(this)),hS(t,"error",this.onerror.bind(this)),hS(t,"close",this.onclose.bind(this)),hS(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){lF(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){m2("error",t),this.emitReserved("error",t)}socket(t,n){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new Iwe(this,t,n),this.nsps[t]=i),i}_destroy(t){let n=Object.keys(this.nsps);for(let i of n)if(this.nsps[i].active){m2("socket %s is still active, skipping close",i);return}this._close()}_packet(t){m2("writing packet %j",t);let n=this.encoder.encode(t);for(let i=0;i<n.length;i++)this.engine.write(n[i],t.options)}cleanup(){m2("cleanup"),this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){m2("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var i;m2("closed due to %s",t),this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)m2("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let n=this.backoff.duration();m2("will wait %dms before reconnect attempt",n),this._reconnecting=!0;let i=this.setTimeoutFn(()=>{t.skipReconnect||(m2("attempting reconnect"),this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(o=>{o?(m2("reconnect attempt error"),t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",o)):(m2("reconnect success"),t.onreconnect())}))},n);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var hgs=yt(FI(),1),fgs=(0,hgs.default)("socket.io-client"),XVe={};function $Ve(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};let n=rgs(r,t.path||"/socket.io"),i=n.source,o=n.id,s=n.path,a=XVe[o]&&s in XVe[o].nsps,l=t.forceNew||t["force new connection"]||t.multiplex===!1||a,u;return l?(fgs("ignoring socket cache for %s",i),u=new vwe(i,t)):(XVe[o]||(fgs("new io instance for %s",i),XVe[o]=new vwe(i,t)),u=XVe[o]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign($Ve,{Manager:vwe,Socket:Iwe,io:$Ve,connect:$Ve});qt();bm();Ft();df();var Yy=class extends XE{constructor(n,i,o,s,a,l){super(n,n,[],i,s,l);this.dataTransform=o;this.EntityRepositoryConstructor=a}async addAuthHeader(n={}){let i=await this.getToken();return i&&(n.Authorization=`Bearer ${i}`),n}get path(){return`${this.parent.path}/${this.id}`}get bulkUri(){throw new Vl("This entity does not support bulk operations")}get(n){return new this.EntityRepositoryConstructor(n,this.parent,this.serviceOperations,this.logContext)}encodeQueryComponent(n){if(n!==void 0)return Buffer.from(JSON.stringify(n)).toString("base64")}async select(n,i){let o=await this.addAuthHeader(),s=n?.startingFrom,a=!1,l=0,u=[],c=this.encodeQueryComponent(n?.where),d=this.encodeQueryComponent(n?.orderBy),p=500,A=n?.limit??1/0;for(;!a;){let h=Math.min(p,A-l),y=await(await hd).get(`${this.serviceOperations.hostname}${this.baseUri}`,{headers:o,params:{limit:h,startAfter:s,where:c,orderBy:d}}),C=y.data.data.map(O=>this.dataTransform.fromStorage(O.id.toString(),this.path,O,i));u.push(...C),l+=h,s=y.data.nextCursor,(C.length<h||l>=A)&&(a=!0)}let f=n?.selectFields;return f?u.map(h=>XA(h,f)):u}async selectInBatches(n,i,o,s){return this.select({where:[...s,[n,i,o]]})}async createEntity(n,i){let o=await this.generateID(n),s=this.dataTransform.toStorage(o.toString(),`${this.path}/${o}`,n,i),a=await this.addAuthHeader(),u=(await(await hd).post(`${this.serviceOperations.hostname}${this.baseUri}`,s,{headers:a,method:"post"})).data;return new this.EntityRepositoryConstructor(u.id,this.parent,this.serviceOperations,this.logContext)}listenCollection(n,i,o){let s;try{s=$Ve(void 0,{auth:async a=>{let l=await this.getToken();md(!!l,"Cookie-based auth is not yet supported for service-backed repositories","COMMON"),a({token:"Bearer "+l})},path:this.baseWsUri,transports:["websocket"],query:this.wsQuery}),s.on("change",a=>{if(a.type==="added"||a.type==="modified"){let l=this.dataTransform.fromStorage(a.id,`${this.path}/${a.id}`,a.value,o);n([{type:a.type,value:l,id:a.id,hasPendingWrites:!1}])}else n([{type:"removed",value:{},id:a.id,hasPendingWrites:!1}])}),this.select().then(a=>n(a.map(l=>({type:"added",value:l,id:String(l.id),hasPendingWrites:!1}))))}catch(a){if(a instanceof Error&&i)i(a);else throw a}return()=>{s?.close()}}listenQuery(n,i,o,s){throw new Vl("Not used by supported entities")}async generateID(n){return n.id??xs()}async bulkSave(n){qe.COMMON.warnContext(this.logContext,"Using default bulk save operation",{path:this.path});for(let i of n)await this.createEntity(i)}async bulkUpdate(n){qe.COMMON.warnContext(this.logContext,"Using default bulk update operation",{path:this.path});for(let i of n){if(!i.id)throw qe.COMMON.errorContext(this.logContext,"Tried to bulk update entity without entity ID",{path:this.path}),new Ye("Tried to bulk update entity without entity ID");await this.get(i.id).merge(i)}}async bulkDelete(n){qe.COMMON.warnContext(this.logContext,"Using default bulk delete operation",{path:this.path});for(let i of n){if(!i.id)throw qe.COMMON.errorContext(this.logContext,"Tried to bulk delete entity without entity ID",{path:this.path}),new Ye("Tried to bulk delete entity without entity ID");await this.get(i.id).delete()}}async getCount(){throw new Vl}};Zn();pr();Hi();qt();bm();Zn();No();f1();var ZVe=class{fromStorage(t,n,i,o){try{return this.transformFromStorage(t,n,i,o)}catch(s){if(o?.onDataTransformError&&o.onDataTransformError(n,s),!o?.ignoreDataTransformErrors)throw ua().debug(`Error transforming repository entity ${n} from storage`,s),s}return i}toStorage(t,n,i,o){try{return this.transformToStorage(t,n,{id:t,...i},o)}catch(s){if(o?.onDataTransformError&&o.onDataTransformError(n,s),!o?.ignoreDataTransformErrors)throw ua().debug(`Error transforming repository entity ${n} to storage`,s),s}return i}mergeToStorage(t,n,i,o){try{return this.mergeTransformToStorage(t,n,i,o)}catch(s){if(o?.onDataTransformError&&o.onDataTransformError(n,s),!o?.ignoreDataTransformErrors)throw ua().debug(`Error merge transforming repository entity ${n} to storage`,s),s}return i}},eln=class extends ZVe{constructor(n){super();this.validators=n}transformFromStorage(n,i,o,s){let a=this.getValidatorOptions(n,s?.validatorOptions);return s?.enableStrictValidation?this.validators.strict.assert(o,a):this.validators.standard.assert(o,a)}transformToStorage(n,i,o,s){let a=this.getValidatorOptions(n,s?.validatorOptions);return s?.enableStrictValidation?this.validators.strict.assert(o,a):this.validators.standard.assert(o,a)}mergeTransformToStorage(n,i,o,s){return o}getValidatorOptions(n,i,o=500){let s={...i,statusCode:o};return s.errorMessage||(s.errorMessage=a=>`Found ${a.failures.length} validation failure(s) for ${this.validators.standard.name} ${n}`),s}},tln=class{transforms;constructor(...t){this.transforms=t}fromStorage(t,n,i,o){return this.transforms.reduce((s,a)=>a.fromStorage(t,n,s,o),i)}toStorage(t,n,i,o){return this.transforms.reduceRight((s,a)=>a.toStorage(t,n,s,o),i)}mergeToStorage(t,n,i,o){return this.transforms.reduceRight((s,a)=>a.mergeToStorage(t,n,s,o),i)}},rln=class extends ZVe{transformToStorage(t,n,i){return i}mergeTransformToStorage(t,n,i){return i}},Swe=class extends rln{constructor(n){super();this.fieldName=n}transformToStorage(n,i,o){return{id:o[this.fieldName],...f3(o,[this.fieldName])}}mergeTransformToStorage(n,i,o){return o}transformFromStorage(n,i,o){return{...o,[this.fieldName]:o.id}}},nln=class extends ZVe{transformToStorage(t,n,i){let{createdAt:o,createdBy:s,updatedAt:a,updatedBy:l,...u}=i;return u}mergeTransformToStorage(t,n,i){let{createdAt:o,createdBy:s,updatedAt:a,updatedBy:l,...u}=i;return u}transformFromStorage(t,n,i){return i}},bI=(r,t)=>{let n=[new nln,new eln(r)];return t&&n.unshift(t),new tln(...n)};var Ts0=_.discriminatedUnion("type",[Gn.merge(Sn.merge(e8)),Gn.merge(Sn.merge(t8))]),Bs0=Fi("Node",Ts0),ggs=bI(Bs0),iln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/nodes`}get baseWsUri(){return"/api/metadata/ws/v1/nodes"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i,o){super(t,"nodes",ggs,n,o,[],i)}async fetchAndMerge(t){let n=await this.addAuthHeader();await(await hd).patch(`${this.baseUri}/${this.id}`,{...this.mapDataToPatchPayload(t),type:t.type},{headers:n})}mergeMetadata(t){return this.fetchAndMerge({metadata:t})}getCollection(){return new eHe(this.parent,this.serviceOperations,this.logContext)}},eHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/nodes`}get bulkUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/nodes_bulk`}get baseWsUri(){return"/api/metadata/ws/v1/nodes"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("nodes",t,ggs,i,iln,n)}listenCollectionOverride(t,n,i,o,s){return this.listenCollection(t,o,s),()=>{}}convertFromRestAPIStorage(t,n){return this.dataTransform.fromStorage(n,`${this.path}/${n}`,t)}async getNodesLocationInfo(){throw new Vl}async bulkSave(t){let n=await this.addAuthHeader(),i=t.map(o=>this.dataTransform.toStorage(o.id||"",`${this.path}/${o.id}`,o));await(await hd).post(this.bulkUri,{nodes:i},{headers:n})}async bulkUpdate(t){let n=await this.addAuthHeader({}),i=t.map(o=>this.dataTransform.mergeToStorage(o.id||"",`${this.path}/${o.id}`,o));await(await hd).post(this.bulkUri,{nodes:i},{headers:n})}async bulkDelete(t){let n=await this.addAuthHeader();await(await hd).delete(this.bulkUri,{headers:n,data:t.map(i=>i.id)})}};Zn();var Rs0=Gn.merge(r8),Ms0=Fi("Job",Rs0),mgs=bI(Ms0,new Swe("jobCounter")),oln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/jobs`}get baseWsUri(){return"/api/metadata/ws/v1/jobs"}get wsQuery(){return{}}getCollection(){return new tHe(this.parent,this.serviceOperations,this.logContext)}constructor(t,n,i,o){super(t,"jobs",mgs,n,o,[],i)}},tHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/jobs`}get baseWsUri(){return"/api/metadata/ws/v1/jobs"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("jobs",t,mgs,i,oln,n)}async generateID(t){if(t.id)return t.id;if(t.jobCounter)return t.jobCounter;let n=await this.select();if(n.length<1)return 1;let o=n.sort((a,l)=>l.id-a.id)[0];return o?o.id+1:1}};Zn();var xs0=Gn.merge(XAe),Ds0=Fi("NodeType",xs0),ygs=bI(Ds0),sln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/templates`}get baseWsUri(){return"/api/metadata/ws/v1/templates"}get wsQuery(){return{}}getCollection(){return new rHe(this.parent,this.serviceOperations,this.logContext)}constructor(t,n,i,o){super(t,"templates",ygs,n,o,[],i)}},rHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/templates`}get baseWsUri(){return"/api/metadata/ws/v1/templates"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("templates",t,ygs,i,sln,n)}};Zn();var Ns0=Gn.merge(Jte),Ps0=Fi("Subgraph",Ns0),Egs=bI(Ps0,new Swe("folderCounter")),aln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/subgraphs`}get baseWsUri(){return"/api/metadata/ws/v1/subgraphs"}get wsQuery(){return{}}getCollection(){return new nHe(this.parent,this.serviceOperations,this.logContext)}constructor(t,n,i,o){super(t,"subgraphs",Egs,n,o,[],i)}},nHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/subgraphs`}get baseWsUri(){return"/api/metadata/ws/v1/subgraphs"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("subgraphs",t,Egs,i,aln,n)}};pr();Zn();var ks0=_.union([Gn.merge(tDe),Gn.merge(rDe),Gn.merge(nDe)]),Qs0=Fi("WorkspaceUser",ks0),bgs=bI(Qs0),lln=class extends Hg{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/platform-authentications`}get baseWsUri(){return"/api/metadata/ws/v1/platform-authentications"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i,o){super(t,"users",bgs,n,o,[],i)}getCollection(){return new iHe(this.parent,this.serviceOperations,this.logContext)}},iHe=class extends Yy{get baseUri(){return`/api/metadata/v1/workspaces/${this.parent.id}/platform-authentications`}get baseWsUri(){return"/api/metadata/ws/v1/platform-authentications"}get wsQuery(){return{workspaceID:this.parent.id}}constructor(t,n,i){super("users",t,bgs,i,lln,n)}};var Ls0=Gn.merge(put),Fs0=Fi("Workspace",Ls0),Cgs=bI(Fs0),cln=class extends Hg{get baseUri(){return"/api/metadata/v1/workspaces"}get baseWsUri(){return"/api/metadata/ws/v1/workspaces"}get wsQuery(){return{}}getCollection(){return new oHe(this.parent,this.serviceOperations,this.logContext)}constructor(t,n,i,o){super(t,"workspaces",Cgs,n,o,["jobs","macros","nodes","nodeTypes","subgraphs","users","installedPackages","nodesLastRefreshed"],i)}get nodes(){return this.getSubCollection("nodes",eHe)}node(t){return this.nodes.get(t)}installedPackages=void 0;installedPackage=void 0;get jobs(){return this.getSubCollection("jobs",tHe)}job(t){return this.jobs.get(t)}macros=void 0;macro=void 0;nodesLastRefreshed=void 0;nodeLastRefreshed=void 0;get nodeTypes(){return this.getSubCollection("templates",rHe)}nodeType(t){return this.nodeTypes.get(t)}get subgraphs(){return this.getSubCollection("subgraphs",nHe)}subgraph(t){return this.subgraphs.get(t)}get users(){return this.getSubCollection("users",iHe)}user(t){return this.users.get(t)}isDevEnv=void 0;removeDeletedSteps=void 0},oHe=class extends Yy{get baseUri(){return"/api/metadata/v1/workspaces"}get baseWsUri(){return"/api/metadata/ws/v1/workspaces"}get wsQuery(){return{}}async fetchWorkspacesForPermissions(t){return this.select({where:[["devEnv","==",t]],selectFields:["id","project"]})}constructor(t,n,i){super("workspaces",t,Cgs,i,cln,n)}};var zs0=Gn.merge(xut),qs0=Fi("Org",zs0),Igs=bI(qs0),uln=class extends Hg{constructor(t,n,i,o){super(t,"orgs",Igs,n,{...o,orgID:t},["devRuns","globalUsersSettings","projects","runs","userRoles","workspaces"],i)}get baseUri(){return"orgs"}getCollection(){return new sHe(this.parent,this.serviceOperations,this.logContext)}get baseWsUri(){return"orgs"}get wsQuery(){return{}}get workspaces(){return this.getSubCollection("workspaces",oHe)}workspace(t){return this.workspaces.get(t)}devRuns=void 0;devRun=void 0;globalUsersSettings=void 0;globalUsersSetting=void 0;projects=void 0;project=void 0;runs=void 0;run=void 0;userRoles=void 0;userRole=void 0;getNextCounter=void 0;releaseWorkspaceStatusAndEndRun=void 0;updateLastLoginTime=void 0},sHe=class extends Yy{get baseUri(){return"orgs"}get baseWsUri(){return"orgs"}get wsQuery(){return{}}constructor(t,n,i){super("orgs",t,Igs,i,uln,n)}};var Rkt=class extends XE{constructor(t,n){super("root","root",["orgs","users","packagesRegistry","events"],void 0,n,t)}get path(){return"root"}get baseUri(){return"root"}get baseWsUri(){return"root"}get wsQuery(){return{}}get orgs(){return this.getSubCollection("orgs",sHe)}org(t){return this.orgs.get(t)}orgsPublic=void 0;orgPublic=void 0;users=void 0;user=void 0;packagesRegistry=void 0;registryPackage=void 0;events=void 0;event=void 0;oauthStates=void 0;oauthState=void 0;activePrompts=void 0;activePrompt=void 0;promptVersions=void 0;promptVersion=void 0;storage=void 0;batch=()=>new lkt;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)return;o=void 0}}return i||o||this}};var Mkt=class{constructor(t,n,i){this.getMutateAllRepositories=i;this.firestoreBatch=t.batch(),this.serviceBatch=n.batch()}firestoreBatch;serviceBatch;async save(t,n){if(t instanceof XE)return this.serviceBatch.save(t,n);if(t instanceof qle){let i=t.flaggedRepositoryParent,o=this.getMutateAllRepositories();return i instanceof XE?(o&&this.firestoreBatch.save(t.providers.firebase,n),this.serviceBatch.save(t.providers.service,n)):(o&&t.providers.service&&this.serviceBatch.save(t.providers.service,n),this.firestoreBatch.save(t.providers.firebase,n))}return this.firestoreBatch.save(t,n)}async merge(t,n){if(t instanceof XE)return this.serviceBatch.merge(t,n);if(t instanceof qle){let i=t.flaggedRepositoryParent,o=this.getMutateAllRepositories();return i instanceof XE?(o&&this.firestoreBatch.merge(t.providers.firebase,n),this.serviceBatch.merge(t.providers.service,n)):(o&&t.providers.service&&this.serviceBatch.merge(t.providers.service,n),this.firestoreBatch.merge(t.providers.firebase,n))}return this.firestoreBatch.merge(t,n)}async delete(t,n){if(t instanceof XE)return this.serviceBatch.delete(t,n);if(t instanceof qle){let i=t.flaggedRepositoryParent,o=this.getMutateAllRepositories();return i instanceof XE?(o&&this.firestoreBatch.delete(t.providers.firebase,n),this.serviceBatch.delete(t.providers.service,n)):(o&&t.providers.service&&this.serviceBatch.delete(t.providers.service,n),this.firestoreBatch.delete(t.providers.firebase,n))}return this.firestoreBatch.delete(t,n)}async commit(){let t=await this.serviceBatch.commit(),n=await this.firestoreBatch.commit();return t+n}};var dln=(r,t,n)=>{let i=new akt(r),o=new Rkt(t,{});return vfs(i,{firebase:i,service:o},n,()=>new Mkt(i,o,()=>n("",{}).shouldMutateBoth))};var Ot1=ysn(process.env.SERVICE_BACKED_REPOSITORIES),wt1=ysn(process.env.MUTATE_ALL_REPOSITORIES);cte();qt();var qB=av.getTracer("repository"),pln=class{constructor(t){this.transaction=t}async get(t){return Iar(t.path),qB.startActiveSpan(`get ${t.path}`,async n=>{n.setAttribute("repositoryType","web"),n.setAttribute("path",t.path),n.setAttribute("operation","get");let i=await this.transaction.get(t);return n.end(),i})}set(t,n){return Sar(t.path),qB.startActiveSpan(`set ${t.path}`,i=>(i.setAttribute("repositoryType","web"),i.setAttribute("path",t.path),i.setAttribute("operation","set"),this.transaction.set(t,n),i.end(),this))}async update(t,n){return Oar(t.path),qB.startActiveSpan(`update ${t.path}`,i=>(i.setAttribute("repositoryType","web"),i.setAttribute("path",t.path),i.setAttribute("operation","update"),this.transaction.update(t,n),i.end(),this))}delete(t){return war(t.path),qB.startActiveSpan(`delete ${t.path}`,n=>(n.setAttribute("repositoryType","web"),n.setAttribute("path",t.path),n.setAttribute("operation","delete"),this.transaction.delete(t),n.end(),this))}getQuery(t){throw new Vl("getQuery is not supported with the web sdk.")}},xkt=class r extends RVe{constructor(n,i=new yOe(n.storage())){super();this.app=n;this.storage=i}get db(){return this.app.firestore()}currentUser(){return this.db.app.auth().currentUser?.uid}currentLogContext(){return{userID:this.db.app.auth().currentUser?.uid}}collectionRef(n,i){return n.collection(i)}data(n){return n.data()}docRef(n,i){return n.doc(i)}exists(n){return n.exists}hasPendingWrites(n){return n.metadata.hasPendingWrites}async getDoc(n,i){let o=n;return Car(o.path),qB.startActiveSpan(`get ${n.path}`,async s=>{s.setAttribute("repositoryType","web"),s.setAttribute("path",n.path),s.setAttribute("operation","get");let a=await o.get();if(!a.metadata.hasPendingWrites)return s.end(),a;let l=Hjn(o,i?.pendingWritesTimeoutMs);return s.end(),l})}async addDoc(n,i){let o=n;tst(o.path),await qB.startActiveSpan(`set ${n.path}`,async s=>{s.setAttribute("repositoryType","web"),s.setAttribute("path",n.path),s.setAttribute("operation","set"),await o.set(i),s.end()})}async saveDoc(n,i){let o=n;return tst(n.path),qB.startActiveSpan(`set ${n.path}`,async s=>{s.setAttribute("repositoryType","web"),s.setAttribute("path",n.path),s.setAttribute("operation","set"),await o.set(i),s.end()})}async updateDoc(n,i){let o=n;return bar(n.path),qB.startActiveSpan(`update ${n.path}`,async s=>{s.setAttribute("repositoryType","web"),s.setAttribute("path",n.path),s.setAttribute("operation","update"),await o.update(i),s.end()})}async getChildren(n){throw new Vl("getChildren() is not possible in the firestore web sdk as it lacks listDocuments()")}async deleteDoc(n){let i=n;return Ear(n.path),qB.startActiveSpan(`delete ${n.path}`,async o=>{o.setAttribute("repositoryType","web"),o.setAttribute("path",n.path),o.setAttribute("operation","delete"),await i.delete(),o.end()})}createQuery(n,i){let o=n,s=i?.where?.filter(a=>a[2]!==void 0);if(s&&s.forEach(a=>o=o.where(r.replaceIDSentinel(a[0]),a[1],a[2])),i?.orderBy?.forEach(a=>o=o.orderBy(a[0],a[1])),i?.startingFrom!==void 0&&(i.orderBy?.length?o=o.startAfter(i.startingFrom):(o=o.orderBy(ru.firestore.FieldPath.documentId()),o=o.startAfter(i.startingFrom.toString()))),i?.limit&&(o=o.limit(i.limit)),i?.selectFields)throw new Vl("Selecting specific fields is not supported with the Firebase web SDK");return o}runQuery(n){return qB.startActiveSpan("get query.unknown",async i=>{i.setAttribute("repositoryType","web"),i.setAttribute("path","query.unknown"),i.setAttribute("operation","get");let o=await n.get();return i.end(),o})}onDocSnapshot(n,i,o){return n.onSnapshot(i,o)}onCollectionSnapshot(n,i,o){return this.onQuerySnapshot(n,i,o)}onQuerySnapshot(n,i,o){return n.onSnapshot(i,o)}snapShotChanges(n){return n.docChanges()}runTransaction(n){return this.db.runTransaction(i=>n(new pln(i)))}batch(){return this.db.batch()}saveDocBatch(n,i,o){n.set(i,o)}updateDocBatch(n,i,o){n.update(i,o)}deleteDocBatch(n,i){n.delete(i)}commitBatch(n){return _ar(),qB.startActiveSpan("batch",async i=>{i.setAttribute("repositoryType","web"),i.setAttribute("operation","batch commit"),await n.commit(),i.end()})}getServerTimestampSentinel(){return ru.firestore.FieldValue.serverTimestamp()}getDeleteSentinel(){return ru.firestore.FieldValue.delete()}uploadToStorage(n,i){return this.storage.uploadToStorage(n,i)}downloadFromStorage(n){return this.storage.downloadFromStorage(n)}deleteFileFromStorage(n){return this.storage.deleteFileFromStorage(n)}getCount(n){throw new Vl("getCount is not supported with the web sdk.")}async checkIfStorageReferenceExists(n){return this.storage.checkIfStorageReferenceExists(n)}static replaceIDSentinel(n){return n instanceof iDe?ru.firestore.FieldPath.documentId():n}};var Aln=new Map,js0=r=>id().featureFlags.getStringValue("serviceBackedRepositories","").split(",").includes(r)?"service":"firebase",Ws0=()=>id().featureFlags.isFeatureEnabled("mutateAllRepositories",!1),Gs0=r=>({providerId:js0(r),shouldMutateBoth:Ws0()}),vgs=({app:r,storage:t,hostname:n="localhost",token:i})=>{r||(r=ru.app());let o=Aln.get(r.name);return o||(o=dln(new xkt(r,t),{getToken:async()=>typeof i=="string"?i:i(),hostname:n},Gs0),Aln.set(r.name,o)),o},Sgs=()=>{Aln.clear()};var Vs0=qe.RUNNER_BACKEND,Hs0=async r=>{try{return await qii(r),ru.app()}catch(t){throw Vs0.error("GetOrSetupFirebase",t),t}},Ks0=async(r,t,n)=>{let i;return B_()||(i=new Oxt({storage:ru.storage(),backendUrl:t.emulatorInfo?.storage,bucket:t.storageBucket})),vgs({app:r,storage:i,hostname:n.origin,token:Up.resolveAuthToken})},Ys0=async(r,t,n,i)=>{let o,s=new bxt(ua(),i.apiKey,!!i.emulatorInfo,n);return await s.initialize(),Up.setInstance(s),t?o=await s.loginWithIdToken(t):(md(!!r,"refresh_token or ID token is required","AUTH"),o=await s.loginWithRefreshToken(r)),{token:await s.getAuthToken(),uid:o.id}},Dkt=async(r,t,n)=>{let o=await xv(n.origin).GetDatabase(),s=w0t().instance,a=s_n(n.hostname);return process.env.SCHEDULER_ADDRESS=n.origin,s.isInitialized||await s.initializeDefaultFlags(a),LU({logContext:id().logContext,featureFlags:s.currentFlags},async()=>(await ons(),cns(r,t,()=>Hs0(o),(l,u,c)=>Ys0(l,u,c,o),(l,u)=>Ks0(l,o,n),async(l,u,c)=>(a&&(l.subdomain={id:a}),fO&&(l.version={id:fO.version}),await s.initialize({context:l,rootRepository:()=>u,apiClient:xv(void 0,c)}),s.currentFlags))))};Ft();var us=qe.CLI,hF=qe.CLI_INTERNAL,Owe,Ogs=r=>{Owe||(Owe=console.log),console.log=r},wgs=()=>{Owe&&(console.log=Owe,Owe=void 0)},_gs=(...r)=>{(Owe||console.log)(...r)};var Js0=async(r,t,n,i,o)=>{us.infoContext(o,`Starting deploy job coa-${r}`);let s=DYi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),a=new K3e(s),l=gOe(a.runDetails.environmentID),u=OU(i,`Unable to parse runID: ${i}`),c={...o,runID:u,workspaceID:l},{teamInfo:{fbTeamID:d,fbUserID:p},rootRepository:A}=t,f=A.org(d),h=await BL(f.workspace(l).user(p),c),y=id().featureFlags;await WJ(d,p,l,a.userCredentials,h,y);let C=await $4(A,d,p,l,kae(a.userCredentials),c),O=y$r(a,C,p,r);O.id=u;let w=f.run(u);await w.updateHeartbeat({runStatus:"initializing"});let T=Mae(c,w,O.runType);try{let R=a.runDetails.version===2?a.runDetails.phasedNodeEdits:a.runDetails.dividedStepDataWithWorkspaceEdits,P=Math.max(...Object.values(R).map(H=>Object.keys(H).length)),{connectionManager:z,platform:q}=await RL(C,t,ML(P,a.runDetails.parallelism),!1,c);return Y8t({allWorkspaceData:O.runDetails.fromWorkspaceData,connectionManager:z,logContext:c,platform:q,renderer:tI(y),runID:u,runInfo:O,nodesInRun:zJ(R),teamInfoAndFirebase:t,workspaceID:l},T)}catch(R){try{await T()}catch(P){us.error("Unable to clean up hearbeat after handling error",R,"innerError",P)}throw R}},Xs0=async(r,t,n,i,o)=>{us.infoContext(o,`Starting refresh job coa-${r}`);let a=kYi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),l=gOe(a.runDetails.environmentID),u=OU(i,`Unable to parse runID: ${i}`),c={...o,runID:u,workspaceID:l},{teamInfo:{fbTeamID:d,fbUserID:p},rootRepository:A}=t,f=A.org(d),h=await BL(f.workspace(l).user(p),c),y=id().featureFlags;await WJ(d,p,l,a.userCredentials,h,y);let C=await $4(A,d,p,l,kae(a.userCredentials),c);a.runTimeParameters=await xL(A,d,l,a.runTimeParameters),E$r(a);let O=b$r(a,C,p,r);O.id=u;let w=f.run(u);await w.updateHeartbeat({runStatus:"initializing"});let T=Mae(c,w,O.runType);try{let R=await Pae(l,f),P=fOe(O.runDetails,R);O.runDetails.refreshDescription=cWe(O.runDetails,R.jobs),await w.merge({runDetails:O.runDetails});let z=Lae(C,p);R.userConnections[l][p]=z;let{connectionManager:q,platform:H}=await RL(C,t,ML(P.size,a.runDetails.parallelism),!1,c);return lWe({allWorkspaceData:R,connectionManager:q,logContext:c,platform:H,renderer:tI(y),runID:u,runInfo:O,nodesInRun:P,teamInfoAndFirebase:t,workspaceID:l},T)}catch(R){try{await T()}catch(P){us.error("Unable to clean up hearbeat after handling error",R,"innerError",P)}throw R}},$s0=async(r,t,n,i,o)=>{let s="[CloudReRun]";us.infoContext(o,`Starting re-run job coa-${r}`);let a=LYi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),l=new Y3e(a);ay(l);let{teamInfo:u,teamInfo:{fbTeamID:c,fbUserID:d},rootRepository:p}=t,A=p.org(c),f=Krs(l.runDetails.runID),h=await A.run(f).fetch();if(!h)throw new Error(`Could not find runInfo for teamID=${c}, oldRunID=${f}`);if(!Fut(h))throw new Error("Run is not eligible for rerun or a dev run");let y=gOe(h.runDetails.environmentID),C=OU(i,`Unable to parse runID: ${i}`),O={...o,runID:C,workspaceID:y},w=await BL(A.workspace(y).user(d),O),T=id().featureFlags;await WJ(c,d,y,l.userCredentials,w,T);let R=await $4(p,c,d,y,kae(l.userCredentials),O),P=await C$r(p,l,h,R,u,r);if(P.id=C,!zut(P)){let V=`Invalid rerun ID ${P.reRunID}`;throw us.errorContext(O,s,V),new Qi(V)}let z=gOe(P.runDetails.environmentID);sl("RUNNER_BACKEND",z===y,O,"Unexpected mismatch between workspace IDs for re-run and original run; workspace for re-run:",z,"workspace for original run:",y);let q=A.run(C);await q.updateHeartbeat({runStatus:"initializing"});let H=Mae(O,q,P.runType);try{let V=await Pae(z,A),U=cWe(P.runDetails,V.jobs);await q.merge({runDetails:{...P.runDetails,refreshDescription:U}});let Q=await J8t(A,P,V),Y=Lae(R,d);V.userConnections[z][d]=Y;let{connectionManager:j,platform:k}=await RL(R,t,ML(Q.size,P.runDetails.parallelism),!1,O);return lWe({allWorkspaceData:V,connectionManager:j,logContext:O,platform:k,renderer:tI(T),runID:C,runInfo:P,nodesInRun:Q,teamInfoAndFirebase:t,workspaceID:z},H)}catch(V){try{await H()}catch(U){us.error("Unable to clean up hearbeat after handling error",V,"innerError",U)}}},Zs0=async(r,t,n,i,o)=>{let s="CloudDevRun:";us.infoContext(o,s,`Starting dev run job coa-${r}`);let a=NYi.assert(n,{logContext:o,logArea:"CLI",errorMessage:"failed to validate request body"}),l=gOe(a.runDetails.environmentID),u=OU(i,`Unable to parse runID: ${i}`),c={...o,runID:u,workspaceID:l},{rootRepository:d,teamInfo:{fbTeamID:p,fbUserID:A}}=t,f=d.org(p),h=await BL(f.workspace(l).user(A),c),y=id().featureFlags;await WJ(p,A,l,a.userCredentials,h,y);let C=await $4(d,p,A,l,kae(a.userCredentials),c),O=f.devRun(u);await O.updateHeartbeat({runStatus:"initializing"});let w={...jrs(a,C,A,r),id:u},T=Mae(c,O,w.runType);try{let R=await Pae(l,f);R.userConnections[l][A]=Lae(C,A);let P=fOe(w.runDetails,R),{connectionManager:z,platform:q}=await RL(C,t,ML(P.size,a.runDetails.parallelism),!1,c);return irs({allWorkspaceData:R,connectionManager:z,logContext:c,platform:q,renderer:tI(y),runID:u,runInfo:w,nodesInRun:P,teamInfoAndFirebase:t,workspaceID:l},T)}catch(R){try{await T()}catch(P){us.errorContext(c,s,"unable to clean up heartbeat with error",P,"following run error",R)}throw R}},ea0=async(r,t,n,i,o)=>{let s="[CloudPlan]",{rootRepository:a,teamInfo:{fbTeamID:l,fbUserID:u}}=t,c=id().featureFlags,{currentWorkspaceData:d,desiredWorkspaceData:p,disablePresync:A,enablePlanRendering:f,workspaceID:h,parameters:y,userCredentials:C,skippedBeforeCollection:O}=n,w={...o,planID:i,workspaceID:h},T={currentWorkspaceData:d,desiredWorkspaceData:p,skippedBeforeCollection:O},R=await qrs(u,l,h,a,C,c,w);us.infoContext(w,s,`Starting plan job coa-${r}`),await zrs(!!f,tI(c),i,h,u,R,y,A,T,a,w,c.isFeatureEnabled("skipPlanContextUpload"))},Tgs=async r=>{let t="[CloudEntry]";if(us.debug("Cloud entrypoint."),!process.env.SCHEDULER_ADDRESS){let f="No SCHEDULER_ADDRESS defined for cloud entrypoint";throw us.emerg(f),new Ye(f)}let n=await Dkt(process.env.COALESCE_COA_CLOUD_TOKEN,void 0,new URL(process.env.SCHEDULER_ADDRESS)),{rootRepository:i,teamInfo:{fbTeamID:o,fbUserID:s},featureFlags:a}=n,l={kubernetesJobUuid:r,orgID:o,userID:s};us.infoContext(l,t,"authenticated user");let u,{action:c,id:d,cloudRunAction:p}=ta0(l);c==="plan"?l.planID=d:l.runID=OU(d,`Unable to parse runID: ${d}`);let A=l;try{await $rs(i,o)&&(Ilr(),us.debugContext(A,t,"super Debug enabled"));let f=process.env.COALESCE_COA_CLOUD_REQUEST_PATH;if(!f){let y="COALESCE_COA_CLOUD_REQUEST_PATH not set!";throw us.emergContext(A,t,y),new Ye(y)}let h=await ra0(f,i,A);u=LU({userID:s,orgID:o,logContext:A,featureFlags:a},()=>(us.infoContext(A,t,`${c} job ${d} started, waiting for completion`),p(r,n,h,d,A))),await u,us.infoContext(A,t,"job completed without exception")}catch(f){return us.errorContext(A,t,"error starting coa run",f),c==="plan"?us.infoContext(A,t,"plan job failed, no run or workspace related state to clean up"):u?(us.infoContext(A,t,"run was initialized, cleaning up run and workspace"),await jts(d,c,i.org(o),f,A),us.infoContext(A,t,"run and workspace cleaned up")):us.infoContext(A,t,"run was not initialized, no run related state to clean up"),await DO(1)}await DO(0)},ta0=r=>{let t="[getCloudRunAction]",n=process.env.COALESCE_COA_CLOUD_ACTION,i=()=>{let o=process.env.COALESCE_COA_CLOUD_RUN_COUNTER;if(!o)throw new Ye("COALESCE_COA_CLOUD_RUN_COUNTER not set!");return o};switch(n){case"deploy":return{id:i(),action:n,cloudRunAction:Js0};case"refresh":return{id:i(),action:n,cloudRunAction:Xs0};case"rerun":return{id:i(),action:n,cloudRunAction:$s0};case"devRun":return{id:i(),action:n,cloudRunAction:Zs0};case"plan":{let o=process.env.COALESCE_COA_CLOUD_PLAN_ID;if(!o){let s=`Plan ID was not set! planID: ${o}`;throw us.emergContext(r,t,s),new Ye(s)}return{id:o,action:n,cloudRunAction:ea0}}default:{let o=n;throw us.emergContext(r,t,`received unexpected COALESCE_COA_CLOUD_ACTION value ${o}`),new Ye(`Error: COALESCE_COA_CLOUD_ACTION is invalid! value=${o}`)}}},ra0=async(r,t,n)=>{let i="[downloadAndCleanupFile]";us.infoContext(n,i,"downloading request data from",r);let o=await t.storage().downloadFile(r),s=wR(o);us.infoContext(n,i,"finished parsing request data as JSON completed; deleting stored request",s);try{await t.storage().deleteFile(r),us.infoContext(n,i,"finished deleting stored request; dispatching cloud run")}catch(a){us.assertContext(n,i,`error deleting stored request at ${r}...continuing`,a)}return o};var jgs=yt(Ugs(),1),{program:$r1,createCommand:Zr1,createArgument:en1,createOption:tn1,CommanderError:rn1,InvalidArgumentError:Wgs,InvalidOptionArgumentError:nn1,Command:Ggs,Argument:in1,Option:CI,Help:on1}=jgs.default;v1e();var F_e=yt(require("fs")),PIs=yt(Ygs());No();qt();kn();KM();var Jgs={openapi:"3.1.0",info:{version:"1.0.0",title:"Coalesce API",description:"REST API for performing operations with the Coalesce backend."},servers:[{url:"https://app.coalescesoftware.io",description:"US primary"},{url:"https://app.eu.coalescesoftware.io",description:"Europe primary"},{url:"https://app.australia-southeast1.gcp.coalescesoftware.io",description:"Australia primary"},{url:"https://app.us-east-1.aws.coalescesoftware.io",description:"US AWS US East"},{url:"https://app.us-east-1.aws.privatelink.coalescesoftware.io",description:"US AWS US East with PrivateLink"},{url:"https://app.us-west-2.aws.coalescesoftware.io",description:"US AWS US West"},{url:"https://app.us-west-2.aws.privatelink.coalescesoftware.io",description:"US AWS US West with PrivateLink"},{url:"https://app.northamerica-northeast1.gcp.coalescesoftware.io",description:"Canada Primary"},{url:"https://app.westus2.azure.coalescesoftware.io",description:"US Azure West 2"},{url:"https://app.eastus2.azure.coalescesoftware.io",description:"US Azure East 2"}],security:[{BearerAuth:[]}],"x-coa-private-pointers":["/paths/~1api~1v2~1render","/paths/~1api~1v2~1render~1health","/components/schemas/PackageDefinition","/components/schemas/RenderRequestV2"],components:{schemas:{DatabaseInfo:{type:"object",required:["apiKey","authDomain","projectId","storageBucket","messagingSenderId","appId","measurementId"],properties:{apiKey:{type:"string"},authDomain:{type:"string"},projectId:{type:"string"},storageBucket:{type:"string"},messagingSenderId:{type:"string"},appId:{type:"string"},measurementId:{type:"string"},emulatorInfo:{type:"object",required:["auth","firestore","storage"],properties:{auth:{type:"string"},firestore:{type:"string"},storage:{type:"string"}}}}},EnvironmentsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of environment information.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/Environment"}},{type:"array",items:{$ref:"#/components/schemas/EnvironmentSummary"}}]},total:{type:"integer",description:"The size of the result set."},startingFrom:{type:"string",description:"The cursor value used in the request."},limit:{type:"integer",description:"The requested page size."},next:{type:["number","null"],description:"The field value representing the start of the next page of results."}}},FeatureFlagsClientConfig:{type:"object",description:"Information a client needs to connect to the feature flag service.",required:["launchDarklyClientID"],properties:{launchDarklyClientID:{type:"string"}}},FeatureFlagsValues:{type:"object",description:"Feature flag values.",properties:{featureFlags:{additionalProperties:{oneOf:[{type:"boolean"},{type:"string"},{type:"number"},{type:"object"},{type:"array"}]}}},required:["featureFlags"]},ProjectsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of project information.",type:"array",items:{$ref:"#/components/schemas/Project"}}}},ProjectResponse:{type:"object",required:["data"],properties:{data:{description:"Information about a project.",$ref:"#/components/schemas/Project"}}},ProjectGitAccountResponse:{$ref:"#/components/schemas/ProjectGitAccountResponseData"},ProjectGitAccountsResponse:{type:"object",required:["data"],properties:{data:{description:"A colleciton of project git accounts",type:"array",items:{$ref:"#/components/schemas/ProjectGitAccountResponseData"}}}},TypesenseConfigResponse:{description:"Summary of configuration data for Typesense in a given org.","x-coa-private":!0,type:"object",required:["typesenseKey","typesenseHosts"],properties:{typesenseKey:{description:"The Typesense access key scoped to a users org.",type:"string"},typesenseHosts:{description:"The Typesense host address(es) for our cluster(s).",type:"array",items:{type:"string"}}}},EnvironmentSummary:{type:"object",description:"Summary information about an environment.",additionalProperties:!1,properties:{createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},id:{type:"string",description:"The Environment ID."},name:{type:"string",description:"Name of the Environment."},project:{type:"string",description:"The Project ID."},status:{$ref:"#/components/schemas/EnvironmentHealth",description:"Status of the Environment."}},required:["createdAt","id","name","project","status"]},ErrorResponse:{description:"Error detail in addition to the HTTP status code and text.",type:"object",required:["error"],properties:{error:{$ref:"#/components/schemas/Error"}}},NodesResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of nodes for an environment.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/NodeSummary"}},{type:"array",items:{$ref:"#/components/schemas/Node"}}]},total:{type:"integer",description:"The size of the result set."},startingFrom:{type:"string",description:"The cursor value used in the request."},limit:{type:"integer",description:"The requested page size."},next:{type:["string","null"],description:"The field value representing the start of the next page of results."}}},NodeSummary:{type:"object",properties:{database:{type:"string",description:"The Snowflake database name."},id:{type:"string",description:"The Coalesce Node ID."},locationName:{type:"string",description:"The Storage Mapping location."},name:{type:"string",description:"The Node name."},nodeType:{$ref:"#/components/schemas/NodeType"},schema:{type:"string",description:"The database schema name."}},required:["database","id","locationName","name","nodeType","schema"]},OrderByDirection:{description:"The sort order for query results.",type:"string",enum:["asc","desc"]},PackageCreateEntity:{description:"A single package entity to be created.","x-coa-private":!0,type:"object",properties:{macros:{type:"string"},dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}},nodeTypes:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageNodeType"}}},required:["macros","dependencies","nodeTypes"]},PackageDependency:{description:"A package dependency.","x-coa-private":!0,type:"object",required:["version","macros","dependencies","releaseID","alias","packageID"],properties:{packageID:{type:"string",minLength:1},alias:{type:"string"},version:{type:"string"},releaseID:{type:"string",minLength:1},macros:{type:"string"},dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}}},examples:[{name:"foo",version:"1.2.3",macros:"{% macro bar() %}hello,{% endmacro %}",nodeTypes:{},dependencies:{dep:{name:"baz",version:"1.1.1",macros:"{% macro bar() %}world!{% endmacro %}",dependencies:{}}}}]},PackageEntityTagV1:{description:"Identifies the package from which the entity came. (Deprecated, see PackageEntityTagV2).","x-coa-private":!0,type:"object",required:["id","version"],properties:{id:{type:"string"},version:{type:"string"}}},PackageEntityTagV2:{description:"Identifies the package from which the entity came.","x-coa-private":!0,type:"object",required:["id","releaseID"],properties:{id:{type:"string"},releaseID:{type:"string"}}},PackageMacro:{description:"A macro in a package.","x-coa-private":!0,type:"string"},PackageNodeType:{description:"A node type in a collection of nodeTypes to be packaged.","x-coa-private":!0,type:"object",required:["name","version","isDisabled","metadata","id"],properties:{name:{type:"string"},version:{type:"number"},id:{type:"string"},isDisabled:{type:"boolean"},metadata:{type:"object"}}},PackageCreateReleaseInfo:{description:"Package release information for a create operation.","x-coa-private":!0,type:"object",properties:{changeLog:{type:"string"},version:{type:"string"},certified:{type:"boolean"}},required:["changeLog","version"]},PackageCreateEntities:{description:"Entities that are part of a package release.","x-coa-private":!0,required:["dependencies","nodeTypes","macros"],properties:{dependencies:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageDependency"}},nodeTypes:{type:"object",additionalProperties:{$ref:"#/components/schemas/PackageNodeType"}},macros:{type:"string"}}},RunsOrderBy:{description:"The field used to sort query results. Defaults to `id`, but must be explicitly provided when also using `startingFrom`. Make sure to match data type.",type:"string",enum:["id","runStartTime","runEndTime"]},RunsResponse:{description:"A collection of runs.",type:"object",required:["limit","next","orderBy","orderByDirection","data"],properties:{limit:{description:"The maximum number of runs returned by this query.",type:"integer"},next:{description:"The field value representing the start of the next page of results.",type:["number","string","null"]},orderByDirection:{$ref:"#/components/schemas/OrderByDirection"},orderBy:{$ref:"#/components/schemas/RunsOrderBy"},data:{description:"A collection of runs.",anyOf:[{type:"array",items:{$ref:"#/components/schemas/RunSummary"}},{type:"array",items:{$ref:"#/components/schemas/RunInfo"}}]}}},RunResultsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of run results.",type:"array",items:{$ref:"#/components/schemas/RunResult"}}}},RunSummary:{type:"object",properties:{id:{description:"The run ID.",type:"integer"},reRunID:{description:"If this is a re-run, the ID of the original operation.",type:"string"},runStartTime:{description:"The datetime the run started.",type:"string",format:"date-time"},runEndTime:{description:"The datetime the run ended.",type:"string",format:"date-time"},runType:{$ref:"#/components/schemas/RunType"},runStatus:{$ref:"#/components/schemas/RunStatus"},environmentID:{description:"The environment in which the run operation was applied.",type:"string"},runFailureReason:{description:"Information about the cause of a run failure.",type:"string"}},required:["id","runType","runStatus"]},UserEnvironmentRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserEnvironmentRoles"},additionalProperties:!1},UserProjectRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserProjectRoles"},additionalProperties:!1},UserRolesResponse:{type:"array",items:{$ref:"#/components/schemas/UserOrgRoles"},additionalProperties:!1},SingleUserRoleResponseV2:{$ref:"#/components/schemas/UserOrgRolesV2"},UserRoleResponseV2:{type:"object",properties:{userRoles:{type:"array",items:{$ref:"#/components/schemas/UserOrgRolesV2"}}},required:["userRoles"],additionalProperties:!1},FivetranProjectsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of project information.",type:"array",items:{$ref:"#/components/schemas/FivetranProject"}}}},FivetranProjectResponse:{type:"object",required:["data"],properties:{data:{description:"Fivetran project data.",$ref:"#/components/schemas/FivetranProject"}}},FivetranJobsResponse:{type:"object",required:["data"],properties:{data:{description:"A collection of job information.",type:"array",items:{$ref:"#/components/schemas/FivetranJob"}}}},FivetranJobHistoryResponse:{type:"object",required:["data"],properties:{data:{description:"Fivetran job history data.",$ref:"#/components/schemas/FivetranJobHistory"}}},FivetranRefreshJobResponse:{type:"object",required:["data"],properties:{data:{description:"A fivetran job",$ref:"#/components/schemas/FivetranJobHistory"}}},MetricsItem:{type:"object",required:["name","tags","count"],properties:{name:{type:"string"},tags:{type:"array",items:{type:"string"}},count:{type:"integer"}}},MetricsRequest:{type:"object",required:["metrics"],properties:{metrics:{type:"array",items:{$ref:"#/components/schemas/MetricsItem"}}}},BaseEnvironment:{type:"object",description:"Environments are used for deploying your data pipelines to production, test, QA, and other environments.",additionalProperties:!0,properties:{connectionAccount:{type:"string",description:"The account name for the environment connection."},defaultStorageMapping:{type:"string",nullable:!0},description:{type:"string",description:"The Environment description."},name:{type:"string",description:"The Environment name."},oauthEnabled:{type:"boolean",description:"If OAuth is enabled."},runTimeParameters:{type:"object",additionalProperties:!0,description:"The default Environment parameters. Parameters changed during deploy will not show here."},tagColors:{$ref:"#/components/schemas/TagColor"},project:{type:"string"}},required:["name","oauthEnabled","project"]},Environment:{description:"Environments are used for deploying your data pipelines to production, test, QA, and other environments.",allOf:[{$ref:"#/components/schemas/BaseWorkspaceEnv"},{type:"object",additionalProperties:!0,properties:{runTimeParameters:{type:"object",additionalProperties:!0,description:"The default Environment parameters. Parameters changed during deploy will not show here."},currentMappings:{$ref:"#/components/schemas/EnvironmentStorageLocationMappings"}},required:["createdAt","id","status"]}]},EnvironmentCreateRequest:{"x-coa-private":!0,type:"object",description:"Initial values to set on a newly created environment.",allOf:[{$ref:"#/components/schemas/BaseEnvironment"},{type:"object",properties:{mappings:{$ref:"#/components/schemas/EnvironmentStorageLocationMappings"}},additionalProperties:!0}]},EnvironmentHealth:{type:"string",enum:["Deleting","Deploying","Failed Deploy","Failed Dev Run","Failed Refresh","Initializing","Refreshing","Running Dev Run","Waiting"]},EnvironmentStorageLocationMappings:{type:"object",description:"The Storage Mapping name.",additionalProperties:{type:"object",properties:{database:{type:"string",description:"The database name."},schema:{type:"string",description:"The database schema."}}}},BaseProject:{type:"object",description:"A project groups environments and workspaces for easier management and access control.",properties:{platformKind:{$ref:"#/components/schemas/PlatformKind"},description:{type:"string"},gitRepoURL:{type:"string"},name:{type:"string"}},required:["name"]},Project:{description:"A project groups environments and workspaces for easier management and access control.",allOf:[{$ref:"#/components/schemas/BaseProject"},{type:"object",additionalProperties:!0,properties:{createdAt:{type:"string",format:"date-time"},createdBy:{$ref:"#/components/schemas/UserSummary"},updatedAt:{type:"string",format:"date-time"},updatedBy:{$ref:"#/components/schemas/UserSummary"},id:{type:"string"},status:{$ref:"#/components/schemas/ProjectStatus"},workspaces:{type:"array",items:{$ref:"#/components/schemas/WorkspaceSummary"}}},required:["createdAt","updatedAt","id","status","name"]}]},ProjectCreateRequest:{type:"object",description:"A project groups environments and workspaces for easier management and access control.",properties:{platformKind:{$ref:"#/components/schemas/PlatformKind"},description:{type:"string"},gitRepoURL:{type:"string"},name:{type:"string"}},additionalProperties:!1,required:["name","platformKind"]},ProjectPatchRequest:{type:"object",description:"A project groups environments and workspaces for easier management and access control.",properties:{platformKind:{$ref:"#/components/schemas/PlatformKind"},description:{type:"string"},gitRepoURL:{type:"string"},name:{type:"string"}},additionalProperties:!1},ProjectStatus:{type:"string",enum:["active","deleted"]},ProjectGitAccountResponseData:{type:"object",required:["gitAccountID","userID"],properties:{gitAccountID:{type:"string"},userID:{type:"string"}}},ProjectGitAccountSetRequest:{required:["gitAccountID"],properties:{gitAccountID:{type:"string"}}},UserSummary:{type:"object",description:"Summary information about a user.",additionalProperties:!1,properties:{id:{type:"string",description:"The user ID."},firstName:{type:"string",description:"User first name."},lastName:{type:"string",description:"User last name."},email:{type:"string"},accountType:{type:"string",enum:["SSO","normal"]}},required:["id"]},FirestoreWebTimestamp:{type:"object",description:"Timestamp from the web Firestore SDK.",additionalProperties:!1,properties:{seconds:{type:"number"},nanoseconds:{type:"number"}},required:["seconds","nanoseconds"]},FirestoreAdminTimestamp:{type:"object",description:"Timestamp from the admin Firestore SDK.",additionalProperties:!1,properties:{_seconds:{type:"number"},_nanoseconds:{type:"number"}},required:["_seconds","_nanoseconds"]},FirestoreTimestamp:{type:"object",description:"Timestamp from either the web admin Firestore SDKs.",oneOf:[{$ref:"#/components/schemas/FirestoreWebTimestamp"},{$ref:"#/components/schemas/FirestoreAdminTimestamp"}]},PlatformKind:{type:"string",enum:["snowflake","databricks","fabric"]},Error:{type:"object",additionalProperties:!1,properties:{errorString:{description:"The error message.",type:"string"},errorDetail:{description:"Additional detail about the error.",type:"string"}},required:["errorString"]},Node:{type:"object",oneOf:[{$ref:"#/components/schemas/SourceNode"},{$ref:"#/components/schemas/SQLNode"}]},NodeCreateRequest:{type:"object",properties:{nodeType:{$ref:"#/components/schemas/NodeType"},predecessorNodeIDs:{default:[],type:"array",items:{type:"string"},description:"The IDs of the nodes that are predecessors to this node. It can also be empty if it has no predecessors"}},additionalProperties:!1,required:["nodeType","predecessorNodeIDs"]},AliasToStepIDMapping:{type:"object",additionalProperties:{type:"string"}},AppliedColumnTests:{type:"object",description:"Will return `hasNull` or `isDistinct` as true or false if testing is enabled.",additionalProperties:{type:"boolean"}},BaseNode:{type:"object",additionalProperties:!0,properties:{database:{type:"string",description:"The Snowflake database name."},description:{type:"string",description:"The Node description."},id:{type:"string",description:"The Node ID."},locationName:{type:"string",description:"The Storage Mapping location."},name:{type:"string",description:"The Node name."},nodeType:{$ref:"#/components/schemas/NodeType"},schema:{type:"string",description:"The Snowflake schema name."}},required:["database","description","id","locationName","name","nodeType","schema"]},ColumnMetadata:{type:"object",additionalProperties:!1,properties:{appliedColumnTests:{$ref:"#/components/schemas/AppliedColumnTests"},columnID:{type:"string",description:"The column ID."},columnReferences:{items:{$ref:"#/components/schemas/IntermediateColumnRefResult"},type:"array"},config:{type:"object",description:"Returns any configuration options from the Node Config Tab.",additionalProperties:!0},dataType:{type:"string",description:"Column data type."},defaultValue:{type:"string",description:"The default column value."},description:{type:"string",description:"The column description."},hashDetails:{$ref:"#/components/schemas/HashMetadata"},hashedColumns:{type:"array",items:{$ref:"#/components/schemas/ColumnReference"}},isBusinessKey:{type:"boolean",description:"Tags the column as a business key."},isChangeTracking:{type:"boolean",description:"Tags the column as a change tracking column in type 2 dimensions."},isSurrogateKey:{type:"boolean",description:"Tags the column as a surrogate key, e.g. DIM_CUSTOMER_KEY."},keyColumnType:{type:"string",enum:["None","primaryBusinessKey","surrogateKey"]},name:{type:"string",description:"The column name."},nullable:{type:"boolean",description:"If the column can contain null values."},primaryKey:{description:"Tags the column as a primary key.",type:"boolean"},sources:{items:{$ref:"#/components/schemas/SourceColumnReferenceV1"},type:"array"},systemColumnType:{type:"string",enum:["None","sysCreateDate","sysCurrentFlag","sysEndDate","sysStartDate","sysUpdateDate","sysVersion"]},transform:{type:"string"},uniqueKey:{type:"boolean"},isSystemCreateDate:{type:"boolean"},isSystemUpdateDate:{type:"boolean"},isSystemStartDate:{type:"boolean"},isSystemEndDate:{type:"boolean"},isSystemVersion:{type:"boolean"},isSystemCurrentFlag:{type:"boolean"}},required:["columnID","dataType","description","name","nullable"]},ColumnReference:{type:"object",additionalProperties:!1,properties:{columnID:{type:"string",description:"Column ID of the source column."},nodeID:{type:"string",description:"Node ID of the source columm."}},required:["columnID","nodeID"]},CustomSQL:{type:"object",additionalProperties:!1,properties:{customSQL:{type:"string"}},required:["customSQL"]},HashAlgorithm:{type:"string",enum:["MD5","SHA1","SHA256"]},HashMetadata:{type:"object",additionalProperties:!1,properties:{hashAlgorithm:{$ref:"#/components/schemas/HashAlgorithm"},hashType:{enum:["ChangeHash","Hash","HubHash","LinkHash","None"],type:"string"},hubHashes:{items:{$ref:"#/components/schemas/ColumnReference"},type:"array"}},required:["hashAlgorithm"]},IntermediateColumnRefResult:{additionalProperties:!1,properties:{columnName:{type:"string"},tableName:{type:"string",nullable:!0}},required:["columnName","tableName"],type:"object"},JoinCondition:{type:"object",additionalProperties:!1,properties:{joinCondition:{type:"string"}},required:["joinCondition"]},NodeType:{anyOf:[{type:"string",enum:["Dimension","Fact","Hub","Link","Satellite","Source","Stage","View","persistentStage"]},{type:"string"}]},RefLink:{type:"object",additionalProperties:!1,properties:{locationName:{type:"string"},nodeName:{type:"string"}},required:["locationName","nodeName"]},SourceColumnReference:{anyOf:[{$ref:"#/components/schemas/SourceColumnReferenceV1"},{$ref:"#/components/schemas/SourceColumnReferenceV2"}]},SourceColumnReferenceV1:{type:"object",additionalProperties:!1,properties:{columnReferences:{items:{$ref:"#/components/schemas/ColumnReference"},type:"array"},transform:{type:"string",description:"Returns the SQL of any column transformations."}},required:["columnReferences","transform"]},SourceColumnReferenceV2:{type:"object",additionalProperties:!1,properties:{transform:{type:"string",description:"Returns the SQL of any column transformations."}},required:["transform"]},SourceMap:{additionalProperties:!1,properties:{aliases:{$ref:"#/components/schemas/AliasToStepIDMapping"},customSQL:{$ref:"#/components/schemas/CustomSQL"},dependencies:{items:{$ref:"#/components/schemas/RefLink"},type:"array"},join:{$ref:"#/components/schemas/JoinCondition"},name:{type:"string"},noLinkRefs:{items:{$ref:"#/components/schemas/RefLink"},type:"array"}},required:["dependencies","join","name","noLinkRefs"],type:"object"},RunStatus:{enum:["canceled","completed","failed","initializing","rendering","running","waitingToRun"],type:"string"},RunType:{enum:["deploy","refresh"],type:"string"},DatabricksUserConnectionType:{type:"string",enum:["Token","Cloud","OAuthU2M","OAuthM2M"]},FabricUserConnectionType:{type:"string",enum:["oauth"]},SnowflakeUserConnectionType:{type:"string",enum:["Basic","Cloud","KeyPair","OAuth"]},DeployRunDetails:{type:"object",additionalProperties:!1,description:"Deployment run details.",properties:{canceled:{type:"boolean",description:"If the run was canceled."},deployCommit:{type:"string",description:"The full commit hash."},deployCommitMessage:{type:"string",description:"The commit message."},environmentID:{type:"string",description:"The Environment ID for this run."},parallelism:{type:"integer",description:"The parallelism parameter determines how many nodes are processed simultaneously (in parallel) by the Snowflake compute warehouse."},nodesInRun:{type:"integer",description:"The number of Nodes deployed."}},required:["deployCommit","environmentID"]},RefreshRunDetails:{type:"object",additionalProperties:!1,description:"Refresh run details.",properties:{canceled:{type:"boolean",description:"If the run was canceled."},environmentID:{type:"string",description:"The Environment ID for this run."},excludeNodesSelector:{type:"string",description:"A selector string of nodes to exclude."},forceIgnoreEnvironmentStatus:{type:"boolean"},includeNodesSelector:{type:"string",description:"A selector string of nodes to include."},jobID:{type:"integer",description:"The Job ID."},parallelism:{type:"integer",description:"The parallelism parameter determines how many nodes are processed simultaneously (in parallel) by the Snowflake compute warehouse."},refreshDescription:{type:"string",description:"The Job name."},nodesForRefresh:{type:"integer"},nodesInRun:{type:"integer",description:"The number of Nodes deployed."},executor:{type:"string"}},required:["environmentID"]},RunDetails:{description:"Detailed information about a run.",anyOf:[{$ref:"#/components/schemas/DeployRunDetails"},{$ref:"#/components/schemas/RefreshRunDetails"}]},RunInfo:{description:"The full details of a run, without the run results.",type:"object",additionalProperties:!1,properties:{id:{type:"integer"},reRunID:{type:"string",description:"If this is a re-run, the ID of the original operation."},runDetails:{$ref:"#/components/schemas/RunDetails"},runEndTime:{format:"date-time",type:"string",description:"The datetime when the run ended."},runHistory:{items:{type:"integer"},type:"array"},runStartTime:{format:"date-time",type:"string",description:"The datetime the run started."},runStatus:{$ref:"#/components/schemas/RunStatus"},runTimeParameters:{type:"object",description:"The default Environment parameters. Parameters changed during deploy will not show here.",additionalProperties:!0},runType:{$ref:"#/components/schemas/RunType"},userCredentials:{oneOf:[{$ref:"#/components/schemas/SnowflakeUserCredentials"},{$ref:"#/components/schemas/DatabricksUserCredentials"},{$ref:"#/components/schemas/FabricUserCredentials"}]},userID:{type:"string"},projectID:{type:"string"},hasTestFailures:{type:"boolean",description:"Whether the run has test failures."},version:{type:"integer"}},required:["id","runDetails","runStatus","runTimeParameters","runType","projectID"]},FabricUserCredentials:{description:"Information about the Fabric account used to perform a run.",type:"object",additionalProperties:!1,properties:{fabricConnectionString:{type:"string"},fabricAuthType:{$ref:"#/components/schemas/FabricUserConnectionType"},platformKind:{type:"string"}},required:["fabricConnectionString","fabricAuthType"]},DatabricksUserCredentials:{description:"Information about the Databricks account used to perform a run.",type:"object",additionalProperties:!1,properties:{databricksHost:{type:"string"},databricksAuthType:{$ref:"#/components/schemas/DatabricksUserConnectionType"},databricksPath:{type:"string"}},required:["databricksHost","databricksAuthType","databricksPath"]},SnowflakeUserCredentials:{description:"Information about the Snowflake account used to perform a run.",type:"object",additionalProperties:!1,properties:{snowflakeAccount:{type:"string"},snowflakeAuthType:{$ref:"#/components/schemas/SnowflakeUserConnectionType"},snowflakeRole:{type:"string"},snowflakeUsername:{type:"string"},snowflakeWarehouse:{type:"string"}},required:["snowflakeAccount","snowflakeAuthType","snowflakeUsername"]},QueryResult:{type:"object",additionalProperties:!1,properties:{endTime:{type:"string",format:"date-time"},error:{$ref:"#/components/schemas/Error"},isRunning:{type:"boolean",description:"If the queried run is still running."},name:{type:"string",description:"The name of the Stage the query ran on."},queryID:{type:"string"},rowsDeleted:{type:"integer"},rowsInserted:{type:"integer"},rowsUpdated:{type:"integer"},sql:{type:"string",description:"The SQL query run during the stage."},startTime:{type:"string",format:"date-time"},status:{type:"string",description:"The query status."},success:{type:"boolean",description:"If the query results were run successfully."},type:{type:"string",enum:["sql","sqlTest"]},warehouse:{type:"string",description:"Name of the warehouse."}},required:["isRunning","name","sql","status","success"]},RunResult:{type:"object",additionalProperties:!1,description:"The result output describing each query processed during a run.",properties:{isRunning:{type:"boolean",description:"If the queried run is still running."},name:{type:"string"},nodeID:{type:"string"},runState:{type:"string"},hasTestFailures:{type:"boolean"},origin:{$ref:"#/components/schemas/RunOrigins"},queryResults:{description:"The query result returns the status of different stages such as Delete Table or Rename Table. See the queryResults name for the stage.",items:{$ref:"#/components/schemas/QueryResult"},type:"array"},renderQueryResult:{$ref:"#/components/schemas/QueryResult"}},required:["isRunning","name","nodeID","queryResults"]},RunOrigins:{enum:["API","CLI","UI","fivetranAPI"]},OrgRoles:{type:"object",description:"Specifies role assignments.",required:["organizationRoles","projects"],properties:{organizationRoles:{description:"The organization roles assigned to the user.",type:"array",items:{type:"string"}},projects:{description:"A dictionary of project role assignments keyed by project ID.",type:"object",additionalProperties:{$ref:"#/components/schemas/ProjectRoles"}}},additionalProperties:!0},ProjectRoles:{type:"object",description:"Specifies project role assignments.",required:["projectRoles","environments"],properties:{projectRoles:{type:"array",items:{type:"string"}},environments:{description:"A dictionary of environment role assignments keyed by environment ID.",type:"object",additionalProperties:{$ref:"#/components/schemas/EnvironmentRoles"}}},additionalProperties:!0},EnvironmentRoles:{type:"object",description:"Specifies environment role assignments.",required:["environmentRoles"],properties:{environmentRoles:{description:"The environment roles assigned to the user.",type:"array",items:{type:"string"}}},additionalProperties:!0},UserOrgRoles:{description:"The roles assigned to a user.",allOf:[{$ref:"#/components/schemas/OrgRoles"},{type:"object",required:["user","organizationRoles","projects"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserProjectRoles:{description:"The project roles assigned to the user.",allOf:[{$ref:"#/components/schemas/ProjectRoles"},{type:"object",required:["user","projectRoles","environments"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserEnvironmentRoles:{description:"The environment roles assigned to the user.",allOf:[{$ref:"#/components/schemas/EnvironmentRoles"},{type:"object",required:["user"],properties:{user:{$ref:"#/components/schemas/UserSummary"}},additionalProperties:!0}]},UserOrgRolesV2:{description:"The roles assigned to a user.",type:"object",properties:{userID:{type:"string"},organizationRole:{description:`The user role for the org. If the user's organization role does not grant any project permissions and an
|
|
7121
7121
|
environment or project ID was specified, this will be omitted
|
|
7122
7122
|
`,type:"string"},projectRoles:{description:`For each project, if the user has a role, the key is the project ID and the value is the user's role. If the
|
|
7123
7123
|
user has a role but the role grants to environment permissions to a specified environment, it will be omitted.
|