@npayload/sdk 0.0.0-stage → 5.0.5

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.
Files changed (61) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +160 -2
  3. package/dist/chunk-26BFOUGE.mjs +1 -0
  4. package/dist/chunk-2XQXDEXA.mjs +1 -0
  5. package/dist/chunk-455C67EN.mjs +1 -0
  6. package/dist/chunk-4NWQCPI4.mjs +1 -0
  7. package/dist/chunk-5KFQTEH3.mjs +1 -0
  8. package/dist/chunk-5SMWYS7Z.mjs +1 -0
  9. package/dist/chunk-5WGVEULS.mjs +3 -0
  10. package/dist/chunk-6BBB7BRP.mjs +1 -0
  11. package/dist/chunk-6HF3N3NR.mjs +1 -0
  12. package/dist/chunk-6ITUDSL7.mjs +17 -0
  13. package/dist/chunk-A7HA64P6.mjs +1 -0
  14. package/dist/chunk-APBVAT7F.mjs +1 -0
  15. package/dist/chunk-BBHWYMQA.mjs +1 -0
  16. package/dist/chunk-CJDCY2NH.mjs +1 -0
  17. package/dist/chunk-CNAIHF3M.mjs +1 -0
  18. package/dist/chunk-CWBN2DOO.mjs +1 -0
  19. package/dist/chunk-EXNCOEHS.mjs +1 -0
  20. package/dist/chunk-FAO3QJC5.mjs +1 -0
  21. package/dist/chunk-GEJT7NMK.mjs +1 -0
  22. package/dist/chunk-GGXNXM73.mjs +1 -0
  23. package/dist/chunk-HTQLUO4J.mjs +1 -0
  24. package/dist/chunk-I3UZ2FRE.mjs +1 -0
  25. package/dist/chunk-I7YPDC7V.mjs +2 -0
  26. package/dist/chunk-IK32U5FV.mjs +1 -0
  27. package/dist/chunk-JNYV4RW3.mjs +1 -0
  28. package/dist/chunk-JUXYOKI2.mjs +64 -0
  29. package/dist/chunk-K3SNPW2B.mjs +9 -0
  30. package/dist/chunk-KUJJYP3K.mjs +22 -0
  31. package/dist/chunk-LJNU5QHZ.mjs +1 -0
  32. package/dist/chunk-LVVHOJLW.mjs +5 -0
  33. package/dist/chunk-MDW42OG6.mjs +8 -0
  34. package/dist/chunk-MPYL6HQR.mjs +1 -0
  35. package/dist/chunk-MW4TLR2T.mjs +1 -0
  36. package/dist/chunk-O7HHWVMT.mjs +1 -0
  37. package/dist/chunk-OA73YMB6.mjs +6 -0
  38. package/dist/chunk-P5GCOROB.mjs +1 -0
  39. package/dist/chunk-PKG2R6XN.mjs +1 -0
  40. package/dist/chunk-PYLSDRRO.mjs +20 -0
  41. package/dist/chunk-QGH4LHSH.mjs +4 -0
  42. package/dist/chunk-QHGF2GC6.mjs +1 -0
  43. package/dist/chunk-SRQQNHSX.mjs +5 -0
  44. package/dist/chunk-TQFAYJEP.mjs +4 -0
  45. package/dist/chunk-UJP3Q23X.mjs +1 -0
  46. package/dist/chunk-UNDT7J2V.mjs +1 -0
  47. package/dist/chunk-X3VVI7V3.mjs +1 -0
  48. package/dist/chunk-XLK55DEY.mjs +1 -0
  49. package/dist/cli/index.d.mts +54 -0
  50. package/dist/cli/index.d.ts +54 -0
  51. package/dist/cli/index.js +854 -0
  52. package/dist/cli/index.mjs +698 -0
  53. package/dist/events/index.d.mts +10 -0
  54. package/dist/events/index.d.ts +10 -0
  55. package/dist/events/index.js +1 -0
  56. package/dist/events/index.mjs +1 -0
  57. package/dist/index.d.mts +49687 -0
  58. package/dist/index.d.ts +49687 -0
  59. package/dist/index.js +2 -0
  60. package/dist/index.mjs +2 -0
  61. package/package.json +120 -4
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var fR=Object.create;var Ho=Object.defineProperty;var vR=Object.getOwnPropertyDescriptor;var NR=Object.getOwnPropertyNames;var ER=Object.getPrototypeOf,SR=Object.prototype.hasOwnProperty;var u=(i,o)=>Ho(i,"name",{value:o,configurable:!0});var Hi=(i,o)=>()=>(i&&(o=i(i=0)),o);var M=(i,o)=>{for(var e in o)Ho(i,e,{get:o[e],enumerable:!0})},Ic=(i,o,e,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of NR(o))!SR.call(i,r)&&r!==e&&Ho(i,r,{get:()=>o[r],enumerable:!(t=vR(o,r))||t.enumerable});return i};var k=(i,o,e)=>(e=i!=null?fR(ER(i)):{},Ic(o||!i||!i.__esModule?Ho(e,"default",{value:i,enumerable:!0}):e,i)),_R=i=>Ic(Ho({},"__esModule",{value:!0}),i);var yh={};M(yh,{Node18UniversalStreamWrapper:()=>yp});var yp,Rh=Hi(()=>{"use strict";yp=class i{static{u(this,"Node18UniversalStreamWrapper")}readableStream;reader;events;paused;resumeCallback;encoding;constructor(o){this.readableStream=o,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(o,e){this.events[o]?.push(e)}off(o,e){this.events[o]=this.events[o]?.filter(t=>t!==e)}pipe(o){return this.on("data",async e=>{if(o instanceof i)o._write(e);else if(o instanceof WritableStream){let t=o.getWriter();t.write(e).then(()=>t.releaseLock())}else o.write(e)}),this.on("end",async()=>{o instanceof i?o._end():o instanceof WritableStream?o.getWriter().close():o.end()}),this.on("error",async e=>{o instanceof i?o._error(e):o instanceof WritableStream?o.getWriter().abort(e):o.destroy(e)}),this._startReading(),o}pipeTo(o){return this.pipe(o)}unpipe(o){this.off("data",async e=>{if(o instanceof i)o._write(e);else if(o instanceof WritableStream){let t=o.getWriter();t.write(e).then(()=>t.releaseLock())}else o.write(e)}),this.off("end",async()=>{o instanceof i?o._end():o instanceof WritableStream?o.getWriter().close():o.end()}),this.off("error",async e=>{o instanceof i?o._error(e):o instanceof WritableStream?o.getWriter().abort(e):o.destroy(e)})}destroy(o){this.reader.cancel(o).then(()=>{this._emit("close")}).catch(e=>{this._emit("error",e)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:e}=await this.reader.read();if(!o)return e}setEncoding(o){this.encoding=o}async text(){let o=[];for(;;){let{done:t,value:r}=await this.reader.read();if(t)break;r&&o.push(r)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(o).arrayBuffer())}async json(){let o=await this.text();return JSON.parse(o)}_write(o){this._emit("data",o)}_end(){this._emit("end")}_error(o){this._emit("error",o)}_emit(o,e){if(this.events[o])for(let t of this.events[o]||[])t(e)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:e}=await this.reader.read();if(o){this._emit("end"),this._emit("close");break}e&&this._emit("data",e)}}catch(o){this._emit("error",o)}}[Symbol.asyncIterator](){return{next:u(async()=>{this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:e}=await this.reader.read();return o?{done:!0,value:void 0}:{done:!1,value:e}},"next"),[Symbol.asyncIterator](){return this}}}}});var gh={};M(gh,{UndiciStreamWrapper:()=>Rp});var Rp,Ph=Hi(()=>{"use strict";Rp=class i{static{u(this,"UndiciStreamWrapper")}readableStream;reader;events;paused;resumeCallback;encoding;constructor(o){this.readableStream=o,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=!1,this.resumeCallback=null,this.encoding=null}on(o,e){this.events[o]?.push(e)}off(o,e){this.events[o]=this.events[o]?.filter(t=>t!==e)}pipe(o){return this.on("data",e=>{if(o instanceof i)o._write(e);else{let t=o.getWriter();t.write(e).then(()=>t.releaseLock())}}),this.on("end",()=>{o instanceof i?o._end():o.getWriter().close()}),this.on("error",e=>{o instanceof i?o._error(e):o.getWriter().abort(e)}),this._startReading(),o}pipeTo(o){return this.pipe(o)}unpipe(o){this.off("data",e=>{if(o instanceof i)o._write(e);else{let t=o.getWriter();t.write(e).then(()=>t.releaseLock())}}),this.off("end",()=>{o instanceof i?o._end():o.getWriter().close()}),this.off("error",e=>{o instanceof i?o._error(e):o.getWriter().abort(e)})}destroy(o){this.reader.cancel(o).then(()=>{this._emit("close")}).catch(e=>{this._emit("error",e)})}pause(){this.paused=!0,this._emit("pause")}resume(){this.paused&&(this.paused=!1,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null))}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:e}=await this.reader.read();if(!o)return e}setEncoding(o){this.encoding=o}async text(){let o=[];for(;;){let{done:t,value:r}=await this.reader.read();if(t)break;r&&o.push(r)}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(o).arrayBuffer())}async json(){let o=await this.text();return JSON.parse(o)}_write(o){this._emit("data",o)}_end(){this._emit("end")}_error(o){this._emit("error",o)}_emit(o,e){if(this.events[o])for(let t of this.events[o]||[])t(e)}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:e}=await this.reader.read();if(o){this._emit("end"),this._emit("close");break}e&&this._emit("data",e)}}catch(o){this._emit("error",o)}}[Symbol.asyncIterator](){return{next:u(async()=>{this.paused&&await new Promise(t=>{this.resumeCallback=t});let{done:o,value:e}=await this.reader.read();return o?{done:!0,value:void 0}:{done:!1,value:e}},"next"),[Symbol.asyncIterator](){return this}}}}});var bh={};M(bh,{NodePre18StreamWrapper:()=>gp});var gp,fh=Hi(()=>{"use strict";gp=class{static{u(this,"NodePre18StreamWrapper")}readableStream;encoding;constructor(o){this.readableStream=o}on(o,e){this.readableStream.on(o,e)}off(o,e){this.readableStream.off(o,e)}pipe(o){return this.readableStream.pipe(o),o}pipeTo(o){return this.pipe(o)}unpipe(o){o?this.readableStream.unpipe(o):this.readableStream.unpipe()}destroy(o){this.readableStream.destroy(o)}pause(){this.readableStream.pause()}resume(){this.readableStream.resume()}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((o,e)=>{let t=this.readableStream.read();t?o(t):(this.readableStream.once("readable",()=>{let r=this.readableStream.read();o(r)}),this.readableStream.once("error",e))})}setEncoding(o){this.readableStream.setEncoding(o),this.encoding=o}async text(){let o=[],e=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let r of this.readableStream)o.push(e.encode(r));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(o))}async json(){let o=await this.text();return JSON.parse(o)}[Symbol.asyncIterator](){let e=this.readableStream[Symbol.asyncIterator]();return{async next(){let{value:t,done:r}=await e.next();return{value:t,done:r}},[Symbol.asyncIterator](){return this}}}}});var Bf={};M(Bf,{AutoPaginator:()=>ks,CONNECT_CONFIG_RESOURCES:()=>PR,CONNECT_CONTRACT_HASH:()=>RR,EVENTS_CONFIG_RESOURCES:()=>wR,EVENTS_CONTRACT_HASH:()=>uR,HttpTransport:()=>xi,KERNEL_DOOR_URL_ENV:()=>Ao,KernelDoorError:()=>q,KernelDoorKey:()=>uc,KernelDoorSession:()=>Io,KernelSubscription:()=>bi,NPayload:()=>Ii,NPayloadApi:()=>T,NPayloadError:()=>a,NPayloadEventEmitter:()=>Ui,NPayloadFingerprintNotEnrolledError:()=>Vr,NPayloadPlanRequiredError:()=>$r,NPayloadSourceNotAllowedError:()=>Kr,NPayloadTimeoutError:()=>l,NppKernelDoorError:()=>Le,NppProtocolError:()=>gs,NppRefusedError:()=>Rs,NppTransport:()=>Qr,NppTransportError:()=>xe,PRIMUS_CONFIG_RESOURCES:()=>yR,PRIMUS_CONTRACT_HASH:()=>hR,SDK_NAME:()=>Cc,SDK_VERSION:()=>_s,SourceRequests:()=>Ir,SourcesResource:()=>Uo,TransportRefusedError:()=>ys,TransportUnavailableError:()=>V,USER_AGENT:()=>eR,WEBHOOK_DELIVERY_HEADERS:()=>we,WebhookHandler:()=>Mi,WebhookVerificationError:()=>le,autoPaginate:()=>pR,defaultLogger:()=>Yy,defineConnectConfig:()=>gR,defineEventsConfig:()=>lR,definePrimusConfig:()=>mR,extraOf:()=>gy,mergeRequestOptions:()=>cR,redactSensitive:()=>Ss,resolveDoor:()=>Tr,silentLogger:()=>Xy});module.exports=_R(Bf);var Fe=require("crypto");var Gc=require("util");var Bi="[REDACTED_DPOP_PRIVATE_JWK]",Bo=class{static{u(this,"DpopPrivateJwk")}#e;constructor(o){if(!o||typeof o!="object")throw new TypeError("DpopPrivateJwk requires a JsonWebKey");if(o.kty!=="EC"||o.crv!=="P-256")throw new TypeError(`DpopPrivateJwk requires kty=EC, crv=P-256 (got kty=${o.kty}, crv=${o.crv})`);if(typeof o.d!="string"||o.d.length===0)throw new TypeError("DpopPrivateJwk requires the private `d` field");this.#e=o}get publicJwk(){let{d:o,...e}=this.#e;return e}get crv(){return this.#e.crv}unsafeUse(o){return o(this.#e)}toJSON(){return Bi}[Gc.inspect.custom](){return Bi}toString(){return Bi}};function As(i){return i instanceof Bo}u(As,"isDpopPrivateJwk");var qi=new TextEncoder;function Is(i){let o=i instanceof Uint8Array?i:new Uint8Array(i),e="";for(let t=0;t<o.length;t++)e+=String.fromCharCode(o[t]);return Buffer.from(e,"binary").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}u(Is,"b64url");function Mc(i){return Buffer.from(i,"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}u(Mc,"b64urlFromString");async function kR(i){let o=await Fe.webcrypto.subtle.digest("SHA-256",qi.encode(i));return Is(o)}u(kR,"sha256B64Url");async function Gs(){let i=await Fe.webcrypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!0,["sign","verify"]),o=await Fe.webcrypto.subtle.exportKey("jwk",i.publicKey),e=await Fe.webcrypto.subtle.exportKey("jwk",i.privateKey);return{publicJwk:o,privateJwk:e}}u(Gs,"generateDpopKeyPair");function TR(i){let o={EC:["kty","crv","x","y"],RSA:["kty","n","e"],OKP:["kty","crv","x"]},e=i,t=typeof i.kty=="string"?o[i.kty]:void 0;if(t){let E={};for(let S of t)e[S]!==void 0&&(E[S]=e[S]);return E}let{d:r,key_ops:s,ext:n,use:p,alg:c,...N}=e;return N}u(TR,"publicHalf");async function Ms(i){let o=i,e={EC:["crv","kty","x","y"],RSA:["e","kty","n"],OKP:["crv","kty","x"]},t=typeof o.kty=="string"?o.kty:"",r=e[t];if(!r)throw new TypeError(`jwkThumbprint: unsupported key type ${JSON.stringify(o.kty)}`);let s={};for(let p of r){if(typeof o[p]!="string"||o[p].length===0)throw new TypeError(`jwkThumbprint: the ${t} key carries no "${p}" member`);s[p]=o[p]}let n=await Fe.webcrypto.subtle.digest("SHA-256",qi.encode(JSON.stringify(s)));return Is(n)}u(Ms,"jwkThumbprint");function CR(i){if(i)return i();let o=Fe.webcrypto.getRandomValues(new Uint8Array(16));return Is(o)}u(CR,"newJti");function xR(i){try{let o=new URL(i);return o.hash="",o.search="",o.toString()}catch{return i}}u(xR,"canonicalHtu");async function Li(i,o){let e=o.now?Math.floor(o.now()/1e3):Math.floor(Date.now()/1e3),t={typ:"dpop+jwt",alg:"ES256",jwk:TR(i.publicJwk)},r={htm:o.method.toUpperCase(),htu:xR(o.url),iat:e,jti:CR(o.randomJti)};o.accessToken&&(r.ath=await kR(o.accessToken)),o.nonce&&(r.nonce=o.nonce);let s=Mc(JSON.stringify(t)),n=Mc(JSON.stringify(r)),p=`${s}.${n}`,c=await AR(i.privateJwk),N=await Fe.webcrypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},c,qi.encode(p));return`${p}.${Is(N)}`}u(Li,"signDpopProof");var Uc=new WeakMap;async function AR(i){if(As(i)){let o=Uc.get(i);if(o)return o;let e=await i.unsafeUse(t=>Fe.webcrypto.subtle.importKey("jwk",t,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]));return Uc.set(i,e),e}return Fe.webcrypto.subtle.importKey("jwk",i,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"])}u(AR,"resolveSigningKey");var O=class extends Error{static{u(this,"NPayloadError")}code;requestId;status;constructor(o,e){super(o),this.name=this.constructor.name,this.code=e.code,this.requestId=e.requestId,this.status=e.status}isRetryable(){return this.status==null?!1:this.status===408||this.status===429?!0:this.status>=500&&this.status<600}},fe=class extends O{static{u(this,"AuthError")}},tr=class extends O{static{u(this,"AuthScopeError")}isRetryable(){return!1}},Mr=class extends O{static{u(this,"NotFoundError")}isRetryable(){return!1}},nr=class extends O{static{u(this,"ValidationError")}details;constructor(o,e){super(o,e),this.details=e.details}isRetryable(){return!1}},Us=class extends O{static{u(this,"RateLimitedError")}retryAfterMs;constructor(o,e){super(o,e),this.retryAfterMs=e.retryAfterMs}isRetryable(){return!0}},Hs=class extends O{static{u(this,"ConflictError")}isRetryable(){return!1}},Bs=class extends O{static{u(this,"ServerError")}isRetryable(){return!0}},Ur=class extends O{static{u(this,"NetworkError")}isRetryable(){return!0}},Hr=class extends O{static{u(this,"TimeoutError")}isRetryable(){return!0}},ar=class extends O{static{u(this,"PlanRequiredError")}product;upgradeUrl;constructor(o,e){super(o,{code:e.code,status:402,...e.requestId!==void 0?{requestId:e.requestId}:{}}),this.product=e.product,this.upgradeUrl=e.upgradeUrl}isRetryable(){return!1}},IR=["source_network_not_allowed","source_network_not_declared"],GR=["thumbprint_not_bound"];function Zr(i){return typeof i=="string"&&IR.includes(i.toLowerCase())}u(Zr,"isSourceNotAllowedCode");function eo(i){return typeof i=="string"&&GR.includes(i.toLowerCase())}u(eo,"isFingerprintNotEnrolledCode");function ir(i){if(i===null||typeof i!="object")return;let o=i,e=o.error!==null&&typeof o.error=="object"?o.error:void 0;for(let t of[e?.code,o.code,typeof o.error=="string"?o.error:void 0,o.reason])if(Zr(t)||eo(t))return t}u(ir,"networkRuleCodeOf");var Ge=class extends O{static{u(this,"SourceNotAllowedError")}reason;constructor(o,e){super(o,{code:e.code,status:e.status??403,...e.requestId!==void 0?{requestId:e.requestId}:{}}),this.reason=e.code.toLowerCase()==="source_network_not_declared"?"not_declared":"not_allowed"}isRetryable(){return!1}},me=class extends O{static{u(this,"FingerprintNotEnrolledError")}fingerprint;constructor(o,e){super(o,{code:e.code,status:e.status??403,...e.requestId!==void 0?{requestId:e.requestId}:{}}),this.fingerprint=e.fingerprint}isRetryable(){return!1}},Fs="npayload refused this call: it came from a network this app environment does not allow. An administrator can add the network in the dashboard under Settings > Security > Networks.",Ds="npayload refused this call: this app environment has no network yet, so its keys cannot be used. An administrator can add one in the dashboard under Settings > Security > Networks.",zs="npayload refused this call: this instance's key fingerprint is not enrolled for this API key. An administrator can open the key's enrollment window in the dashboard under Developers > API keys, then start this instance again.",qs=class extends O{static{u(this,"CircuitOpenError")}isRetryable(){return!1}};var Ls=class extends O{static{u(this,"ClockDriftError")}driftMs;maxDriftMs;constructor(o,e){let t=Math.round(Math.abs(o)/1e3);super(`local clock is ${t} s ${o>0?"behind":"ahead of"} the server (allowed skew ${Math.round(e/1e3)} s) \u2014 authenticated requests are refused until the clock is corrected`,{code:"clock_drift"}),this.driftMs=o,this.maxDriftMs=e}};function Os(i){let{status:o,body:e,headers:t}=i,r=t.get("x-request-id")??t.get("x-npayload-request-id")??UR(e)??void 0,s=typeof e=="object"&&e!==null?e:null,n=ro(MR(s)??HR(o)),p=ro(zi(s)??BR(o)),c={code:n,status:o,...r!==void 0?{requestId:r}:{}};if(o===402||n==="PLAN_REQUIRED"){let E=Fi(s),S=Di(E?.product),A=Di(E?.upgradePath)??Di(E?.upgradeUrl);return new ar(p,{code:n,...r!==void 0?{requestId:r}:{},...S!==void 0?{product:S}:{},...A!==void 0?{upgradeUrl:A}:{}})}let N=Zr(n)||eo(n)?n:ir(s);if(N!==void 0&&Zr(N)){let E=N.toLowerCase()==="source_network_not_declared";return new Ge(ro(zi(s)??(E?Ds:Fs)),{code:N,status:o,...r!==void 0?{requestId:r}:{}})}if(N!==void 0&&eo(N))return new me(ro(zi(s)??zs),{code:N,status:o,...r!==void 0?{requestId:r}:{}});switch(o){case 400:case 422:{let E=Fi(s);return new nr(p,{...c,...E!==void 0?{details:E}:{}})}case 401:return new fe(p,c);case 403:{let E=Fi(s)?.reason;return n.toLowerCase().includes("scope")||typeof E=="string"&&E.toLowerCase().includes("scope")?new tr(p,c):new fe(p,c)}case 404:return new Mr(p,c);case 409:return new Hs(p,c);case 429:{let E=qR(t,s);return new Us(p,{...c,...E!==void 0?{retryAfterMs:E}:{}})}default:return o>=500&&o<600?new Bs(p,c):new O(p,c)}}u(Os,"errorFromResponse");function Hc(i){if(i instanceof O)return i;if(i instanceof Error){let o=i.name;return o==="AbortError"?new Hr("Request aborted (timeout)",{code:"request_timeout"}):o==="TimeoutError"?new Hr("Request timed out",{code:"request_timeout"}):o==="TypeError"?new Ur(`Network error: ${ro(i.message)}`,{code:"network_error"}):new Ur(ro(i.message),{code:"network_error"})}return new Ur("Unknown network error",{code:"network_error"})}u(Hc,"errorFromException");function qo(i){return i&&typeof i.error=="object"&&i.error!==null?i.error:void 0}u(qo,"nestedError");function MR(i){if(!i)return null;let o=qo(i);return o?.code?o.code:i.code?i.code:null}u(MR,"envelopeCode");function Fi(i){if(!i)return;let o=qo(i)?.details;if(o&&typeof o=="object")return o;if(i.details&&typeof i.details=="object")return i.details}u(Fi,"envelopeDetails");function Di(i){return typeof i=="string"&&i.length>0?i:void 0}u(Di,"nonEmptyString");function zi(i){if(!i)return null;let o=qo(i);return o?.message?o.message:i.message?i.message:i.error_description?i.error_description:null}u(zi,"envelopeMessage");function UR(i){if(typeof i!="object"||i===null)return;let o=qo(i);return o?.request_id??o?.requestId??i.request_id??i.requestId}u(UR,"extractRequestId");function HR(i){switch(i){case 400:case 422:return"validation_error";case 401:return"unauthorized";case 402:return"payment_required";case 403:return"forbidden";case 404:return"not_found";case 409:return"conflict";case 429:return"rate_limited";default:return i>=500?"server_error":"request_failed"}}u(HR,"defaultCodeForStatus");function BR(i){return`Request failed with status ${i}`}u(BR,"defaultMessageForStatus");function qR(i,o){let e=i.get("retry-after");if(e){let s=Number(e);if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let n=Date.parse(e);if(!Number.isNaN(n)){let p=n-Date.now();if(p>0)return p}}let t=qo(o),r=t?.retry_after_ms??t?.retryAfterMs??void 0;return typeof r=="number"&&r>=0?r:void 0}u(qR,"parseRetryAfterMs");function ro(i){return i.replace(/\bBearer\s+[A-Za-z0-9._-]+/gi,"Bearer [REDACTED]").replace(/\bDPoP\s+[A-Za-z0-9._-]+/gi,"DPoP [REDACTED]").replace(/\bBasic\s+[A-Za-z0-9+/=._-]+/gi,"Basic [REDACTED]").replace(/\b[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\b/g,"[JWT_REDACTED]").replace(/(\b(?:Set-)?Cookie:\s*)[^;\r\n]+/gi,"$1[REDACTED]").replace(/("d"\s*:\s*")[^"]+(")/g,"$1[REDACTED]$2").replace(/(["']?(?:hmac|secret|token|api[_-]?key|auth[_-]?token|private[_-]?key|key)["']?\s*[:=]\s*["'])[^"']+(["'])/gi,"$1[REDACTED]$2").replace(/\b([A-Z][A-Z0-9_]*(?:TOKEN|KEY|SECRET|PASSWORD|PWD)[A-Z0-9_]*)=\S+/g,"$1=[REDACTED]")}u(ro,"redactSecretLike");var js={"org:apps:admin":{description:"Administer all apps in the org (bypass app-level RLS)",category:"security",tier:"admin"},"org:account:read":{description:"Read account surfaces for the bound app (environments, app metadata)",category:"security",tier:"developer"},"org:account:write":{description:"Manage account resources for the bound app (create environments, clone)",category:"security",tier:"developer"},"org:events:read":{description:"Read all Events resources (roll-up over every events:*:read scope)",category:"events",tier:"developer"},"org:events:write":{description:"Create/update/publish across all Events resources (roll-up over every events:*:write scope)",category:"events",tier:"developer"},"org:events:admin":{description:"Administer all Events resources (roll-up \u2014 satisfies every Events scope: read, write, and destructive)",category:"events",tier:"admin"},"org:channels:read":{description:"List and view channels",category:"events",tier:"developer"},"org:channels:write":{description:"Create and update channels",category:"events",tier:"developer"},"org:channels:admin":{description:"Delete and archive channels",category:"events",tier:"admin"},"org:messages:read":{description:"Read message history",category:"events",tier:"developer"},"org:messages:write":{description:"Publish messages",category:"events",tier:"developer"},"org:messages:admin":{description:"Delete and purge messages; manage message retention",category:"events",tier:"admin"},"org:subscriptions:read":{description:"List and view subscriptions",category:"events",tier:"developer"},"org:subscriptions:write":{description:"Create and update subscriptions",category:"events",tier:"developer"},"org:subscriptions:admin":{description:"Delete subscriptions and manage delivery tokens",category:"events",tier:"admin"},"org:dlq:read":{description:"View dead-letter queue entries",category:"events",tier:"developer"},"org:dlq:write":{description:"Reprocess and retry DLQ entries",category:"events",tier:"developer"},"org:dlq:admin":{description:"Purge and discard DLQ entries",category:"events",tier:"admin"},"org:consumer_groups:read":{description:"List and view consumer groups",category:"events",tier:"developer"},"org:consumer_groups:write":{description:"Create and update consumer groups",category:"events",tier:"developer"},"org:consumer_groups:admin":{description:"Delete consumer groups and reset offsets",category:"events",tier:"admin"},"org:streams:read":{description:"Read streams and consumer offsets",category:"events",tier:"developer"},"org:streams:write":{description:"Create streams and commit offsets",category:"events",tier:"developer"},"org:streams:admin":{description:"Delete streams and truncate offsets",category:"events",tier:"admin"},"org:snapshots:read":{description:"View subscription snapshots",category:"events",tier:"developer"},"org:snapshots:write":{description:"Create subscription snapshots",category:"events",tier:"developer"},"org:snapshots:admin":{description:"Delete subscription snapshots",category:"events",tier:"admin"},"org:scheduled:read":{description:"View scheduled messages",category:"events",tier:"developer"},"org:scheduled:write":{description:"Schedule messages for future delivery",category:"events",tier:"developer"},"org:scheduled:admin":{description:"Cancel scheduled messages",category:"events",tier:"admin"},"org:kv:read":{description:"Read compacted (key-value) channel state",category:"events",tier:"developer"},"org:kv:write":{description:"Write compacted (key-value) channel state",category:"events",tier:"developer"},"org:kv:admin":{description:"Delete compacted keys and purge KV state",category:"events",tier:"admin"},"org:cross_channels:read":{description:"View cross-channel (cross-cell) routing and remotes",category:"events",tier:"developer"},"org:cross_channels:write":{description:"Configure cross-channel routing and remote definitions",category:"events",tier:"developer"},"org:cross_channels:admin":{description:"Delete cross-channel routes and manage replication",category:"events",tier:"admin"},"org:archive:read":{description:"View archived (cold-tier) messages",category:"events",tier:"developer"},"org:archive:write":{description:"Archive live messages; restore and replay archived messages into channels",category:"events",tier:"developer"},"org:archive:admin":{description:"Restore and purge archived messages",category:"events",tier:"admin"},"org:time_travel:read":{description:"Query historical channel state (time travel)",category:"events",tier:"developer"},"org:time_travel:write":{description:"Create and update time-travel checkpoints and replays",category:"events",tier:"developer"},"org:time_travel:admin":{description:"Delete time-travel checkpoints and purge historical state",category:"events",tier:"admin"},"org:storage_policies:read":{description:"View storage tier policies",category:"events",tier:"developer"},"org:storage_policies:write":{description:"Create and update storage tier policies",category:"events",tier:"developer"},"org:storage_policies:admin":{description:"Delete storage tier policies (admin roll-up: satisfies read + write)",category:"events",tier:"admin"},"org:catalogue:read":{description:"View event catalogue (schema registry) entries",category:"events",tier:"developer"},"org:catalogue:write":{description:"Register and version event types in the catalogue",category:"events",tier:"developer"},"org:catalogue:admin":{description:"Deprecate and delete event catalogue entries",category:"events",tier:"admin"},"org:exchanges:read":{description:"List and view exchanges",category:"events",tier:"developer"},"org:exchanges:write":{description:"Create exchanges and bind channels",category:"events",tier:"developer"},"org:exchanges:admin":{description:"Delete exchanges and remove bindings",category:"events",tier:"admin"},"org:deliveries:read":{description:"View delivery status and history",category:"messaging",tier:"developer"},"org:deliveries:write":{description:"Retry and reprocess failed deliveries",category:"messaging",tier:"admin"},"org:webhooks:read":{description:"View inbound webhook configurations",category:"events",tier:"developer"},"org:webhooks:write":{description:"Create, update, and pause inbound webhooks",category:"events",tier:"developer"},"org:webhooks:admin":{description:"Rotate and reveal inbound webhook signing secrets; revoke webhooks",category:"events",tier:"admin"},"org:notify:read":{description:"Read Notifications resources (dispatches, inbox, preferences, templates, suppression, push tokens)",category:"notifications",tier:"developer"},"org:notify:write":{description:"Send and manage Notifications (dispatch, cancel, inbox, preferences, push tokens)",category:"notifications",tier:"developer"},"org:notify:admin":{description:"Administer Notifications (templates, suppression list, provider webhooks)",category:"notifications",tier:"admin"},"org:adapters:read":{description:"View adapter configurations",category:"adapters",tier:"developer"},"org:adapters:write":{description:"Create, update, and delete adapters",category:"adapters",tier:"admin"},"org:observability:read":{description:"View connector status",category:"adapters",tier:"developer"},"org:observability:write":{description:"Configure connectors (Datadog, SIEM, etc.)",category:"adapters",tier:"admin"},"org:tools:read":{description:"View tool definitions",category:"ai",tier:"developer"},"org:tools:execute":{description:"Execute tools via ASP",category:"ai",tier:"developer"},"org:asp:read":{description:"View ASP sessions",category:"ai",tier:"developer"},"org:asp:write":{description:"Create and update ASP sessions",category:"ai",tier:"developer"},"org:feed:read":{description:"Read all Feed resources (browse listings, view own subscriptions; roll-up over every feed:*:read scope)",category:"feed",tier:"developer"},"org:feed:write":{description:"Manage Feed subscriptions (subscribe, cancel, pause, resume, convert trial\u2192paid; roll-up over every feed:*:write scope)",category:"feed",tier:"developer"},"org:feed:admin":{description:"Administer all Feed resources (roll-up \u2014 satisfies every Feed permission: read, write, and destructive)",category:"feed",tier:"admin"},"org:publishers:read":{description:"View publisher profile",category:"feed",tier:"developer"},"org:publishers:write":{description:"Create and update publisher profile",category:"feed",tier:"admin"},"org:listings:read":{description:"View own listings",category:"feed",tier:"developer"},"org:listings:write":{description:"Create, publish, and depublish listings",category:"feed",tier:"admin"},"org:oauth_clients:read":{description:"View OAuth clients",category:"platform",tier:"developer"},"org:oauth_clients:write":{description:"Create, rotate, and revoke OAuth clients",category:"platform",tier:"developer"},"org:oauth_clients:admin":{description:"Assign admin-tier scopes to OAuth clients",category:"platform",tier:"admin"},"org:settings:read":{description:"View organization settings",category:"platform",tier:"developer"},"org:settings:write":{description:"Update organization settings",category:"platform",tier:"admin"},"org:members:read":{description:"View organization members",category:"platform",tier:"developer"},"org:members:admin":{description:"Invite, remove, and change member roles",category:"platform",tier:"admin"},"org:billing:read":{description:"View plans, invoices, usage",category:"billing",tier:"developer"},"org:billing:write":{description:"Add and update payment methods; create subscriptions",category:"billing",tier:"developer"},"org:billing:admin":{description:"Change plans; manage payouts, refunds, and credits",category:"billing",tier:"owner"},"org:analytics:read":{description:"View analytics (rollups, summaries, event tail, sketches)",category:"analytics",tier:"developer"},"org:audit:read":{description:"View audit logs",category:"security",tier:"developer"},"org:federation:read":{description:"View federation consents",category:"security",tier:"developer"},"org:federation:admin":{description:"Request, approve, and revoke federation",category:"security",tier:"owner"},"org:platform:read":{description:"View platform partner surfaces (apps, tenants, consents)",category:"platform",tier:"developer"},"org:connect:read":{description:"All Connect read surfaces (roll-up over every Connect resource)",category:"connect",tier:"developer"},"org:connect:write":{description:"All Connect write surfaces (roll-up over every Connect resource)",category:"connect",tier:"admin"},"org:connect:admin":{description:"Administer Connect \u2014 satisfies every Connect permission (roll-up)",category:"connect",tier:"owner"},"org:grants:read":{description:"View cross-org access grants, trust scores, usage",category:"connect",tier:"developer"},"org:grants:write":{description:"Request and resume access grants",category:"connect",tier:"admin"},"org:grants:admin":{description:"Approve, reject, and revoke cross-org access grants",category:"connect",tier:"admin"},"org:bridges:read":{description:"View identity bridges and bridge metrics",category:"connect",tier:"developer"},"org:bridges:write":{description:"Create, confirm, resync, suspend, consent identity bridges",category:"connect",tier:"admin"},"org:bridges:admin":{description:"Archive identity bridges (destructive tier)",category:"connect",tier:"owner"},"org:tenant_approvals:read":{description:"View tenant approvals and per-platform tenants",category:"connect",tier:"developer"},"org:tenant_approvals:write":{description:"Initiate and request tenant approvals",category:"connect",tier:"admin"},"org:tenant_approvals:admin":{description:"Approve, revoke, transfer tenant approvals; policy overrides",category:"connect",tier:"admin"},"org:consents:read":{description:"View platform-connect consents and consent challenges",category:"connect",tier:"developer"},"org:consents:write":{description:"Initiate, verify, revoke platform-connect consents",category:"connect",tier:"developer"},"org:profile:read":{description:"View the app's Connect profile and validation preview",category:"connect",tier:"developer"},"org:profile:write":{description:"Update the app's Connect profile (visibility, metadata)",category:"connect",tier:"developer"},"org:explore:read":{description:"Browse and search Connect Explore (read-only surface)",category:"connect",tier:"developer"},"org:partner:read":{description:"View partner governance: audit feed, governed apps, approvals",category:"connect",tier:"developer"},"org:partner:admin":{description:"Partner governance: freeze, reinstate, delist apps (no write tier \u2014 governance, not CRUD)",category:"connect",tier:"owner"},"org:alert_rules:read":{description:"View Connect alert rules",category:"connect",tier:"developer"},"org:alert_rules:write":{description:"Create and update Connect alert rules",category:"connect",tier:"developer"},"org:infrastructure:read":{description:"View cell assignments and health",category:"security",tier:"developer"},"org:infrastructure:admin":{description:"Request provisioning and manage cells",category:"security",tier:"owner"},"org:metrics:read":{description:"View analytics dashboards",category:"security",tier:"developer"},"org:embed:read":{description:"Read embed origin registry",category:"connect",tier:"developer"},"org:embed:write":{description:"Mint/revoke embed sessions and manage embed origins",category:"connect",tier:"developer"},"org:agents:read":{description:"List and view AI agents",category:"primus",tier:"developer"},"org:agents:execute":{description:"Run agent executions (chat, goal)",category:"primus",tier:"developer"},"org:conversations:read":{description:"View agent conversations",category:"primus",tier:"developer"},"org:memory:read":{description:"Search and view agent memories",category:"primus",tier:"developer"},"org:skills:read":{description:"View skill definitions",category:"primus",tier:"developer"},"org:executions:read":{description:"View execution history and status",category:"primus",tier:"developer"},"org:triggers:read":{description:"View agent triggers",category:"primus",tier:"developer"},"org:approvals:read":{description:"View approval queue",category:"primus",tier:"developer"},"org:guardrails:read":{description:"View kill switch and defense config",category:"primus",tier:"developer"},"org:brain:read":{description:"View LLM provider configuration",category:"primus",tier:"developer"},"org:tenants:read":{description:"List and view tenants",category:"primus",tier:"developer"},"org:discovery:read":{description:"View ASP discovery settings",category:"primus",tier:"developer"},"org:discovery:write":{description:"Enable or disable agent discovery",category:"primus",tier:"admin"},"org:compute:read":{description:"View skill runner environments",category:"primus",tier:"developer"},"org:compute:write":{description:"Provision compute environments",category:"primus",tier:"developer"},"org:compute:admin":{description:"Decommission compute environments",category:"primus",tier:"admin"},"org:learning:read":{description:"View learning patterns and feedback",category:"primus",tier:"developer"},"org:teams:read":{description:"View team hierarchy",category:"primus",tier:"developer"},"org:npp:read":{description:"View NPP wire security (per-app DPoP keys + hardware attestation status)",category:"security",tier:"developer"},"org:npp:write":{description:"Self-enroll the app's own NPP DPoP key",category:"security",tier:"developer"},"org:npp:admin":{description:"Rotate NPP DPoP keys + enroll/manage hardware attestation",category:"security",tier:"admin"},"org:keys:write":{description:"Register the app's own NPP DPoP/Ed25519 signing key (connect-time self-enrollment)",category:"security",tier:"developer"},"org:pipes:read":{description:"View workflows, executions, connectors, credential metadata",category:"pipes",tier:"developer"},"org:pipes:write":{description:"Create, update, pause, activate, archive, delete workflows",category:"pipes",tier:"developer"},"org:pipes:execute":{description:"Trigger and cancel workflow executions",category:"pipes",tier:"developer"},"org:pipes:admin":{description:"Full Pipes control \u2014 workflow governance + every pipes/credentials op (admin roll-up)",category:"pipes",tier:"admin"},"org:credentials:read":{description:"List connector credentials (metadata only \u2014 never the secret)",category:"pipes",tier:"developer"},"org:credentials:write":{description:"Store, update, rotate, revoke, delete, test connector credentials",category:"pipes",tier:"developer"},"org:credentials:admin":{description:"Full connector-credential control (admin roll-up \u2014 satisfies credentials read + write)",category:"pipes",tier:"admin"},"org:agents:write":{description:"Create, update, pause, activate, invoke/run agents; assign/unassign skills (product-level write tier)",category:"primus",tier:"developer"},"org:agents:admin":{description:"Destructive agent governance \u2014 archive and remove agents (product-level admin tier)",category:"primus",tier:"admin"},"org:conversations:write":{description:"Create, update, send, and archive conversations",category:"primus",tier:"developer"},"org:conversations:admin":{description:"Remove conversations (destructive)",category:"primus",tier:"admin"},"org:memory:write":{description:"Store, update, and quarantine agent memories",category:"primus",tier:"developer"},"org:memory:admin":{description:"Bulk-delete and purge memories (destructive)",category:"primus",tier:"admin"},"org:skills:write":{description:"Create, update, enable, and synthesize skills",category:"primus",tier:"developer"},"org:skills:admin":{description:"Remove skills and runner environments (destructive)",category:"primus",tier:"admin"},"org:tools:write":{description:"Register, update, and connect tools and MCP servers",category:"primus",tier:"developer"},"org:tools:admin":{description:"Remove tools and disconnect MCP servers (destructive)",category:"primus",tier:"admin"},"org:executions:execute":{description:"Start and run agent executions",category:"primus",tier:"developer"},"org:executions:admin":{description:"Cancel and remove executions (destructive)",category:"primus",tier:"admin"},"org:triggers:write":{description:"Create, update, and enable triggers",category:"primus",tier:"developer"},"org:triggers:admin":{description:"Remove and archive triggers (destructive)",category:"primus",tier:"admin"},"org:approvals:write":{description:"Create approval requests",category:"primus",tier:"developer"},"org:approvals:admin":{description:"Approve or reject agent actions (governance)",category:"primus",tier:"admin"},"org:guardrails:write":{description:"Update guardrail configuration",category:"primus",tier:"developer"},"org:guardrails:admin":{description:"Activate the kill switch and set thresholds (governance)",category:"primus",tier:"admin"},"org:brain:write":{description:"Configure LLM providers and store provider keys",category:"primus",tier:"developer"},"org:brain:admin":{description:"Delete brain configuration (destructive)",category:"primus",tier:"admin"},"org:teams:write":{description:"Create teams and assign specialists",category:"primus",tier:"developer"},"org:teams:admin":{description:"Remove and restructure teams (destructive)",category:"primus",tier:"admin"},"org:tenants:write":{description:"Create and update tenants",category:"primus",tier:"developer"},"org:tenants:admin":{description:"Suspend and archive tenants (destructive)",category:"primus",tier:"admin"},"org:connections:read":{description:"View third-party connections",category:"primus",tier:"developer"},"org:connections:write":{description:"Create, connect, and reconnect connections",category:"primus",tier:"developer"},"org:connections:admin":{description:"Revoke and remove connections (destructive)",category:"primus",tier:"admin"},"org:learning:write":{description:"Submit feedback and manage learning patterns",category:"primus",tier:"developer"},"org:learning:admin":{description:"Purge learning data (destructive)",category:"primus",tier:"admin"},"org:agent_webhooks:read":{description:"List the agent-event webhook endpoints (never the signing secret)",category:"primus",tier:"developer"},"org:agent_webhooks:write":{description:"Create and remove agent-event webhook endpoints (the signing secret is answered once, on create)",category:"primus",tier:"developer"},"org:audit:admin":{description:"Audit governance (retention, config)",category:"primus",tier:"admin"},"org:connectors:read":{description:"View Primus flow workflows and their executions",category:"primus",tier:"developer"},"org:connectors:write":{description:"Create, update, activate, pause, and delete Primus flow workflows; cancel flow executions",category:"primus",tier:"developer"}},Ws=Object.keys(js);var LR=["agents","conversations","memory","skills","tools","executions","triggers","brain","teams","tenants","connections","approvals","guardrails","learning","agent_webhooks","audit"];var FR=["channels","messages","subscriptions","dlq","consumer_groups","streams","snapshots","scheduled","kv","cross_channels","archive","time_travel","storage_policies","catalogue","exchanges","webhooks"];var DR=["grants","bridges","tenant_approvals","consents","profile","explore","partner","alert_rules"];var zR=["pipes","credentials"];function OR(){let i={};for(let[o,e]of Object.entries(js)){let t=o.replace(/^org:/,"");i[t]=e}return i}u(OR,"buildScopes");var Oi=OR(),qc=Object.keys(js).map(i=>i.replace(/^org:/,""));var Qf={developer:Object.entries(Oi).filter(([,i])=>i.tier==="developer").map(([i])=>i),admin:Object.entries(Oi).filter(([,i])=>i.tier==="admin").map(([i])=>i),owner:Object.entries(Oi).filter(([,i])=>i.tier==="owner").map(([i])=>i)},Yf={"publish-only":{label:"Publish Only",description:"Least-privilege publisher: publish messages only \u2014 no channel, subscription, or DLQ access",scopes:["messages:write"],recommended:!0},"read-only":{label:"Read Only",description:"View data without modifications",scopes:["events:read","deliveries:read","npp:read"],recommended:!0},standard:{label:"Standard",description:"Typical SDK usage for publishing and reading events",scopes:["events:read","events:write","deliveries:read"],recommended:!0},pipes:{label:"Pipes (Automation)",description:"Build + run automation workflows: manage workflows, executions, and connector credentials",scopes:["pipes:read","pipes:write","pipes:execute","credentials:read","credentials:write"],recommended:!1},"pipes-readonly":{label:"Pipes \u2014 Read Only",description:"Observe automation: view workflows, executions, governance, and credential metadata \u2014 no changes",scopes:["pipes:read","credentials:read"],recommended:!0},"pipes-operator":{label:"Pipes \u2014 Operator",description:"Author and run workflows (read + write + execute) WITHOUT connector-credential management \u2014 separation of duties",scopes:["pipes:read","pipes:write","pipes:execute"],recommended:!1},"credentials-manager":{label:"Connector Credentials Manager",description:"Manage connector credentials only (read + write) \u2014 store/rotate/revoke secrets without workflow access",scopes:["credentials:read","credentials:write"],recommended:!1},"full-messaging":{label:"Full Events",description:"All Events operations including DLQ/ops, plus delivery + webhook management",scopes:["events:read","events:write","events:admin","deliveries:read","deliveries:write","webhooks:read","webhooks:write"],recommended:!1},"npp-wire":{label:"NPP Wire",description:"Per-app NPP DPoP key + hardware-attestation management",scopes:["npp:read","npp:admin"],recommended:!1},admin:{label:"Admin",description:"Full access: every concrete catalog scope enumerated (incl. the 4 execute scopes). Assign sparingly.",scopes:[...qc],recommended:!1,dangerous:!0}},jR=Ws.filter(i=>i.endsWith(":read"));var Xf=[...jR,"org:metrics:read"];var Zf=Ws.filter(i=>js[i].tier==="developer"),ev=Ws.filter(i=>i!=="org:billing:write"&&i!=="org:billing:admin"&&i!=="org:federation:admin"&&i!=="org:infrastructure:admin"&&i!=="org:apps:admin"&&i!=="org:feed:admin"&&i!==""&&i!==""),rv=[...Ws];var WR={"DELETE /v1/primus/agents/:agentId":["agents:admin"],"DELETE /v1/primus/brain/config":["brain:admin"],"DELETE /v1/primus/conversations/:conversationId":["conversations:admin"],"DELETE /v1/primus/memory/:memoryId":["memory:admin"],"DELETE /v1/primus/skills/:skillId":["skills:admin"],"DELETE /v1/primus/teams/:teamId":["teams:admin"],"DELETE /v1/primus/tools/:toolId":["tools:admin"],"DELETE /v1/primus/triggers/:triggerId":["triggers:admin"],"DELETE /v1/primus/webhooks/:webhookId":["agent_webhooks:write"],"GET /v1/primus/agent-goals":["agents:read"],"GET /v1/primus/agent-goals/:goalId":["agents:read"],"GET /v1/primus/agents":["agents:read"],"GET /v1/primus/agents/:agentId":["agents:read"],"GET /v1/primus/approvals":["approvals:read"],"GET /v1/primus/approvals/:approvalId":["approvals:read"],"GET /v1/primus/approvals/by-agent":["approvals:read"],"GET /v1/primus/approvals/pending":["approvals:read"],"GET /v1/primus/approvals/pending/count":["approvals:read"],"GET /v1/primus/approvals/pending/summary":["approvals:read"],"GET /v1/primus/brain/config":["brain:read"],"GET /v1/primus/brain/llm-dashboard":["brain:read"],"GET /v1/primus/brain/models":["brain:read"],"GET /v1/primus/brain/usage-dashboard":["brain:read"],"GET /v1/primus/config/export":["agents:admin"],"GET /v1/primus/conversations":["conversations:read"],"GET /v1/primus/conversations/:conversationId":["conversations:read"],"GET /v1/primus/conversations/:conversationId/messages":["conversations:read"],"GET /v1/primus/conversations/by-agent":["conversations:read"],"GET /v1/primus/conversations/stats":["conversations:read"],"GET /v1/primus/delegations/by-delegate":["agents:read"],"GET /v1/primus/delegations/by-delegator":["agents:read"],"GET /v1/primus/delegations/by-team":["agents:read"],"GET /v1/primus/entitlements":["agents:read"],"GET /v1/primus/executions":["executions:read"],"GET /v1/primus/executions/:executionId":["executions:read"],"GET /v1/primus/executions/:executionId/details":["executions:read"],"GET /v1/primus/executions/:executionId/events":["executions:read"],"GET /v1/primus/executions/:executionId/traces":["executions:read"],"GET /v1/primus/executions/by-agent":["executions:read"],"GET /v1/primus/executions/by-conversation":["executions:read"],"GET /v1/primus/executions/pending-approvals":["executions:read"],"GET /v1/primus/executions/stats":["executions:read"],"GET /v1/primus/integrations":["connections:read"],"GET /v1/primus/integrations/:connectionId":["connections:read"],"GET /v1/primus/kill-switch":["guardrails:read"],"GET /v1/primus/kill-switch/:killSwitchId":["guardrails:read"],"GET /v1/primus/kill-switch/active":["guardrails:read"],"GET /v1/primus/kill-switch/check":["guardrails:read"],"GET /v1/primus/kill-switch/status":["guardrails:read"],"GET /v1/primus/learning/feedback":["agents:read"],"GET /v1/primus/learning/feedback/by-agent":["agents:read"],"GET /v1/primus/learning/patterns":["agents:read"],"GET /v1/primus/learning/patterns/by-agent":["agents:read"],"GET /v1/primus/learning/predictions":["agents:read"],"GET /v1/primus/learning/proactive-actions":["agents:read"],"GET /v1/primus/learning/stats":["agents:read"],"GET /v1/primus/mcp-connections":["connections:read"],"GET /v1/primus/mcp-servers":["tools:read"],"GET /v1/primus/mcp-servers/:mcpServerId":["tools:read"],"GET /v1/primus/memories/:memoryId/encryption":["memory:read"],"GET /v1/primus/memory":["memory:read"],"GET /v1/primus/memory/:memoryId":["memory:read"],"GET /v1/primus/memory/by-agent":["memory:read"],"GET /v1/primus/memory/by-conversation":["memory:read"],"GET /v1/primus/memory/quarantined":["memory:read"],"GET /v1/primus/memory/recall":["memory:read"],"GET /v1/primus/memory/store/:memoryId/lineage":["memory:read"],"GET /v1/primus/memory/store/:memoryId/retrieval-history":["memory:read"],"GET /v1/primus/memory/store/by-team":["memory:read"],"GET /v1/primus/memory/store/list":["memory:read"],"GET /v1/primus/memory/store/quarantine-summary":["memory:read"],"GET /v1/primus/memory/store/quarantined":["memory:read"],"GET /v1/primus/metrics":["agents:read"],"GET /v1/primus/metrics/aggregate":["agents:read"],"GET /v1/primus/metrics/system":["agents:read"],"GET /v1/primus/observability/alerts":["agents:read"],"GET /v1/primus/observability/errors":["agents:read"],"GET /v1/primus/observability/errors/by-agent":["agents:read"],"GET /v1/primus/observability/errors/by-execution":["agents:read"],"GET /v1/primus/observability/errors/distribution":["agents:read"],"GET /v1/primus/observability/traces/:traceId":["agents:read"],"GET /v1/primus/overview/active-triggers":["agents:read"],"GET /v1/primus/overview/memory-health":["agents:read"],"GET /v1/primus/overview/metrics-summary":["agents:read"],"GET /v1/primus/overview/stats":["agents:read"],"GET /v1/primus/overview/top-agents":["agents:read"],"GET /v1/primus/self-knowledge":["agents:read"],"GET /v1/primus/self-knowledge/:knowledgeId":["agents:read"],"GET /v1/primus/skill-synthesis":["agents:read"],"GET /v1/primus/skill-synthesis/:skillId":["agents:read"],"GET /v1/primus/skill-synthesis/for-tool":["agents:read"],"GET /v1/primus/skills":["skills:read"],"GET /v1/primus/skills/:skillId":["skills:read"],"GET /v1/primus/skills/:skillId/executions":["skills:read"],"GET /v1/primus/skills/:skillId/stats":["skills:read"],"GET /v1/primus/skills/built-in":["skills:read"],"GET /v1/primus/skills/by-category":["skills:read"],"GET /v1/primus/teams":["teams:read"],"GET /v1/primus/teams/:teamId":["teams:read"],"GET /v1/primus/tenants":["tenants:read"],"GET /v1/primus/tenants/:tenantId":["tenants:read"],"GET /v1/primus/tenants/by-external-id":["tenants:read"],"GET /v1/primus/tools":["tools:read"],"GET /v1/primus/tools/:toolId":["tools:read"],"GET /v1/primus/tools/by-name":["tools:read"],"GET /v1/primus/tools/stats":["tools:read"],"GET /v1/primus/triggers":["triggers:read"],"GET /v1/primus/triggers/:triggerId":["triggers:read"],"GET /v1/primus/triggers/:triggerId/executions":["triggers:read"],"GET /v1/primus/triggers/by-agent":["triggers:read"],"GET /v1/primus/usage/by-tenant":["billing:read"],"GET /v1/primus/usage/history":["billing:read"],"GET /v1/primus/usage/limits":["billing:read"],"GET /v1/primus/usage/summary":["billing:read"],"GET /v1/primus/webhooks":["agent_webhooks:read"],"GET /v1/tools":["tools:read"],"PATCH /v1/primus/agent-goals/:goalId":["agents:write"],"PATCH /v1/primus/agents/:agentId":["agents:write"],"PATCH /v1/primus/conversations/:conversationId":["conversations:write"],"PATCH /v1/primus/memory/:memoryId":["memory:write"],"PATCH /v1/primus/skills/:skillId":["skills:write"],"PATCH /v1/primus/teams/:teamId":["teams:write"],"PATCH /v1/primus/tenants/:tenantId":["tenants:write"],"PATCH /v1/primus/tools/:toolId":["tools:write"],"PATCH /v1/primus/triggers/:triggerId":["triggers:write"],"POST /v1/primus/agent-goals":["agents:write"],"POST /v1/primus/agent-goals/:goalId/progress":["agents:write"],"POST /v1/primus/agent-goals/:goalId/status":["agents:write"],"POST /v1/primus/agents":["agents:write"],"POST /v1/primus/agents/:agentId/activate":["agents:write"],"POST /v1/primus/agents/:agentId/archive":["agents:admin"],"POST /v1/primus/agents/:agentId/invoke":["agents:execute"],"POST /v1/primus/agents/:agentId/pause":["agents:write"],"POST /v1/primus/agents/:agentId/run":["agents:execute"],"POST /v1/primus/agents/:agentId/skills/assign":["agents:write"],"POST /v1/primus/agents/:agentId/skills/unassign":["agents:write"],"POST /v1/primus/approvals":["approvals:write"],"POST /v1/primus/approvals/:approvalId/approve":["approvals:write"],"POST /v1/primus/approvals/:approvalId/reject":["approvals:write"],"POST /v1/primus/brain/models/refresh":["brain:write"],"POST /v1/primus/brain/provider-keys":["brain:write"],"POST /v1/primus/brain/provider-models":["brain:read"],"POST /v1/primus/chat/stream-pipeline":["executions:execute"],"POST /v1/primus/config/apply":["agents:admin"],"POST /v1/primus/conversations":["conversations:write"],"POST /v1/primus/conversations/:conversationId/archive":["conversations:admin"],"POST /v1/primus/conversations/:conversationId/send":["conversations:write"],"POST /v1/primus/executions":["executions:execute"],"POST /v1/primus/executions/:executionId/approve":["executions:admin"],"POST /v1/primus/executions/:executionId/cancel":["executions:execute"],"POST /v1/primus/executions/:executionId/reject":["executions:admin"],"POST /v1/primus/executions/batch":["executions:execute"],"POST /v1/primus/integrations/:connectionId/disconnect":["connections:write"],"POST /v1/primus/integrations/:connectionId/refresh":["connections:write"],"POST /v1/primus/integrations/connect":["connections:write"],"POST /v1/primus/kill-switch/activate":["guardrails:admin"],"POST /v1/primus/kill-switch/deactivate":["guardrails:admin"],"POST /v1/primus/learning/feedback":["agents:write"],"POST /v1/primus/learning/patterns/set-active":["agents:write"],"POST /v1/primus/learning/proactive-actions/decide":["agents:write"],"POST /v1/primus/mcp-connections/:credentialId/revoke":["connections:write"],"POST /v1/primus/mcp-servers":["tools:write"],"POST /v1/primus/mcp-servers/:mcpServerId/connect/begin":["connections:write"],"POST /v1/primus/mcp-servers/:mcpServerId/disconnect":["tools:admin"],"POST /v1/primus/mcp-servers/:mcpServerId/oauth/begin":["tools:write"],"POST /v1/primus/mcp-servers/:mcpServerId/oauth/client":["tools:admin"],"POST /v1/primus/mcp-servers/:mcpServerId/reconnect":["tools:write"],"POST /v1/primus/mcp-servers/:mcpServerId/rename":["tools:write"],"POST /v1/primus/mcp-servers/:mcpServerId/rotate-auth":["tools:admin"],"POST /v1/primus/mcp-servers/test":["tools:write"],"POST /v1/primus/memories/:memoryId/decrypt":["memory:read"],"POST /v1/primus/memories/:memoryId/reencrypt":["memory:write"],"POST /v1/primus/memory":["memory:write"],"POST /v1/primus/memory/:memoryId/quarantine":["memory:write"],"POST /v1/primus/memory/:memoryId/unquarantine":["memory:write"],"POST /v1/primus/memory/search":["memory:read"],"POST /v1/primus/memory/search/explain":["memory:read"],"POST /v1/primus/memory/store":["memory:write"],"POST /v1/primus/observability/alerts/acknowledge":["agents:write"],"POST /v1/primus/observability/alerts/resolve":["agents:write"],"POST /v1/primus/observability/errors/resolve":["agents:write"],"POST /v1/primus/self-knowledge":["agents:write"],"POST /v1/primus/self-knowledge/:knowledgeId/active":["agents:write"],"POST /v1/primus/self-knowledge/:knowledgeId/validate":["agents:write"],"POST /v1/primus/skill-synthesis/:skillId/promote":["agents:write"],"POST /v1/primus/skill-synthesis/run-pipeline":["agents:execute"],"POST /v1/primus/skills":["skills:write"],"POST /v1/primus/skills/:skillId/disable":["skills:write"],"POST /v1/primus/skills/:skillId/enable":["skills:write"],"POST /v1/primus/teams":["teams:write"],"POST /v1/primus/teams/assign":["teams:write"],"POST /v1/primus/teams/delegate":["teams:write"],"POST /v1/primus/teams/members":["teams:write"],"POST /v1/primus/teams/remove-member":["teams:admin"],"POST /v1/primus/teams/unassign":["teams:write"],"POST /v1/primus/teams/with-specialists":["teams:write"],"POST /v1/primus/tenants":["tenants:write"],"POST /v1/primus/tenants/:tenantId/archive":["tenants:admin"],"POST /v1/primus/tenants/:tenantId/suspend":["tenants:write"],"POST /v1/primus/tools":["tools:write"],"POST /v1/primus/tools/:toolId/disable":["tools:admin"],"POST /v1/primus/tools/:toolId/enable":["tools:write"],"POST /v1/primus/tools/:toolId/test":["tools:write"],"POST /v1/primus/tools/import":["tools:write"],"POST /v1/primus/triggers":["triggers:write"],"POST /v1/primus/triggers/:triggerId/disable":["triggers:write"],"POST /v1/primus/triggers/:triggerId/enable":["triggers:write"],"POST /v1/primus/triggers/:triggerId/test-fire":["triggers:write"],"POST /v1/primus/webhooks":["agent_webhooks:write"],"PUT /v1/primus/brain/config":["brain:write"]};var $R={"agent-list":{label:"AgentList",ops:[{op:"GET /v1/primus/agents",phase:"mount"}],modeFloor:"custom",status:"live"},"agent-configurator":{label:"AgentConfigurator",ops:[{op:"POST /v1/primus/agents",phase:"action",action:"create",gatesMount:!0},{op:"PATCH /v1/primus/agents/:agentId",phase:"action",action:"update",gatesMount:!0}],modeFloor:"custom",status:"live"},chat:{label:"AgentChat",ops:[{op:"GET /v1/primus/conversations/by-agent",phase:"mount"},{op:"GET /v1/primus/conversations/:conversationId/messages",phase:"mount"},{op:"POST /v1/primus/conversations/:conversationId/send",phase:"action",action:"send",gatesMount:!0},{op:"POST /v1/primus/chat/stream-pipeline",phase:"action",action:"send",gatesMount:!0}],modeFloor:"custom",status:"live"},"run-timeline":{label:"RunTimeline",ops:[{op:"GET /v1/primus/executions",phase:"mount"},{op:"GET /v1/primus/executions/by-agent",phase:"mount"},{op:"GET /v1/primus/executions/by-conversation",phase:"mount"},{op:"GET /v1/primus/executions/:executionId/events",phase:"mount"},{op:"GET /v1/primus/executions/:executionId/traces",phase:"mount"}],modeFloor:"custom",status:"live"},"memory-browser":{label:"MemoryBrowser",ops:[{op:"GET /v1/primus/memory",phase:"mount"},{op:"GET /v1/primus/memory/by-agent",phase:"mount"},{op:"GET /v1/primus/memory/by-conversation",phase:"mount"}],modeFloor:"custom",status:"live"},"guardrails-panel":{label:"GuardrailsPanel",ops:[{op:"GET /v1/primus/kill-switch",phase:"mount"},{op:"GET /v1/primus/kill-switch/status",phase:"mount"},{op:"POST /v1/primus/kill-switch/activate",phase:"action",action:"decide",unwired:!0},{op:"POST /v1/primus/kill-switch/deactivate",phase:"action",action:"decide",unwired:!0}],modeFloor:"custom",status:"not-embeddable"},"approval-inbox":{label:"ApprovalInbox",ops:[{op:"GET /v1/primus/approvals/pending",phase:"mount"},{op:"GET /v1/primus/approvals/pending/summary",phase:"mount"},{op:"POST /v1/primus/approvals/:approvalId/approve",phase:"action",action:"decide"},{op:"POST /v1/primus/approvals/:approvalId/reject",phase:"action",action:"decide"}],modeFloor:"custom",status:"live"},skills:{label:"SkillsTab",ops:[{op:"GET /v1/primus/skills",phase:"mount"},{op:"GET /v1/primus/tools",phase:"mount"},{op:"POST /v1/primus/skills",phase:"action",action:"create"},{op:"POST /v1/primus/agents/:agentId/skills/assign",phase:"action",action:"create"},{op:"POST /v1/primus/agents/:agentId/skills/assign",phase:"action",action:"assign"},{op:"POST /v1/primus/agents/:agentId/skills/unassign",phase:"action",action:"unassign"}],modeFloor:"custom",status:"live"},connect:{label:"Connect",ops:[{op:"GET /v1/primus/mcp-connections",phase:"mount"},{op:"POST /v1/primus/mcp-servers/:mcpServerId/connect/begin",phase:"action",action:"connect"},{op:"POST /v1/primus/mcp-connections/:credentialId/revoke",phase:"action",action:"disconnect"}],modeFloor:"custom",status:"live"},primus:{label:"Primus",ops:[],composedOf:["agent-list","agent-configurator","chat","run-timeline","memory-browser","approval-inbox","skills"],modeFloor:"custom",status:"live"},"tenants.credentials":{label:"tenants.credentials",ops:[],modeFloor:"isolated",status:"not-built",rung:4,aspirationalScope:"tenants.credentials:admin",plannedScopes:[]}};function KR(i){return WR[i]}u(KR,"scopesOf");var Bc=u(i=>[...new Set(i)].sort(),"sorted");function VR(i){let o=new Set,e=new Map,t=[];for(let s of i.ops){let n=KR(s.op);if(i.status!=="not-built"){if(s.phase==="mount"||s.gatesMount===!0)for(let p of n)o.add(p);if(s.phase==="action"){let p=s.action;if(p===void 0)throw new Error(`componentSource: action op "${s.op}" has no \`action\` key`);let c=e.get(p)??new Set;for(let N of n)c.add(N);e.set(p,c)}t.push(`${s.op} \u2192 ${n.join(", ")}`+(s.phase==="action"?` (action: ${s.action}${s.gatesMount?", gates mount":""})`:" (mount)")+(s.unwired?" (not offered by the component)":""))}}let r=Object.fromEntries([...e.entries()].map(([s,n])=>[s,Bc(n)]));return{label:i.label,requiredScopes:Bc(o),...i.composedOf?{composedOf:i.composedOf}:{},...Object.keys(r).length>0?{actionScopes:r}:{},modeFloor:i.modeFloor,status:i.status,...i.rung!==void 0?{rung:i.rung}:{},...i.aspirationalScope!==void 0?{aspirationalScope:i.aspirationalScope}:{},evidence:t}}u(VR,"derive");var ov=Object.freeze(Object.fromEntries(Object.entries($R).map(([i,o])=>[i,VR(o)])));var JR=new Set(FR),QR=new Set(zR),YR=new Set(DR),sv=new Set(LR);function oo(i){return i.replace(/^org:/,"")}u(oo,"toScopeForm");function ji(i,o){return i.includes(o)}u(ji,"hasScope");var tv=new Set(qc);function Lc(i,o){let e=oo(o),t=i.map(oo);if(ji(t,e))return!0;let[r,s]=e.split(":");return!(r==="events"||JR.has(r))||!s?!1:!!(t.includes("events:admin")||s==="read"&&t.includes("events:read")||s==="write"&&t.includes("events:write")||(s==="read"||s==="write")&&t.includes(`${r}:admin`))}u(Lc,"eventsScopeSatisfies");function Fc(i,o){let e=oo(o),t=i.map(oo);if(ji(t,e))return!0;let[r,s]=e.split(":");return!QR.has(r)||!s?!1:!!(s!=="execute"&&t.includes("pipes:admin")||r==="credentials"&&t.includes("credentials:admin"))}u(Fc,"pipesScopeSatisfies");function Dc(i,o){let e=oo(o),t=i.map(oo);if(ji(t,e))return!0;let[r,s]=e.split(":");return!(r==="connect"||YR.has(r))||!s?!1:!!(t.includes("connect:admin")||s==="read"&&t.includes("connect:read")||s==="write"&&t.includes("connect:write")||(s==="read"||s==="write")&&t.includes(`${r}:admin`))}u(Dc,"connectScopeSatisfies");var zc=3e4,Ks=class{static{u(this,"KernelAuthState")}config;fetchImpl;now;cache=null;inflight=new Map;nonces=new Map;fingerprintPromise;constructor(o){this.config=o,this.fetchImpl=o.fetch??globalThis.fetch,this.now=o.now??Date.now}async getAccessToken(o){let e=this.config.refreshMarginMs??zc,t=this.cache;if(t&&t.expiresAt-this.now()>e&&$s(t.scopes,o))return Wi(t);let r=ZR(o),s=this.inflight.get(r);if(s)return Wi(await s);let n=this.fetchToken(o);this.inflight.set(r,n);try{let p=await n;return Wi(p)}finally{this.inflight.get(r)===n&&this.inflight.delete(r)}}async signDpopProof(o){let e=XR(o.url),t=e?this.nonces.get(e):void 0,r={method:o.method,url:o.url,...o.accessToken?{accessToken:o.accessToken}:{},...t?{nonce:t}:{},now:this.now};return Li(this.config.keys,r)}async requireScope(o){let e=await this.getAccessToken([o]);if(!$s(e.scopes,[o]))throw new tr(`Missing required scope: ${o}. Granted: ${e.scopes.join(",")}`,{code:"insufficient_scope",status:403})}cacheNonce(o,e){this.nonces.set(o,e)}peekCache(){return this.cache}invalidate(){this.cache=null}fingerprint(){return this.fingerprintPromise||(this.fingerprintPromise=Ms(this.config.keys.publicJwk).catch(o=>{throw this.fingerprintPromise=void 0,o})),this.fingerprintPromise}async fetchToken(o){let e=this.config.authServerUrl,t=await Li(this.config.keys,{method:"POST",url:e,now:this.now}),r=new URLSearchParams({grant_type:"client_credentials",client_id:this.config.clientId,scope:o.join(" ")});this.config.appId&&r.set("app_id",this.config.appId),this.config.env&&r.set("env_id",this.config.env),this.config.clientSecret&&r.set("client_secret",this.config.clientSecret);let s=await this.fetchImpl(e,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",DPoP:t},body:r.toString()});if(!s.ok){let B={};try{B=await s.json()}catch{}let G=typeof B.error=="object"&&B.error!==null?B.error:void 0,z=typeof B.error=="string"?B.error:void 0;if(ir(B)!==void 0){let F=Os({status:s.status,body:B,headers:s.headers??new Headers});if(F instanceof me){let Q=await this.fingerprint().catch(()=>{});throw new me(F.message,{code:F.code,...F.status!==void 0?{status:F.status}:{},...F.requestId!==void 0?{requestId:F.requestId}:{},...Q!==void 0?{fingerprint:Q}:{}})}if(F instanceof Ge)throw F}throw new fe(B.error_description??z??G?.message??`OAuth token request failed (${s.status})`,{code:z??G?.code??"oauth_failed",status:s.status})}let n=await s.json();if(!n.access_token)throw new fe("OAuth token response missing access_token",{code:"oauth_missing_token"});if(n.token_type&&n.token_type.toLowerCase()!=="dpop")throw new O(`Refusing non-DPoP token (got ${n.token_type})`,{code:"non_dpop_token"});let p=this.now()+(n.expires_in??600)*1e3,c=n.scope?n.scope.split(/\s+/).filter(Boolean):Array.from(o),N={token:n.access_token,expiresAt:p,scopes:c},E=this.cache,S=this.config.refreshMarginMs??zc;return E&&E.expiresAt-this.now()>S&&!$s(N.scopes,E.scopes)||(this.cache=N),N}};function Wi(i){return{token:i.token,tokenType:"DPoP",expiresAt:i.expiresAt,scopes:i.scopes}}u(Wi,"toAccessToken");function Oc(i,o){return $s(i,[o])}u(Oc,"scopesCover");function $s(i,o){return i.includes("*")?!0:o.every(e=>Lc(i,e)||Dc(i,e)||Fc(i,e))}u($s,"hasAllScopes");function XR(i){try{return new URL(i).origin}catch{return null}}u(XR,"safeOrigin");function ZR(i){return[...i].sort().join(" ")}u(ZR,"scopeKey");var eg="NPAYLOAD_TEST_RESTART_WINDOW_MS";function Wc(i=globalThis.process?.env){if(!i||i.VITEST!=="true")return;let o=i[eg];if(o===void 0||o==="")return;let e=Number(o);return Number.isFinite(e)&&e>=0?e:void 0}u(Wc,"harnessRestartWindowMs");function jc(i,o,e){let t=0;for(let r=0;r<o;r++){let s=Math.min(r,8);t+=Vs(Math.round(i*2**s*.8),0,e)}return t}u(jc,"lowestScheduleSum");function $c(i,o,e=3e4){let t=Math.max(0,i-1);if(t===0||o<=0)return 200;let r=Math.ceil(e/.8);if(jc(r,t,e)<o)return r;let s=1,n=r;for(;s<n;){let p=Math.floor((s+n)/2);jc(p,t,e)>=o?n=p:s=p+1}return s}u($c,"baseDelayForWindow");var Kc=new Set([408,425,429,500,502,503,504]);function Js(i){let o=i.maxAttempts??5,e=i.attempt,t=i.status,r=i.jitter??Math.random,s=i.now??Date.now;if(e>=o)return{retryable:!1,delayMs:0,attempt:e,reason:`max attempts reached (${o})`};if(t!==void 0&&!Kc.has(t)&&!(t>=500&&t<600))return{retryable:!1,delayMs:0,attempt:e,reason:`non-retryable status ${t}`};let n=rg(i.retryAfterHeader,s);if(n!==void 0)return{retryable:!0,delayMs:Vs(n,0,3e4),attempt:e,reason:"retry-after header"};if(i.retryAfterMs!==void 0&&i.retryAfterMs>=0)return{retryable:!0,delayMs:Vs(i.retryAfterMs,0,3e4),attempt:e,reason:"retry-after envelope"};let c=(i.restartWindowMs!==void 0?$c(o,i.restartWindowMs):200)*2**Math.min(e-1,8),N=1+(r()*.4-.2),E=Vs(Math.round(c*N),0,3e4),S=t!==void 0?`status ${t}`:"transport error";return{retryable:!0,delayMs:E,attempt:e,reason:`${S} (backoff)`}}u(Js,"defaultRetryPolicy");function rg(i,o){if(!i)return;let e=Number(i);if(!Number.isNaN(e)&&e>=0)return Math.round(e*1e3);let t=Date.parse(i);if(!Number.isNaN(t)){let r=t-o();return r>0?r:0}}u(rg,"parseRetryAfter");function Vs(i,o,e){return Math.max(o,Math.min(e,i))}u(Vs,"clamp");function $i(i){return Kc.has(i)||i>=500&&i<600}u($i,"isRetryableStatus");var og=5,sg=3e4,Br=class{static{u(this,"KernelCircuitBreaker")}hosts=new Map;threshold;probeAfterMs;now;openHandlers=new Set;closeHandlers=new Set;deferUntil=new Map;constructor(o={}){this.threshold=o.failureThreshold??og,this.probeAfterMs=o.probeAfterMs??sg,this.now=o.now??Date.now}shouldAllow(o){let e=this.get(o);if(e.state==="closed")return!0;if(e.state==="open"){let t=e.openedAt??this.now();return this.now()-t>=this.probeAfterMs?(e.state="half-open",e.probeInFlight=!0,!0):!1}return e.probeInFlight?!1:(e.probeInFlight=!0,!0)}onOpen(o){return this.openHandlers.add(o),()=>{this.openHandlers.delete(o)}}onClose(o){return this.closeHandlers.add(o),()=>{this.closeHandlers.delete(o)}}noteRateLimit(o,e){this.deferUntil.set(o,e)}rateLimitedUntil(o){let e=this.deferUntil.get(o);if(e!==void 0){if(e<=this.now()){this.deferUntil.delete(o);return}return e}}fire(o,e){for(let t of o)try{t(e)}catch{}}recordSuccess(o){let e=this.get(o),t=e.state!=="closed";e.state="closed",e.failures=0,delete e.openedAt,delete e.lastFailureAt,e.probeInFlight=!1,t&&this.fire(this.closeHandlers,o)}recordFailure(o,e){let t=this.get(o);if(t.probeInFlight=!1,e===void 0||e>=500){if(t.lastFailureAt=this.now(),t.state==="half-open"){t.state="open",t.openedAt=this.now(),this.fire(this.openHandlers,o);return}t.failures+=1,t.failures>=this.threshold&&(t.state="open",t.openedAt=this.now(),this.fire(this.openHandlers,o))}}state(o){let e=this.get(o),t={state:e.state,failures:e.failures};return e.openedAt!==void 0&&e.lastFailureAt!==void 0?{...t,openedAt:e.openedAt,lastFailureAt:e.lastFailureAt}:e.openedAt!==void 0?{...t,openedAt:e.openedAt}:e.lastFailureAt!==void 0?{...t,lastFailureAt:e.lastFailureAt}:t}guard(o){if(!this.shouldAllow(o))throw new qs(`Circuit open for ${o}`,{code:"circuit_open"})}get(o){let e=this.hosts.get(o);return e||(e={state:"closed",failures:0,probeInFlight:!1},this.hosts.set(o,e)),e}};var Vc=require("crypto");function qr(i=Date.now){let e=BigInt(i()).toString(16).padStart(12,"0"),t=(0,Vc.randomBytes)(10),r=(t[0]&15|112).toString(16).padStart(2,"0")+t[1].toString(16).padStart(2,"0"),s=(t[2]&63|128).toString(16).padStart(2,"0")+t[3].toString(16).padStart(2,"0")+t[4].toString(16).padStart(2,"0")+t[5].toString(16).padStart(2,"0")+t[6].toString(16).padStart(2,"0")+t[7].toString(16).padStart(2,"0")+t[8].toString(16).padStart(2,"0")+t[9].toString(16).padStart(2,"0");return[e.slice(0,8),e.slice(8,12),r,s.slice(0,4),s.slice(4,16)].join("-")}u(qr,"newIdempotencyKey");var tg=new Set(["POST","PUT","PATCH","DELETE"]);function ng(i,o){let e=o.toLowerCase();return Object.keys(i).some(t=>t.toLowerCase()===e)}u(ng,"hasHeader");function ag(i,o){if(!i)return{};if(!o)return{...i};let e=o.toLowerCase();return Object.fromEntries(Object.entries(i).filter(([t])=>t.toLowerCase()!==e))}u(ag,"withoutHeader");function ig(i,o){if(!i)return;let e=o.toLowerCase();for(let[t,r]of Object.entries(i))if(t.toLowerCase()===e&&typeof r=="string"&&r!=="")return r}u(ig,"headerValue");function dg(i){return new Promise(o=>setTimeout(o,i))}u(dg,"defaultSleep");async function pg(i,o){if(o?.aborted)throw o.reason??new DOMException("Aborted","AbortError");return o?new Promise((e,t)=>{let r=setTimeout(()=>{o.removeEventListener("abort",s),e()},i),s=u(()=>{clearTimeout(r),t(o.reason??new DOMException("Aborted","AbortError"))},"onAbort");o.addEventListener("abort",s,{once:!0})}):dg(i)}u(pg,"abortableSleep");function cg(i){try{return new URL(i).host}catch{return i}}u(cg,"hostOf");function ug(i){try{return new URL(i).origin}catch{return i}}u(ug,"originOf");function Jc(i){if(!i)return null;let o=/\bnonce="([^"]+)"/.exec(i);return o?o[1]:null}u(Jc,"readNonceFromHeader");async function Ki(i){try{if((i.headers.get("content-type")??"").includes("application/json"))return await i.json();let e=await i.text();if(!e)return null;try{return JSON.parse(e)}catch{return e}}catch{return null}}u(Ki,"readResponseBody");function lg(i,o=Date.now){let e={},t=i.get("x-ratelimit-remaining");t!==null&&t.trim()!==""&&!Number.isNaN(Number(t))&&(e.remaining=Number(t));let r=i.get("x-ratelimit-reset");if(r!==null&&r.trim()!==""&&!Number.isNaN(Number(r))){let n=Number(r);e.resetAt=n>1e12?n:n*1e3}let s=i.get("retry-after");if(s!==null&&s.trim()!==""){let n=Number(s);if(!Number.isNaN(n))e.retryAfterMs=Math.max(0,n*1e3);else{let p=Date.parse(s);Number.isNaN(p)||(e.retryAfterMs=Math.max(0,p-o()))}}return e}u(lg,"parseRateLimit");function wg(i){return i.get("x-request-id")??i.get("x-npayload-request-id")}u(wg,"requestIdOf");async function Vi(i,o){let e=i.fetchImpl??globalThis.fetch,t=i.circuit??new Br,r=i.sleep??((Q,D)=>pg(Q,D)),s=i.now??Date.now,n=i.httpClient,p=n?async(Q,D)=>n.fetch({method:D.method,url:Q,headers:D.headers,body:D.body,...D.signal?{signal:D.signal}:{}}):async(Q,D)=>e(Q,i.dispatcher?{...D,dispatcher:i.dispatcher}:D),c=cg(o.url),N=o.method.toUpperCase(),S=tg.has(N)?o.idempotencyKey??ig(o.headers,"Idempotency-Key")??qr():null;o.scope&&await i.auth.requireScope(o.scope);let A=0,I=!0,B=!0,G=!0;t.guard(c);let z=o.restartWindowMs??Wc()??6e4,F=null;try{for(;;){A+=1;let Q=t.rateLimitedUntil(c);if(Q!==void 0){let X=Q-s();X>0&&await r(X,o.signal)}i.clockDrift?.check();let D=await i.auth.getAccessToken(o.scope?[o.scope]:[]),j=await i.auth.signDpopProof({method:N,url:o.url,accessToken:D.token}),Ie={...ag(o.headers,S?"Idempotency-Key":void 0),Authorization:`DPoP ${D.token}`,DPoP:j,Accept:"application/json"};if(S&&(Ie["Idempotency-Key"]=S),o.traceparent&&(Ie.traceparent=o.traceparent),o.tracestate&&(Ie.tracestate=o.tracestate),o.body!=null&&!ng(Ie,"content-type")&&(Ie["Content-Type"]="application/json"),o.signal?.aborted)throw o.signal.reason??new DOMException("Aborted","AbortError");let K=o.timeoutMs!=null&&o.timeoutMs>0?AbortSignal.timeout(o.timeoutMs):void 0,W=[o.signal,K].filter(X=>X!=null),Y=W.length>1?AbortSignal.any(W):W[0],U;try{U=await p(o.url,{method:N,headers:Ie,body:o.body??null,...Y?{signal:Y}:{}})}catch(X){if(X instanceof Error&&X.name==="AbortError")throw X;let Cs=X instanceof Error&&X.name==="TimeoutError",xs=Js({attempt:A,...o.maxAttempts!==void 0?{maxAttempts:o.maxAttempts}:{},restartWindowMs:z});if(F={},xs.retryable){i.onRetry?.({attempt:A,reason:xs.reason,nextDelayMs:xs.delayMs}),await r(xs.delayMs,o.signal);continue}throw Cs?new Hr(`Request timed out after ${o.timeoutMs}ms`,{code:"timeout"}):Hc(X)}if(U.status===401&&I){let X=U.headers.get("www-authenticate"),Cs=Jc(X);if(Cs){i.auth.cacheNonce(ug(o.url),Cs),I=!1,A-=1;continue}}let ie;if(U.status===401&&B&&!Jc(U.headers.get("www-authenticate"))&&(ie={body:await Ki(U)},ir(ie.body)===void 0)){B=!1,i.auth.invalidate();continue}i.clockDrift?.observe(U.headers.get("date"),s());let se=lg(U.headers,s);se.remaining===0&&(se.resetAt!==void 0?t.noteRateLimit(c,se.resetAt):se.retryAfterMs!==void 0&&t.noteRateLimit(c,s()+se.retryAfterMs),i.onRateLimit?.(se));let Ts=wg(U.headers);if(U.status>=200&&U.status<300)return t.recordSuccess(c),{data:await Ki(U),response:U,idempotencyKey:S,requestId:Ts,rateLimit:se};let bR=ie!==void 0?ie.body:await Ki(U),he=Os({status:U.status,body:bR,headers:U.headers,url:o.url});if(F={status:U.status},he instanceof Ge&&G){G=!1,i.auth.peekCache()?.token===D.token&&i.auth.invalidate();continue}if(he instanceof me&&he.fingerprint===void 0){let X=await i.auth.fingerprint().catch(()=>{});he=new me(he.message,{code:he.code,...he.status!==void 0?{status:he.status}:{},...he.requestId!==void 0?{requestId:he.requestId}:{},...X!==void 0?{fingerprint:X}:{}})}if($i(U.status)){let X=Js({attempt:A,status:U.status,retryAfterHeader:U.headers.get("retry-after"),...o.maxAttempts!==void 0?{maxAttempts:o.maxAttempts}:{},restartWindowMs:z});if(X.retryable){i.onRetry?.({attempt:A,reason:X.reason,nextDelayMs:X.delayMs}),await r(X.delayMs,o.signal);continue}}throw he instanceof O?he:new O(String(he),{code:"unknown"})}}catch(Q){throw F&&t.recordFailure(c,F.status),Q}}u(Vi,"kernelSend");var Yi=require("dns"),Xi=k(require("tls"),1),dr=require("undici");var Yc=20,Xc=3e4,Zc=1e4;function eu(i,o,e){if(!e)return!1;let t=i.toLowerCase();for(let r of e.split(/[\s,]+/)){let s=r.trim().toLowerCase();if(!s)continue;if(s==="*")return!0;let[n,p]=s.startsWith("[")?[s.slice(0,s.indexOf("]")+1),s.slice(s.indexOf("]")+2)]:s.split(":"),c=n.startsWith(".")?n.slice(1):n;if((t===c||t.endsWith(`.${c}`))&&!(p&&p!==o))return!0}return!1}u(eu,"noProxyMatches");function Ji(i,...o){for(let e of o){let t=i[e];if(t&&t.trim())return t.trim()}}u(Ji,"pick");function ru(i,o){let e=i.port||(i.protocol==="https:"?"443":"80");if(eu(i.hostname,e,Ji(o,"NO_PROXY","no_proxy")))return;let t=i.protocol==="https:"?Ji(o,"HTTPS_PROXY","https_proxy","ALL_PROXY","all_proxy"):Ji(o,"HTTP_PROXY","http_proxy","ALL_PROXY","all_proxy");if(t)try{return new URL(t).origin}catch{return}}u(ru,"proxyFor");function hg(i){return typeof i=="string"?new URL(i):i}u(hg,"originUrl");var Qi,ou=u(async i=>{Qi??=new Yi.promises.Resolver({timeout:2e3,tries:2});let[o,e]=await Promise.allSettled([Qi.resolve4(i,{ttl:!0}),Qi.resolve6(i,{ttl:!0})]),t=[];if(o.status==="fulfilled")for(let s of o.value)t.push({address:s.address,family:4,ttlMs:s.ttl*1e3});if(e.status==="fulfilled")for(let s of e.value)t.push({address:s.address,family:6,ttlMs:s.ttl*1e3});return t.length>0?t:(await Yi.promises.lookup(i,{all:!0})).map(s=>({address:s.address,family:s.family===6?6:4,ttlMs:0}))},"resolveWithServerTtl");function mg(){let i=Xi;return typeof i.getCACertificates=="function"?i.getCACertificates("default"):Xi.rootCertificates}u(mg,"defaultTrustStore");var Lo=class extends dr.Dispatcher{static{u(this,"KernelDispatcher")}pool;tunnels=new Map;env;connections;tlsMin;ca;allowH2;constructor(o={}){super(),this.connections=o.connections??Yc,this.tlsMin=o.tlsMin??"TLSv1.3",this.ca=o.ca,this.allowH2=o.allowH2??!0,this.env=o.env??process.env;let e=o.dns?.lookup??ou,t=dr.interceptors.dns({maxTTL:o.dns?.maxTtlMs??Zc,dualStack:!0,lookup:u((r,s,n)=>{e(r.hostname).then(p=>n(null,p.map(c=>({address:c.address,family:c.family,ttl:c.ttlMs}))),p=>n(p instanceof Error?p:new Error(String(p)),[]))},"lookup")});this.pool=new dr.Agent({connections:this.connections,pipelining:1,keepAliveTimeout:o.keepAliveTimeoutMs??Xc,allowH2:this.allowH2,connect:this.tlsOptions()}).compose(t)}tlsOptions(){return this.ca!==void 0?{minVersion:this.tlsMin,ca:[...mg(),...this.ca]}:{minVersion:this.tlsMin}}dispatch(o,e){if(o.origin===void 0)return this.pool.dispatch(o,e);let t=hg(o.origin),r=ru(t,this.env);if(!r)return this.pool.dispatch(o,e);if(t.protocol==="http:")return this.pool.dispatch({...o,origin:r,path:`${t.origin}${o.path}`},e);let s=this.tunnels.get(r);return s||(s=new dr.ProxyAgent({uri:r,connections:this.connections,allowH2:this.allowH2,proxyTls:{minVersion:this.tlsMin},requestTls:this.tlsOptions()}),this.tunnels.set(r,s)),s.dispatch(o,e)}everyDispatcher(){return[this.pool,...this.tunnels.values()]}close(o){let e=Promise.all(this.everyDispatcher().map(t=>t.close())).then(()=>{this.tunnels.clear()});if(o){e.then(o,o);return}return e}destroy(o,e){let t=typeof o=="function"?null:o??null,r=typeof o=="function"?o:e,s=Promise.all(this.everyDispatcher().map(n=>n.destroy(t))).then(()=>{this.tunnels.clear()});if(r){s.then(r,r);return}return s}};var su=6e4,Fo=class{static{u(this,"ClockDriftGuard")}maxDriftMs;drift;constructor(o=su){this.maxDriftMs=o}get driftMs(){return this.drift}observe(o,e){if(!o)return;let t=Date.parse(o);Number.isNaN(t)||(this.drift=t-e)}check(){if(this.drift!==void 0&&Math.abs(this.drift)>this.maxDriftMs)throw new Ls(this.drift,this.maxDriftMs)}};var hu=require("async_hooks");var Ve="1.9.1";var tu=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function yg(i){let o=new Set([i]),e=new Set,t=i.match(tu);if(!t)return()=>!1;let r={major:+t[1],minor:+t[2],patch:+t[3],prerelease:t[4]};if(r.prerelease!=null)return u(function(c){return c===i},"isExactmatch");function s(p){return e.add(p),!1}u(s,"_reject");function n(p){return o.add(p),!0}return u(n,"_accept"),u(function(c){if(o.has(c))return!0;if(e.has(c))return!1;let N=c.match(tu);if(!N)return s(c);let E={major:+N[1],minor:+N[2],patch:+N[3],prerelease:N[4]};return E.prerelease!=null||r.major!==E.major?s(c):r.major===0?r.minor===E.minor&&r.patch<=E.patch?n(c):s(c):r.minor<=E.minor?n(c):s(c)},"isCompatible")}u(yg,"_makeCompatibilityCheck");var nu=yg(Ve);var Rg=Ve.split(".")[0],Do=Symbol.for(`opentelemetry.js.api.${Rg}`),zo=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function so(i,o,e,t=!1){var r;let s=zo[Do]=(r=zo[Do])!==null&&r!==void 0?r:{version:Ve};if(!t&&s[i]){let n=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${i}`);return e.error(n.stack||n.message),!1}if(s.version!==Ve){let n=new Error(`@opentelemetry/api: Registration of version v${s.version} for ${i} does not match previously registered API v${Ve}`);return e.error(n.stack||n.message),!1}return s[i]=o,e.debug(`@opentelemetry/api: Registered a global for ${i} v${Ve}.`),!0}u(so,"registerGlobal");function Je(i){var o,e;let t=(o=zo[Do])===null||o===void 0?void 0:o.version;if(!(!t||!nu(t)))return(e=zo[Do])===null||e===void 0?void 0:e[i]}u(Je,"getGlobal");function to(i,o){o.debug(`@opentelemetry/api: Unregistering a global for ${i} v${Ve}.`);let e=zo[Do];e&&delete e[i]}u(to,"unregisterGlobal");var Qs=class{static{u(this,"DiagComponentLogger")}constructor(o){this._namespace=o.namespace||"DiagComponentLogger"}debug(...o){return Oo("debug",this._namespace,o)}error(...o){return Oo("error",this._namespace,o)}info(...o){return Oo("info",this._namespace,o)}warn(...o){return Oo("warn",this._namespace,o)}verbose(...o){return Oo("verbose",this._namespace,o)}};function Oo(i,o,e){let t=Je("diag");if(t)return t[i](o,...e)}u(Oo,"logProxy");var te;(function(i){i[i.NONE=0]="NONE",i[i.ERROR=30]="ERROR",i[i.WARN=50]="WARN",i[i.INFO=60]="INFO",i[i.DEBUG=70]="DEBUG",i[i.VERBOSE=80]="VERBOSE",i[i.ALL=9999]="ALL"})(te||(te={}));function au(i,o){i<te.NONE?i=te.NONE:i>te.ALL&&(i=te.ALL),o=o||{};function e(t,r){let s=o[t];return typeof s=="function"&&i>=r?s.bind(o):function(){}}return u(e,"_filterFunc"),{error:e("error",te.ERROR),warn:e("warn",te.WARN),info:e("info",te.INFO),debug:e("debug",te.DEBUG),verbose:e("verbose",te.VERBOSE)}}u(au,"createLogLevelDiagLogger");var gg="diag",pr=class i{static{u(this,"DiagAPI")}static instance(){return this._instance||(this._instance=new i),this._instance}constructor(){function o(r){return function(...s){let n=Je("diag");if(n)return n[r](...s)}}u(o,"_logProxy");let e=this,t=u((r,s={logLevel:te.INFO})=>{var n,p,c;if(r===e){let S=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return e.error((n=S.stack)!==null&&n!==void 0?n:S.message),!1}typeof s=="number"&&(s={logLevel:s});let N=Je("diag"),E=au((p=s.logLevel)!==null&&p!==void 0?p:te.INFO,r);if(N&&!s.suppressOverrideMessage){let S=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";N.warn(`Current logger will be overwritten from ${S}`),E.warn(`Current logger will overwrite one already registered from ${S}`)}return so("diag",E,e,!0)},"setLogger");e.setLogger=t,e.disable=()=>{to(gg,e)},e.createComponentLogger=r=>new Qs(r),e.verbose=o("verbose"),e.debug=o("debug"),e.info=o("info"),e.warn=o("warn"),e.error=o("error")}};function ed(i){return Symbol.for(i)}u(ed,"createContextKey");var Zi=class i{static{u(this,"BaseContext")}constructor(o){let e=this;e._currentContext=o?new Map(o):new Map,e.getValue=t=>e._currentContext.get(t),e.setValue=(t,r)=>{let s=new i(e._currentContext);return s._currentContext.set(t,r),s},e.deleteValue=t=>{let r=new i(e._currentContext);return r._currentContext.delete(t),r}}},jo=new Zi;var Ys=class{static{u(this,"NoopContextManager")}active(){return jo}with(o,e,t,...r){return e.call(t,...r)}bind(o,e){return e}enable(){return this}disable(){return this}};var rd="context",Pg=new Ys,cr=class i{static{u(this,"ContextAPI")}constructor(){}static getInstance(){return this._instance||(this._instance=new i),this._instance}setGlobalContextManager(o){return so(rd,o,pr.instance())}active(){return this._getContextManager().active()}with(o,e,t,...r){return this._getContextManager().with(o,e,t,...r)}bind(o,e){return this._getContextManager().bind(o,e)}_getContextManager(){return Je(rd)||Pg}disable(){this._getContextManager().disable(),to(rd,pr.instance())}};var Xs;(function(i){i[i.NONE=0]="NONE",i[i.SAMPLED=1]="SAMPLED"})(Xs||(Xs={}));var od="0000000000000000",sd="00000000000000000000000000000000",iu={traceId:sd,spanId:od,traceFlags:Xs.NONE};var De=class{static{u(this,"NonRecordingSpan")}constructor(o=iu){this._spanContext=o}spanContext(){return this._spanContext}setAttribute(o,e){return this}setAttributes(o){return this}addEvent(o,e){return this}addLink(o){return this}addLinks(o){return this}setStatus(o){return this}updateName(o){return this}end(o){}isRecording(){return!1}recordException(o,e){}};var td=ed("OpenTelemetry Context Key SPAN");function Zs(i){return i.getValue(td)||void 0}u(Zs,"getSpan");function du(){return Zs(cr.getInstance().active())}u(du,"getActiveSpan");function Wo(i,o){return i.setValue(td,o)}u(Wo,"setSpan");function pu(i){return i.deleteValue(td)}u(pu,"deleteSpan");function cu(i,o){return Wo(i,new De(o))}u(cu,"setSpanContext");function et(i){var o;return(o=Zs(i))===null||o===void 0?void 0:o.spanContext()}u(et,"getSpanContext");var rt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function uu(i,o){if(typeof i!="string"||i.length!==o)return!1;let e=0;for(let t=0;t<i.length;t+=4)e+=(rt[i.charCodeAt(t)]|0)+(rt[i.charCodeAt(t+1)]|0)+(rt[i.charCodeAt(t+2)]|0)+(rt[i.charCodeAt(t+3)]|0);return e===o}u(uu,"isValidHex");function bg(i){return uu(i,32)&&i!==sd}u(bg,"isValidTraceId");function fg(i){return uu(i,16)&&i!==od}u(fg,"isValidSpanId");function ot(i){return bg(i.traceId)&&fg(i.spanId)}u(ot,"isSpanContextValid");function lu(i){return new De(i)}u(lu,"wrapSpanContext");var nd=cr.getInstance(),no=class{static{u(this,"NoopTracer")}startSpan(o,e,t=nd.active()){if(!!e?.root)return new De;let s=t&&et(t);return vg(s)&&ot(s)?new De(s):new De}startActiveSpan(o,e,t,r){let s,n,p;if(arguments.length<2)return;arguments.length===2?p=e:arguments.length===3?(s=e,p=t):(s=e,n=t,p=r);let c=n??nd.active(),N=this.startSpan(o,s,c),E=Wo(c,N);return nd.with(E,p,void 0,N)}};function vg(i){return i!==null&&typeof i=="object"&&"spanId"in i&&typeof i.spanId=="string"&&"traceId"in i&&typeof i.traceId=="string"&&"traceFlags"in i&&typeof i.traceFlags=="number"}u(vg,"isSpanContext");var Ng=new no,st=class{static{u(this,"ProxyTracer")}constructor(o,e,t,r){this._provider=o,this.name=e,this.version=t,this.options=r}startSpan(o,e,t){return this._getTracer().startSpan(o,e,t)}startActiveSpan(o,e,t,r){let s=this._getTracer();return Reflect.apply(s.startActiveSpan,s,arguments)}_getTracer(){if(this._delegate)return this._delegate;let o=this._provider.getDelegateTracer(this.name,this.version,this.options);return o?(this._delegate=o,this._delegate):Ng}};var tt=class{static{u(this,"NoopTracerProvider")}getTracer(o,e,t){return new no}};var Eg=new tt,$o=class{static{u(this,"ProxyTracerProvider")}getTracer(o,e,t){var r;return(r=this.getDelegateTracer(o,e,t))!==null&&r!==void 0?r:new st(this,o,e,t)}getDelegate(){var o;return(o=this._delegate)!==null&&o!==void 0?o:Eg}setDelegate(o){this._delegate=o}getDelegateTracer(o,e,t){var r;return(r=this._delegate)===null||r===void 0?void 0:r.getTracer(o,e,t)}};var Ko;(function(i){i[i.INTERNAL=0]="INTERNAL",i[i.SERVER=1]="SERVER",i[i.CLIENT=2]="CLIENT",i[i.PRODUCER=3]="PRODUCER",i[i.CONSUMER=4]="CONSUMER"})(Ko||(Ko={}));var ao;(function(i){i[i.UNSET=0]="UNSET",i[i.OK=1]="OK",i[i.ERROR=2]="ERROR"})(ao||(ao={}));var nt=cr.getInstance();var ad="trace",at=class i{static{u(this,"TraceAPI")}constructor(){this._proxyTracerProvider=new $o,this.wrapSpanContext=lu,this.isSpanContextValid=ot,this.deleteSpan=pu,this.getSpan=Zs,this.getActiveSpan=du,this.getSpanContext=et,this.setSpan=Wo,this.setSpanContext=cu}static getInstance(){return this._instance||(this._instance=new i),this._instance}setGlobalTracerProvider(o){let e=so(ad,this._proxyTracerProvider,pr.instance());return e&&this._proxyTracerProvider.setDelegate(o),e}getTracerProvider(){return Je(ad)||this._proxyTracerProvider}getTracer(o,e){return this.getTracerProvider().getTracer(o,e)}disable(){to(ad,pr.instance()),this._proxyTracerProvider=new $o}};var it=at.getInstance();var mu="@npayload/sdk",id=class{static{u(this,"AsyncLocalStorageContextManager")}storage=new hu.AsyncLocalStorage;active(){return this.storage.getStore()??jo}with(o,e,t,...r){return this.storage.run(o,()=>e.call(t,...r))}bind(o,e){if(typeof e!="function")return e;let t=this,r=e;return function(...s){return t.with(o,()=>r.apply(this,s))}}enable(){return this}disable(){return this.storage.disable(),this}},wu=!1;function Sg(){let i=it.getTracerProvider(),e=(typeof i.getDelegate=="function"?i.getDelegate():i)?.constructor?.name??"";return e!==""&&e!=="NoopTracerProvider"}u(Sg,"hostHasTracerProvider");function _g(){wu||Sg()&&(wu=!0,nt.setGlobalContextManager(new id))}u(_g,"ensureContextManager");function dd(i){_g();let o=it.getTracer(mu,i.kernelVersion),e="";try{e=new URL(i.url).host}catch{}let t=o.startSpan("http.client",{kind:Ko.CLIENT,attributes:{"http.request.method":i.method,"url.full":i.url,"server.address":e,"npayload.sdk":"node-kernel","npayload.kernel_version":i.kernelVersion,"npayload.client_id":i.clientId,"npayload.path":i.path,"npayload.traceparent":i.traceparent,...i.env!==void 0?{"npayload.env":i.env}:{}}},nt.active());return{span:t,end(r){r.status!==void 0&&t.setAttribute("http.response.status_code",r.status),r.requestId&&t.setAttribute("npayload.request_id",r.requestId),r.error!==void 0?(t.setStatus({code:ao.ERROR,message:r.error instanceof Error?r.error.message:String(r.error)}),r.error instanceof Error&&t.recordException(r.error)):t.setStatus({code:ao.OK}),t.end()}}}u(dd,"startHttpClientSpan");var yu=require("crypto");var kg=/^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/i;function pd(i){return(0,yu.randomBytes)(i).toString("hex")}u(pd,"hex");function Ru(){return`00-${pd(16)}-${pd(8)}-01`}u(Ru,"generateTraceparent");function gu(i){if(!i||!kg.test(i))return Ru();let e=i.split("-")[1],t=pd(8);return`00-${e}-${t}-01`}u(gu,"propagateTraceparent");var Vo=class{static{u(this,"KernelObserver")}handlers=new Map;on(o,e){let t=this.handlers.get(o);return t||(t=new Set,this.handlers.set(o,t)),t.add(e),()=>{this.handlers.get(o)?.delete(e)}}traceparent(o){return gu(o)}emit(o){let e=this.handlers.get(o.type);if(e)for(let t of e)try{t(o)}catch{}}};var Pu=require("crypto");var bu=require("fs");var dt="0.2.0",vu="https://api.npayload.com";function Tg(i){return`${(i.authUrl??i.baseUrl??vu).replace(/\/+$/,"")}/oauth/token`}u(Tg,"tokenEndpointOf");var Cg="X-NPayload-Env",xg=/^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/i,pt=class{static{u(this,"Kernel")}config;auth;observer;circuit;dispatcher;clockDrift;clockNow;methods=new Set;constructor(o){let e=o.config;Ig(e);let t=As(e.dpopPrivateJwk)?e.dpopPrivateJwk:new Bo(e.dpopPrivateJwk),r=e.tlsMin??"TLSv1.3";if(r!=="TLSv1.3"&&r!=="TLSv1.2")throw new nr(`tlsMin must be "TLSv1.3" or "TLSv1.2" (TLS 1.2 is the floor); got ${String(r)}`,{code:"tls_min_below_floor"});let s={...e,tlsMin:r,dpopPrivateJwk:t};this.config=s,this.observer=new Vo;let n=e.testClock!==void 0?()=>e.testClock.now():void 0;this.circuit=new Br(n!==void 0?{now:n}:{}),this.clockDrift=new Fo(e.maxClockDriftMs),this.clockNow=n,this.dispatcher=new Lo({tlsMin:r,...e.tlsCa!==void 0?{ca:e.tlsCa}:{},...e.dns!==void 0?{dns:e.dns}:{}}),this.auth=new Ks({clientId:e.clientId,keys:{publicJwk:t.publicJwk,privateJwk:t},authServerUrl:Tg(e),...e.appId!==void 0?{appId:e.appId}:{},...e.clientSecret!==void 0?{clientSecret:e.clientSecret}:{},...e.env!==void 0?{env:e.env}:{},...n!==void 0?{now:n}:{}})}async send(o){if(this.config.mockMode)throw new Error("Kernel.send called in mockMode \u2014 use the resource-layer mock helpers");Hg(o);let e=Gg(this.config.baseUrl??vu,o),t=o.traceparent!==void 0&&xg.test(o.traceparent)?o.traceparent:this.observer.traceparent(void 0),r=Date.now();this.observer.emit({type:"request",method:o.method,path:o.path,traceparent:t,...o.idempotencyKey!==void 0?{idempotencyKey:o.idempotencyKey}:{}});let n={...this.config.env?{[Cg]:this.config.env}:{},...o.headers??{}},p=this.config.telemetry===!1?void 0:dd({method:o.method,url:e,path:o.path,clientId:this.config.clientId,kernelVersion:dt,traceparent:t,...this.config.env!==void 0?{env:this.config.env}:{}});try{let c=await Vi({auth:this.auth,circuit:this.circuit,clockDrift:this.clockDrift,...this.clockNow!==void 0?{now:this.clockNow}:{},...this.config.httpClient!==void 0?{httpClient:this.config.httpClient}:{dispatcher:this.dispatcher},onRetry:u(I=>this.observer.emit({type:"retry",...I}),"onRetry"),onRateLimit:u(I=>{for(let B of this.rateLimitHandlers)try{B(I.remaining??0,I.resetAt??0)}catch{}},"onRateLimit")},{method:o.method,url:e,...Object.keys(n).length>0?{headers:n}:{},...o.body!==void 0?{body:Mg(o.body)}:{},...o.idempotencyKey!==void 0?{idempotencyKey:o.idempotencyKey}:{},...o.maxAttempts!==void 0?{maxAttempts:o.maxAttempts}:{},...o.restartWindowMs!==void 0?{restartWindowMs:o.restartWindowMs}:{},...o.timeoutMs!==void 0?{timeoutMs:o.timeoutMs}:{},traceparent:t,...o.tracestate!==void 0?{tracestate:o.tracestate}:{},...o.signal!==void 0?{signal:o.signal}:{},...o.scope!==void 0?{scope:o.scope}:{}}),N=c.response,E=N.status??200,S=N.headers?.get("content-length"),A=S&&Number.parseInt(S,10)||0;return this.observer.emit({type:"response",status:E,durationMs:Date.now()-r,...c.requestId!==null?{requestId:c.requestId}:{},bytes:A}),p?.end({status:E,requestId:c.requestId}),c.data}catch(c){this.observer.emit({type:"error",code:fu(c),durationMs:Date.now()-r});let N=Bg(c);throw p?.end({error:c,...N!==void 0?{status:N}:{}}),c}}newIdempotencyKey(){return qr()}rateLimitHandlers=new Set;onCircuitOpen(o){return this.circuit.onOpen(o)}onCircuitClose(o){return this.circuit.onClose(o)}onRateLimited(o){return this.rateLimitHandlers.add(o),()=>{this.rateLimitHandlers.delete(o)}}registerMethod(o){this.methods.add(o)}listMethods(){return Array.from(this.methods).sort()}async health(){if(this.config.mockMode)return{ok:!0,serverVersion:"mock",sdkVersion:dt};try{let o=await this.send({method:"GET",path:"/v1/_health"});return{ok:o.ok,serverVersion:o.version??"unknown",sdkVersion:dt}}catch(o){return{ok:!1,serverVersion:"unknown",sdkVersion:dt,error:fu(o)}}}},Ag=["apiKey","api_key","orgId","org_id","tenantId","tenant_id","ownerId","hmacSecret","hmac_secret","secret","bearer"];function Ig(i){for(let o of Ag)if(o in i)throw new Error(`KernelConfig MUST NOT include "${o}". The npayload kernel uses DPoP-bound OAuth tokens \u2014 never an API key, secret, or org id.`)}u(Ig,"rejectForbiddenFields");function Gg(i,o){let e=o.path;if(o.pathParams)for(let[r,s]of Object.entries(o.pathParams))e=e.replace(`{${r}}`,encodeURIComponent(s));let t=i.replace(/\/+$/,"")+e;if(o.query&&Object.keys(o.query).length>0){let r=new URLSearchParams;for(let[s,n]of Object.entries(o.query))r.set(s,String(n));t+=`?${r.toString()}`}return t}u(Gg,"composeUrl");function Mg(i){if(typeof i=="string")return i;try{return JSON.stringify(i)}catch(o){let e=o instanceof Error?o.message:String(o);throw new nr(`Failed to serialise request body: ${e}`,{code:"body_serialisation_failed"})}}u(Mg,"serialiseBody");function fu(i){return i&&typeof i=="object"&&"code"in i?String(i.code):"unknown"}u(fu,"getCode");var Ug=new Set(["orgid","org_id","organizationid","organization_id","tenantid","tenant_id","ownerid","owner_id","x-org-id","x-tenant-id","x-owner-id","x-organization-id"]);function Hg(i){let o=[];for(let e of[i.headers,i.query])if(e)for(let t of Object.keys(e))Ug.has(t.toLowerCase())&&o.push(t);if(o.length>0)throw new nr(`Org-shaped request fields are never sent by the kernel (the org is the credential's): ${o.join(", ")}`,{code:"org_context_forbidden"})}u(Hg,"rejectOrgShapedRequestFields");function Bg(i){let o=i?.status;return typeof o=="number"?o:void 0}u(Bg,"getStatus");var T={};M(T,{BadRequestError:()=>w,ForbiddenError:()=>m,NotFoundError:()=>y,OauthScope:()=>qg,TooManyRequestsError:()=>R,UnauthorizedError:()=>h,account:()=>cd,analytics:()=>hd,audit:()=>md,billing:()=>Rd,connect:()=>Sd,embed:()=>lp,events:()=>Gd,feed:()=>Hd,notify:()=>Fd,pipes:()=>jd,primus:()=>ip,tenants:()=>pp,webhooks:()=>up});var cd={};M(cd,{environments:()=>Nu});var Nu={};var hd={};M(hd,{ListRollupsRequestGranularity:()=>Su,PercentileSketchesRequestGranularity:()=>_u,SnapshotSummaryRequestGranularity:()=>Tu,TopKSketchesRequestGranularity:()=>ku,events:()=>Eu,rollups:()=>ud,sketches:()=>ld,summary:()=>wd});var Eu={};var ud={};M(ud,{ListRollupsRequestGranularity:()=>Su});var Su={Minute:"minute",Hour:"hour",Day:"day"};var ld={};M(ld,{PercentileSketchesRequestGranularity:()=>_u,TopKSketchesRequestGranularity:()=>ku});var _u={Minute:"minute",Hour:"hour",Day:"day"};var ku={Minute:"minute",Hour:"hour",Day:"day"};var wd={};M(wd,{SnapshotSummaryRequestGranularity:()=>Tu});var Tu={Minute:"minute",Hour:"hour",Day:"day"};var md={};M(md,{chain:()=>Cu,events:()=>xu});var Cu={};var xu={};var Rd={};M(Rd,{ListInvoicesInvoicesRequestStatus:()=>Lu,connectAccounts:()=>Gu,credits:()=>Mu,disputes:()=>Uu,dunning:()=>Hu,feedListings:()=>qu,functions:()=>Iu,invoices:()=>yd,paymentMethods:()=>Fu,payouts:()=>Bu,revenue:()=>Wu,subscriptions:()=>Au,tax:()=>zu,taxIds:()=>Du,testClocks:()=>Ou,usage:()=>ju});var Au={};var Iu={};var Gu={};var Mu={};var Uu={};var Hu={};var Bu={};var qu={};var yd={};M(yd,{ListInvoicesInvoicesRequestStatus:()=>Lu});var Lu={Paid:"paid",Open:"open",PastDue:"past_due",Uncollectible:"uncollectible",Void:"void",Draft:"draft"};var Fu={};var Du={};var zu={};var Ou={};var ju={};var Wu={};var Sd={};M(Sd,{GetEcosystemGraphConnectInsightsRequestDirection:()=>Zu,GetEcosystemGraphConnectInsightsRequestEnvKind:()=>Xu,GetEcosystemGraphConnectInsightsRequestInclude:()=>rl,GetEcosystemGraphConnectInsightsRequestStatus:()=>el,GetGrantUsageConnectAccessRequestPeriod:()=>nl,ListBridgesConnectBridgesRequestStatus:()=>$u,ListConsentsConnectTenantApprovalRequestStatus:()=>Ku,ListMyGrantsConnectAccessRequestDirection:()=>sl,ListMyGrantsConnectAccessRequestEnvKind:()=>tl,ListMyGrantsConnectAccessRequestStatus:()=>ol,ListPartnerAppTenantApprovalsConnectRequestStatus:()=>cl,ListPartnerTenantApprovalsConnectTenantApprovalRequestStatus:()=>Vu,ListPlatformConnectApprovalsConnectTenantApprovalRequestStatus:()=>Ju,ListPublishGrantsRequestDirection:()=>ll,ListReceiptsByGrantConsentReceiptsRequestStatus:()=>al,ListTenantApprovalsConnectTenantApprovalRequestStatus:()=>Qu,connect:()=>Nd,connectAccess:()=>fd,connectBridges:()=>gd,connectExplore:()=>Yu,connectInsights:()=>bd,connectPartner:()=>il,connectProfile:()=>dl,connectTenantApproval:()=>Pd,consentReceipts:()=>vd,entityNat:()=>pl,identityBridges:()=>ul,publishGrants:()=>Ed});var gd={};M(gd,{ListBridgesConnectBridgesRequestStatus:()=>$u});var $u={Pending:"pending",Active:"active",Suspended:"suspended",Archived:"archived"};var Pd={};M(Pd,{ListConsentsConnectTenantApprovalRequestStatus:()=>Ku,ListPartnerTenantApprovalsConnectTenantApprovalRequestStatus:()=>Vu,ListPlatformConnectApprovalsConnectTenantApprovalRequestStatus:()=>Ju,ListTenantApprovalsConnectTenantApprovalRequestStatus:()=>Qu});var Ku={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var Vu={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var Ju={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var Qu={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var Yu={};var bd={};M(bd,{GetEcosystemGraphConnectInsightsRequestDirection:()=>Zu,GetEcosystemGraphConnectInsightsRequestEnvKind:()=>Xu,GetEcosystemGraphConnectInsightsRequestInclude:()=>rl,GetEcosystemGraphConnectInsightsRequestStatus:()=>el});var Xu={Sandbox:"sandbox",Production:"production"};var Zu={Given:"given",Received:"received"};var el={Pending:"pending",Active:"active",Rejected:"rejected",Revoked:"revoked",Expired:"expired",Suspended:"suspended"};var rl={Feeds:"feeds"};var fd={};M(fd,{GetGrantUsageConnectAccessRequestPeriod:()=>nl,ListMyGrantsConnectAccessRequestDirection:()=>sl,ListMyGrantsConnectAccessRequestEnvKind:()=>tl,ListMyGrantsConnectAccessRequestStatus:()=>ol});var ol={Pending:"pending",Active:"active",Rejected:"rejected",Revoked:"revoked",Expired:"expired",Suspended:"suspended"};var sl={Sent:"sent",Received:"received"};var tl={Sandbox:"sandbox",Production:"production"};var nl={SevenD:"7d",ThirtyD:"30d",Custom:"custom"};var vd={};M(vd,{ListReceiptsByGrantConsentReceiptsRequestStatus:()=>al});var al={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var il={};var dl={};var pl={};var Nd={};M(Nd,{ListPartnerAppTenantApprovalsConnectRequestStatus:()=>cl});var cl={Active:"active",Revoked:"revoked",Frozen:"frozen",Delisted:"delisted",Expired:"expired"};var ul={};var Ed={};M(Ed,{ListPublishGrantsRequestDirection:()=>ll});var ll={Granted:"granted",Held:"held"};var Gd={};M(Gd,{ListByAppDeliveriesRequestStatus:()=>Rl,ListByAppDlqRequestStatus:()=>Pl,ListByAppSubscriptionsRequestStatus:()=>El,ListByChannelReceiptsRequestStatus:()=>Ml,ListBySubscriptionDeliveriesRequestStatus:()=>gl,ListBySubscriptionDlqRequestStatus:()=>bl,ListChannelsRequestStatus:()=>hl,ListKeysAppDpopKeysRequestStatus:()=>fl,ListPaginatedChannelsRequestStatus:()=>ml,ListSubscriptionsRequestStatus:()=>Sl,ListWithStatsChannelsRequestStatus:()=>yl,SearchMessagesObservabilityRequestStatus:()=>Il,adapters:()=>wl,appDpopKeys:()=>Cd,archiveReplay:()=>Al,catalogue:()=>vl,channelDetail:()=>Gl,channels:()=>_d,consume:()=>Hl,consumerGroups:()=>kl,deliveries:()=>kd,deliveryReceipts:()=>ql,dlq:()=>Td,exactlyOnce:()=>Fl,exchanges:()=>Dl,kvStore:()=>Ol,messages:()=>Nl,observability:()=>Ad,queueAdmin:()=>Vl,queueBatch:()=>$l,queueQueries:()=>Kl,queues:()=>Wl,receipts:()=>Id,scheduling:()=>Tl,security:()=>Ul,snapshots:()=>Cl,sources:()=>jl,stats:()=>Ll,streams:()=>Bl,subscriptions:()=>xd,systemEvents:()=>Jl,tieredStorage:()=>_l,timeTravel:()=>xl,transactional:()=>zl});var wl={};var _d={};M(_d,{ListChannelsRequestStatus:()=>hl,ListPaginatedChannelsRequestStatus:()=>ml,ListWithStatsChannelsRequestStatus:()=>yl});var hl={Active:"active",Paused:"paused",Archived:"archived"};var ml={Active:"active",Paused:"paused",Archived:"archived"};var yl={Active:"active",Paused:"paused",Archived:"archived"};var kd={};M(kd,{ListByAppDeliveriesRequestStatus:()=>Rl,ListBySubscriptionDeliveriesRequestStatus:()=>gl});var Rl={Pending:"pending",Inflight:"inflight",Delivered:"delivered",Retrying:"retrying",Failed:"failed",DeadLettered:"dead_lettered",Skipped:"skipped"};var gl={Pending:"pending",Inflight:"inflight",Delivered:"delivered",Retrying:"retrying",Failed:"failed",DeadLettered:"dead_lettered",Skipped:"skipped"};var Td={};M(Td,{ListByAppDlqRequestStatus:()=>Pl,ListBySubscriptionDlqRequestStatus:()=>bl});var Pl={Pending:"pending",Reprocessing:"reprocessing",Reprocessed:"reprocessed",Discarded:"discarded"};var bl={Pending:"pending",Reprocessing:"reprocessing",Reprocessed:"reprocessed",Discarded:"discarded"};var Cd={};M(Cd,{ListKeysAppDpopKeysRequestStatus:()=>fl});var fl={Active:"active",Revoked:"revoked"};var vl={};var Nl={};var xd={};M(xd,{ListByAppSubscriptionsRequestStatus:()=>El,ListSubscriptionsRequestStatus:()=>Sl});var El={Active:"active",Paused:"paused",Disabled:"disabled",Archived:"archived"};var Sl={Active:"active",Paused:"paused",Disabled:"disabled",Archived:"archived"};var _l={};var kl={};var Tl={};var Cl={};var xl={};var Al={};var Ad={};M(Ad,{SearchMessagesObservabilityRequestStatus:()=>Il});var Il={Pending:"pending",Processing:"processing",Delivered:"delivered",Failed:"failed"};var Gl={};var Id={};M(Id,{ListByChannelReceiptsRequestStatus:()=>Ml});var Ml={Delivered:"delivered",Acknowledged:"acknowledged",Processed:"processed",Rejected:"rejected",Expired:"expired"};var Ul={};var Hl={};var Bl={};var ql={};var Ll={};var Fl={};var Dl={};var zl={};var Ol={};var jl={};var Wl={};var $l={};var Kl={};var Vl={};var Jl={};var Hd={};M(Hd,{ListCustomersRequestStatus:()=>Ql,ListPublishedListingsRequestEnvironment:()=>Xl,ListPublishedListingsRequestPriceTier:()=>Yl,customers:()=>Md,feedDeliveryBindings:()=>sw,listings:()=>Ud,publisherReputation:()=>ow,publishers:()=>rw,reviews:()=>ew,subscriptions:()=>Zl});var Md={};M(Md,{ListCustomersRequestStatus:()=>Ql});var Ql={Pending:"pending",Active:"active",Paused:"paused",Cancelled:"cancelled",Expired:"expired"};var Ud={};M(Ud,{ListPublishedListingsRequestEnvironment:()=>Xl,ListPublishedListingsRequestPriceTier:()=>Yl});var Yl={Free:"free",FlatRate:"flat_rate",UsageBased:"usage_based",Tiered:"tiered"};var Xl={Sandbox:"sandbox",Production:"production"};var Zl={};var ew={};var rw={};var ow={};var sw={};var Fd={};M(Fd,{ClearPreferencesRequestChannel:()=>aw,ListDispatchesRequestStatus:()=>tw,ListInboxRequestStatus:()=>nw,dispatches:()=>Bd,inbox:()=>qd,preferences:()=>Ld,summary:()=>iw,templates:()=>dw,types:()=>pw});var Bd={};M(Bd,{ListDispatchesRequestStatus:()=>tw});var tw={Queued:"queued",Sending:"sending",Sent:"sent",Failed:"failed",Dlq:"dlq"};var qd={};M(qd,{ListInboxRequestStatus:()=>nw});var nw={Unread:"unread",Read:"read",Archived:"archived"};var Ld={};M(Ld,{ClearPreferencesRequestChannel:()=>aw});var aw={Email:"email",Sms:"sms",Push:"push",Inapp:"inapp",Slack:"slack"};var iw={};var dw={};var pw={};var jd={};M(jd,{ListApprovalRequestsGovernanceRequestStatus:()=>Rw,ListDecisionsDecisionsRequestGateState:()=>hw,ListDlqEntriesDlqRequestStatus:()=>mw,agentExecutions:()=>cw,analyses:()=>uw,connectors:()=>ww,decisions:()=>Dd,dlq:()=>zd,executions:()=>yw,governance:()=>Od,recordDlq:()=>gw,tools:()=>Pw,watermarks:()=>bw,webhooks:()=>fw,workflows:()=>lw});var cw={};var uw={};var lw={};var ww={};var Dd={};M(Dd,{ListDecisionsDecisionsRequestGateState:()=>hw});var hw={AutoApproved:"auto-approved",PendingHumanApproval:"pending-human-approval",Approved:"approved",Rejected:"rejected",Expired:"expired"};var zd={};M(zd,{ListDlqEntriesDlqRequestStatus:()=>mw});var mw={Pending:"pending",Retrying:"retrying",Resolved:"resolved",Discarded:"discarded",Exhausted:"exhausted"};var yw={};var Od={};M(Od,{ListApprovalRequestsGovernanceRequestStatus:()=>Rw});var Rw={Pending:"pending",Approved:"approved",Rejected:"rejected",Revoked:"revoked"};var gw={};var Pw={};var bw={};var fw={};var ip={};M(ip,{AggregateMetricsObservabilityRequestAggregation:()=>$w,ArchiveAgentsResponse:()=>Kd,DiscoverToolsRequestSource:()=>oh,GetErrorDistributionObservabilityRequestByField:()=>Kw,GetHistoryUsageRequestGranularity:()=>th,GetUsageDashboardBrainConfigRequestRange:()=>Sw,ListAgentGoalsRequestStatus:()=>vw,ListAgentsRequestStatus:()=>Nw,ListApprovalsRequestStatus:()=>Ew,ListByAgentMemoriesRequestType:()=>jw,ListConversationsRequestStatus:()=>Tw,ListIntegrationsRequestStatus:()=>Uw,ListMemoriesRequestType:()=>Ow,ListSelfKnowledgeRequestCategory:()=>Jw,ListToolsRequestSource:()=>rh,ListTriggersRequestType:()=>sh,ListWithStatsConversationsRequestStatus:()=>Cw,RemoveAgentsResponse:()=>$d,SearchDualAuthRagResponse:()=>ep,actions:()=>xw,agentGoals:()=>Wd,agents:()=>Vd,approvals:()=>Jd,brainConfig:()=>Qd,brainModels:()=>_w,configPromotion:()=>kw,conversations:()=>Yd,delegations:()=>Aw,entitlements:()=>Iw,execution:()=>Gw,guardrailOutcomes:()=>Mw,integrations:()=>Xd,killSwitch:()=>Hw,learning:()=>Bw,mcpConnect:()=>Lw,mcpOauth:()=>Dw,mcpServers:()=>Fw,memories:()=>Zd,memoriesEncrypted:()=>zw,memory:()=>Ww,observability:()=>op,overview:()=>Vw,rag:()=>rp,selfKnowledge:()=>sp,skillSynthesis:()=>Qw,skills:()=>Yw,spendCap:()=>Xw,stats:()=>qw,teams:()=>Zw,tenants:()=>eh,tools:()=>tp,triggers:()=>np,usage:()=>ap,webhooks:()=>nh});var Wd={};M(Wd,{ListAgentGoalsRequestStatus:()=>vw});var vw={Active:"active",Completed:"completed",Paused:"paused",Abandoned:"abandoned"};var Vd={};M(Vd,{ArchiveAgentsResponse:()=>Kd,ListAgentsRequestStatus:()=>Nw,RemoveAgentsResponse:()=>$d});var Nw={Active:"active",Paused:"paused",Archived:"archived",All:"all"};var $d;(o=>o.Brain={Archived:"archived",Absent:"absent",None:"none"})($d||={});var Kd;(o=>o.Brain={Archived:"archived",Absent:"absent",None:"none"})(Kd||={});var Jd={};M(Jd,{ListApprovalsRequestStatus:()=>Ew});var Ew={Pending:"pending",Approved:"approved",Rejected:"rejected",Expired:"expired",AutoApproved:"auto_approved"};var Qd={};M(Qd,{GetUsageDashboardBrainConfigRequestRange:()=>Sw});var Sw={SevenD:"7d",ThirtyD:"30d",NinetyD:"90d"};var _w={};var kw={};var Yd={};M(Yd,{ListConversationsRequestStatus:()=>Tw,ListWithStatsConversationsRequestStatus:()=>Cw});var Tw={Active:"active",Archived:"archived",Deleted:"deleted"};var Cw={Active:"active",Archived:"archived",Deleted:"deleted"};var xw={};var Aw={};var Iw={};var Gw={};var Mw={};var Xd={};M(Xd,{ListIntegrationsRequestStatus:()=>Uw});var Uw={Active:"active",Expired:"expired",Revoked:"revoked"};var Hw={};var Bw={};var qw={};var Lw={};var Fw={};var Dw={};var zw={};var Zd={};M(Zd,{ListByAgentMemoriesRequestType:()=>jw,ListMemoriesRequestType:()=>Ow});var Ow={Working:"working",Session:"session",LongTerm:"long_term",Shared:"shared"};var jw={Working:"working",Session:"session",LongTerm:"long_term",Shared:"shared"};var Ww={};var rp={};M(rp,{SearchDualAuthRagResponse:()=>ep});var ep;(o=>o.Rerank={Rrf:"rrf",Mmr:"mmr"})(ep||={});var op={};M(op,{AggregateMetricsObservabilityRequestAggregation:()=>$w,GetErrorDistributionObservabilityRequestByField:()=>Kw});var $w={Sum:"sum",Avg:"avg",Min:"min",Max:"max",Count:"count",P50:"p50",P95:"p95",P99:"p99"};var Kw={Type:"type",Source:"source",Fingerprint:"fingerprint",Status:"status"};var Vw={};var sp={};M(sp,{ListSelfKnowledgeRequestCategory:()=>Jw});var Jw={Strength:"strength",Weakness:"weakness",FailurePattern:"failure_pattern",Improvement:"improvement"};var Qw={};var Yw={};var Xw={};var Zw={};var eh={};var tp={};M(tp,{DiscoverToolsRequestSource:()=>oh,ListToolsRequestSource:()=>rh});var rh={Builtin:"builtin",Skill:"skill",Mcp:"mcp",Integration:"integration"};var oh={Builtin:"builtin",Skill:"skill",Mcp:"mcp",Integration:"integration"};var np={};M(np,{ListTriggersRequestType:()=>sh});var sh={Cron:"cron",Event:"event",Webhook:"webhook",Message:"message"};var ap={};M(ap,{GetHistoryUsageRequestGranularity:()=>th});var th={Hour:"hour",Day:"day",Week:"week"};var nh={};var pp={};M(pp,{ListTenantsRequestStatus:()=>ah,actAs:()=>ih,tenants:()=>dp});var dp={};M(dp,{ListTenantsRequestStatus:()=>ah});var ah={Pending:"pending",Active:"active",Suspended:"suspended",Closed:"closed",Inactive:"inactive"};var ih={};var up={};M(up,{ListWebhooksRequestStatus:()=>dh,webhooks:()=>cp});var cp={};M(cp,{ListWebhooksRequestStatus:()=>dh});var dh={Active:"active",Paused:"paused",Revoked:"revoked"};var lp={};M(lp,{origins:()=>ph,sessions:()=>ch});var ph={};var ch={};var qg={AgentWebhooksRead:"agent_webhooks:read",AgentWebhooksWrite:"agent_webhooks:write",AgentsAdmin:"agents:admin",AgentsExecute:"agents:execute",AgentsRead:"agents:read",AgentsWrite:"agents:write",ApprovalsRead:"approvals:read",ApprovalsWrite:"approvals:write",BillingRead:"billing:read",BrainAdmin:"brain:admin",BrainRead:"brain:read",BrainWrite:"brain:write",ConnectionsRead:"connections:read",ConnectionsWrite:"connections:write",ConversationsAdmin:"conversations:admin",ConversationsRead:"conversations:read",ConversationsWrite:"conversations:write",ExecutionsAdmin:"executions:admin",ExecutionsExecute:"executions:execute",ExecutionsRead:"executions:read",GuardrailsAdmin:"guardrails:admin",GuardrailsRead:"guardrails:read",MemoryAdmin:"memory:admin",MemoryRead:"memory:read",MemoryWrite:"memory:write",SkillsAdmin:"skills:admin",SkillsRead:"skills:read",SkillsWrite:"skills:write",TeamsAdmin:"teams:admin",TeamsRead:"teams:read",TeamsWrite:"teams:write",TenantsAdmin:"tenants:admin",TenantsRead:"tenants:read",TenantsWrite:"tenants:write",ToolsAdmin:"tools:admin",ToolsRead:"tools:read",ToolsWrite:"tools:write",TriggersAdmin:"triggers:admin",TriggersRead:"triggers:read",TriggersWrite:"triggers:write"};var ur=u((i,o,e)=>JSON.stringify(i,o,e),"toJson");var a=class i extends Error{static{u(this,"NPayloadError")}statusCode;body;rawResponse;constructor({message:o,statusCode:e,body:t,rawResponse:r}){super(Lg({message:o,statusCode:e,body:t})),Object.setPrototypeOf(this,i.prototype),this.statusCode=e,this.body=t,this.rawResponse=r}};function Lg({message:i,statusCode:o,body:e}){let t=[];return i!=null&&t.push(i),o!=null&&t.push(`Status code: ${o.toString()}`),e!=null&&t.push(`Body: ${ur(e,void 0,2)}`),t.join(`
2
+ `)}u(Lg,"buildMessage");var l=class i extends Error{static{u(this,"NPayloadTimeoutError")}constructor(o){super(o),Object.setPrototypeOf(this,i.prototype)}};var w=class i extends a{static{u(this,"BadRequestError")}constructor(o,e){super({message:"BadRequestError",statusCode:400,body:o,rawResponse:e}),Object.setPrototypeOf(this,i.prototype)}};var h=class i extends a{static{u(this,"UnauthorizedError")}constructor(o,e){super({message:"UnauthorizedError",statusCode:401,body:o,rawResponse:e}),Object.setPrototypeOf(this,i.prototype)}};var m=class i extends a{static{u(this,"ForbiddenError")}constructor(o,e){super({message:"ForbiddenError",statusCode:403,body:o,rawResponse:e}),Object.setPrototypeOf(this,i.prototype)}};var y=class i extends a{static{u(this,"NotFoundError")}constructor(o,e){super({message:"NotFoundError",statusCode:404,body:o,rawResponse:e}),Object.setPrototypeOf(this,i.prototype)}};var R=class i extends a{static{u(this,"TooManyRequestsError")}constructor(o,e){super({message:"TooManyRequestsError",statusCode:429,body:o,rawResponse:e}),Object.setPrototypeOf(this,i.prototype)}};var f={Production:"https://api.npayload.com",Sandbox:"https://api.sandbox.npayload.com"};var Jo;typeof globalThis.Headers<"u"?Jo=globalThis.Headers:Jo=class uh{static{u(this,"Headers")}headers;constructor(o){if(this.headers=new Map,o)if(o instanceof uh)o.forEach((e,t)=>this.append(t,e));else if(Array.isArray(o))for(let[e,t]of o)if(typeof e=="string"&&typeof t=="string")this.append(e,t);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[e,t]of Object.entries(o))if(typeof t=="string")this.append(e,t);else throw new TypeError("Header values must be strings")}append(o,e){let t=o.toLowerCase(),r=this.headers.get(t)||[];this.headers.set(t,[...r,e])}delete(o){let e=o.toLowerCase();this.headers.delete(e)}get(o){let e=o.toLowerCase(),t=this.headers.get(e);return t?t.join(", "):null}has(o){let e=o.toLowerCase();return this.headers.has(e)}set(o,e){let t=o.toLowerCase();this.headers.set(t,[e])}forEach(o,e){let t=e?o.bind(e):o;this.headers.forEach((r,s)=>t(r.join(", "),s,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[o,e]of this.headers.entries())yield[o,e.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let o of this.headers.values())yield o.join(", ")}[Symbol.iterator](){return this.entries()}};var wp={headers:new Jo,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},hp={headers:new Jo,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function mp(i){return{headers:i.headers,redirected:i.redirected,status:i.status,statusText:i.statusText,type:i.type,url:i.url}}u(mp,"toRawResponse");var d={get:u(async i=>typeof i=="function"?i():i,"get")};var lh=k(require("qs"));function wh(i,o){return Object.keys(o??{}).length>0?`${i}?${lh.default.stringify(o,{arrayFormat:"repeat"})}`:i}u(wh,"createRequestUrl");var de=Fg();function Fg(){return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.name==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!process.versions?.node?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:{type:"unknown"}}u(Fg,"evaluateRuntime");async function hh(){return de.type==="node"&&de.parsedVersion!=null&&de.parsedVersion>=18?fetch:de.type==="node"?(await import("node-fetch")).default:typeof fetch=="function"?fetch:(await import("node-fetch")).default}u(hh,"getFetchFn");async function mh({body:i,type:o}){return o.includes("json")?ur(i):i}u(mh,"getRequestBody");async function vh(i){return de.type==="node"&&de.parsedVersion!=null&&de.parsedVersion>=18?new(await Promise.resolve().then(()=>(Rh(),yh))).Node18UniversalStreamWrapper(i):de.type!=="node"&&typeof fetch=="function"?new(await Promise.resolve().then(()=>(Ph(),gh))).UndiciStreamWrapper(i):new(await Promise.resolve().then(()=>(fh(),bh))).NodePre18StreamWrapper(i)}u(vh,"chooseStreamWrapper");async function Nh(i,o){if(i.body!=null&&o==="blob")return await i.blob();if(i.body!=null&&o==="arrayBuffer")return await i.arrayBuffer();if(i.body!=null&&o==="sse")return i.body;if(i.body!=null&&o==="streaming")return vh(i.body);if(i.body!=null&&o==="text")return await i.text();{let e=await i.text();if(e.length>0)try{return JSON.parse(e)}catch{return{ok:!1,error:{reason:"non-json",statusCode:i.status,rawBody:e}}}else return}}u(Nh,"getResponseBody");var Dg="timeout";function Eh(i){let o=new AbortController,e=setTimeout(()=>o.abort(Dg),i);return{signal:o.signal,abortId:e}}u(Eh,"getTimeoutSignal");function Sh(...i){let o=i.length===1&&Array.isArray(i[0])?i[0]:i,e=new AbortController;for(let t of o){if(t.aborted){e.abort(t?.reason);break}t.addEventListener("abort",()=>e.abort(t?.reason),{signal:e.signal})}return e.signal}u(Sh,"anySignal");var _h=u(async(i,o,e,t,r,s,n,p,c)=>{let N=[],E;if(s!=null){let{signal:I,abortId:B}=Eh(s);E=B,N.push(I)}n!=null&&N.push(n);let S=Sh(N),A=await i(o,{method:e,headers:t,body:r,signal:S,credentials:p?"include":void 0,duplex:c});return E!=null&&clearTimeout(E),A},"makeRequest");function zg(i){let o=1+(Math.random()*2-1)*.2;return i*o}u(zg,"addJitter");async function kh(i,o=2){let e=await i();for(let t=0;t<o&&([408,429].includes(e.status)||e.status>=500);++t){let r=Math.min(1e3*Math.pow(2,t),6e4),s=zg(r);await new Promise(n=>setTimeout(n,s)),e=await i()}return e}u(kh,"requestWithRetries");async function Og(i){let o={};if(i.body!==void 0&&i.contentType!=null&&(o["Content-Type"]=i.contentType),i.headers==null)return o;for(let[e,t]of Object.entries(i.headers)){let r=await d.get(t);if(typeof r=="string"){o[e]=r;continue}r!=null&&(o[e]=`${r}`)}return o}u(Og,"getHeaders");async function jg(i){let o=wh(i.url,i.queryParameters),e=await mh({body:i.body,type:i.requestType==="json"?"json":"other"}),t=await hh();try{let r=await kh(async()=>_h(t,o,i.method,await Og(i),e,i.timeoutMs,i.abortSignal,i.withCredentials,i.duplex),i.maxRetries),s=await Nh(r,i.responseType);return r.status>=200&&r.status<400?{ok:!0,body:s,headers:r.headers,rawResponse:mp(r)}:{ok:!1,error:{reason:"status-code",statusCode:r.status,body:s},rawResponse:mp(r)}}catch(r){return i.abortSignal!=null&&i.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:wp}:r instanceof Error&&r.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:wp}:r instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:r.message},rawResponse:hp}:{ok:!1,error:{reason:"unknown",errorMessage:ur(r)},rawResponse:hp}}}u(jg,"fetcherImpl");var P=jg;var g=class i extends Promise{static{u(this,"HttpResponsePromise")}innerPromise;unwrappedPromise;constructor(o){super(e=>{e(void 0)}),this.innerPromise=o}static fromFunction(o,...e){return new i(o(...e))}static interceptFunction(o){return(...e)=>i.fromPromise(o(...e))}static fromPromise(o){return new i(o)}static fromExecutor(o){let e=new Promise(o);return new i(e)}static fromResult(o){let e=Promise.resolve(o);return new i(e)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:o})=>o)),this.unwrappedPromise}then(o,e){return this.unwrap().then(o,e)}catch(o){return this.unwrap().catch(o)}finally(o){return this.unwrap().finally(o)}async withRawResponse(){return await this.innerPromise}};function b(...i){let o={};for(let[e,t]of i.filter(r=>r!=null).flatMap(r=>Object.entries(r)))t!=null?o[e]=t:e in o&&delete o[e];return o}u(b,"mergeHeaders");function v(...i){let o={};for(let[e,t]of i.filter(r=>r!=null).flatMap(r=>Object.entries(r)))t!=null&&(o[e]=t);return o}u(v,"mergeOnlyDefinedHeaders");var Jh=k(require("url-join"));var Qo=k(require("url-join"));var ct=class{static{u(this,"Environments")}_options;constructor(o){this._options=o}list(o){return g.fromPromise(this.__list(o))}async __list(o){let e=await(this._options.fetcher??P)({url:(0,Qo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/account/environments"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/account/environments.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,Qo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/account/environments"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/account/environments.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}show(o,e){return g.fromPromise(this.__show(o,e))}async __show(o,e){let{slug:t}=o,r=await(this._options.fetcher??P)({url:(0,Qo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/account/environments/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/account/environments/{slug}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}clone(o,e){return g.fromPromise(this.__clone(o,e))}async __clone(o,e){let{slug:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Qo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/account/environments/${encodeURIComponent(t)}/clone`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/account/environments/{slug}/clone.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ut=class{static{u(this,"Account")}_options;_environments;constructor(o){this._options=o}get environments(){return this._environments??=new ct(this._options)}};var Th=k(require("url-join"));var lt=class{static{u(this,"Events")}_options;constructor(o){this._options=o}tail(o,e){return g.fromPromise(this.__tail(o,e))}async __tail(o,e){let{appId:t,eventName:r,fromTs:s,toTs:n,limit:p}=o,c={};c.appId=t,c.eventName=r,s!=null&&(c.fromTs=s.toString()),n!=null&&(c.toTs=n.toString()),p!=null&&(c.limit=p.toString());let N=await(this._options.fetcher??P)({url:(0,Th.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/analytics/events/tail"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/analytics/events/tail.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ch=k(require("url-join"));var wt=class{static{u(this,"Rollups")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{appId:t,eventName:r,envId:s,granularity:n,start:p,end:c,pageSize:N,cursor:E}=o,S={};S.appId=t,r!=null&&(S.eventName=r),s!=null&&(S.envId=s),n!=null&&(S.granularity=n),S.start=p.toString(),S.end=c.toString(),N!=null&&(S.pageSize=N.toString()),E!==void 0&&(S.cursor=E);let A=await(this._options.fetcher??P)({url:(0,Ch.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/analytics/rollups"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:S,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(A.ok)return{data:A.body,rawResponse:A.rawResponse};if(A.error.reason==="status-code")switch(A.error.statusCode){case 400:throw new w(A.error.body,A.rawResponse);case 401:throw new h(A.error.body,A.rawResponse);case 403:throw new m(A.error.body,A.rawResponse);case 404:throw new y(A.error.body,A.rawResponse);case 429:throw new R(A.error.body,A.rawResponse);default:throw new a({statusCode:A.error.statusCode,body:A.error.body,rawResponse:A.rawResponse})}switch(A.error.reason){case"non-json":throw new a({statusCode:A.error.statusCode,body:A.error.rawBody,rawResponse:A.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/analytics/rollups.");case"unknown":throw new a({message:A.error.errorMessage,rawResponse:A.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Pp=k(require("url-join"));var ht=class{static{u(this,"Sketches")}_options;constructor(o){this._options=o}percentile(o,e){return g.fromPromise(this.__percentile(o,e))}async __percentile(o,e){let{appId:t,envId:r,eventName:s,granularity:n,bucketStart:p,dimensionName:c,quantile:N}=o,E={};E.appId=t,E.envId=r,E.eventName=s,E.granularity=n,E.bucketStart=p.toString(),E.dimensionName=c,E.quantile=N.toString();let S=await(this._options.fetcher??P)({url:(0,Pp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/analytics/sketches/percentile"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:E,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(S.ok)return{data:S.body,rawResponse:S.rawResponse};if(S.error.reason==="status-code")switch(S.error.statusCode){case 400:throw new w(S.error.body,S.rawResponse);case 401:throw new h(S.error.body,S.rawResponse);case 403:throw new m(S.error.body,S.rawResponse);case 404:throw new y(S.error.body,S.rawResponse);case 429:throw new R(S.error.body,S.rawResponse);default:throw new a({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse})}switch(S.error.reason){case"non-json":throw new a({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/analytics/sketches/percentile.");case"unknown":throw new a({message:S.error.errorMessage,rawResponse:S.rawResponse})}}topK(o,e){return g.fromPromise(this.__topK(o,e))}async __topK(o,e){let{appId:t,envId:r,eventName:s,granularity:n,bucketStart:p,dimensionName:c,n:N}=o,E={};E.appId=t,E.envId=r,E.eventName=s,E.granularity=n,E.bucketStart=p.toString(),E.dimensionName=c,E.n=N.toString();let S=await(this._options.fetcher??P)({url:(0,Pp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/analytics/sketches/topk"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:E,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(S.ok)return{data:S.body,rawResponse:S.rawResponse};if(S.error.reason==="status-code")switch(S.error.statusCode){case 400:throw new w(S.error.body,S.rawResponse);case 401:throw new h(S.error.body,S.rawResponse);case 403:throw new m(S.error.body,S.rawResponse);case 404:throw new y(S.error.body,S.rawResponse);case 429:throw new R(S.error.body,S.rawResponse);default:throw new a({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse})}switch(S.error.reason){case"non-json":throw new a({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/analytics/sketches/topk.");case"unknown":throw new a({message:S.error.errorMessage,rawResponse:S.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var xh=k(require("url-join"));var mt=class{static{u(this,"Summary")}_options;constructor(o){this._options=o}snapshot(o,e){return g.fromPromise(this.__snapshot(o,e))}async __snapshot(o,e){let{appId:t,eventName:r,envId:s,start:n,end:p,granularity:c}=o,N={};N.appId=t,r!=null&&(N.eventName=r),s!=null&&(N.envId=s),N.start=n.toString(),N.end=p.toString(),c!=null&&(N.granularity=c);let E=await(this._options.fetcher??P)({url:(0,xh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/analytics/summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:N,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(E.ok)return{data:E.body,rawResponse:E.rawResponse};if(E.error.reason==="status-code")switch(E.error.statusCode){case 400:throw new w(E.error.body,E.rawResponse);case 401:throw new h(E.error.body,E.rawResponse);case 403:throw new m(E.error.body,E.rawResponse);case 404:throw new y(E.error.body,E.rawResponse);case 429:throw new R(E.error.body,E.rawResponse);default:throw new a({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse})}switch(E.error.reason){case"non-json":throw new a({statusCode:E.error.statusCode,body:E.error.rawBody,rawResponse:E.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/analytics/summary.");case"unknown":throw new a({message:E.error.errorMessage,rawResponse:E.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var yt=class{static{u(this,"Analytics")}_options;_events;_rollups;_sketches;_summary;constructor(o){this._options=o}get events(){return this._events??=new lt(this._options)}get rollups(){return this._rollups??=new wt(this._options)}get sketches(){return this._sketches??=new ht(this._options)}get summary(){return this._summary??=new mt(this._options)}};var Ah=k(require("url-join"));var Rt=class{static{u(this,"Chain")}_options;constructor(o){this._options=o}verifyStatus(o){return g.fromPromise(this.__verifyStatus(o))}async __verifyStatus(o){let e=await(this._options.fetcher??P)({url:(0,Ah.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/audit/chain/status"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/audit/chain/status.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var gt=k(require("url-join"));var Pt=class{static{u(this,"Events")}_options;constructor(o){this._options=o}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{gid:t}=o,r={};r.gid=t;let s=await(this._options.fetcher??P)({url:(0,gt.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/audit/events/get"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/audit/events/get.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{appId:t,envId:r,action:s,rowActor:n,tenantId:p,cursor:c,limit:N,start:E,end:S}=o,A={};t!=null&&(A.appId=t),r!=null&&(A.envId=r),s!=null&&(A.action=s),n!=null&&(A.rowActor=n),p!=null&&(A.tenantId=p),c!=null&&(A.cursor=c),N!=null&&(A.limit=N.toString()),E!=null&&(A.start=E.toString()),S!=null&&(A.end=S.toString());let I=await(this._options.fetcher??P)({url:(0,gt.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/audit/events/list"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:A,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(I.ok)return{data:I.body,rawResponse:I.rawResponse};if(I.error.reason==="status-code")switch(I.error.statusCode){case 400:throw new w(I.error.body,I.rawResponse);case 401:throw new h(I.error.body,I.rawResponse);case 403:throw new m(I.error.body,I.rawResponse);case 404:throw new y(I.error.body,I.rawResponse);case 429:throw new R(I.error.body,I.rawResponse);default:throw new a({statusCode:I.error.statusCode,body:I.error.body,rawResponse:I.rawResponse})}switch(I.error.reason){case"non-json":throw new a({statusCode:I.error.statusCode,body:I.error.rawBody,rawResponse:I.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/audit/events/list.");case"unknown":throw new a({message:I.error.errorMessage,rawResponse:I.rawResponse})}}stats(o={},e){return g.fromPromise(this.__stats(o,e))}async __stats(o={},e){let{appId:t,envId:r,start:s,end:n}=o,p={};t!=null&&(p.appId=t),r!=null&&(p.envId=r),s!=null&&(p.start=s.toString()),n!=null&&(p.end=n.toString());let c=await(this._options.fetcher??P)({url:(0,gt.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/audit/events/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/audit/events/stats.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var bt=class{static{u(this,"Audit")}_options;_chain;_events;constructor(o){this._options=o}get chain(){return this._chain??=new Rt(this._options)}get events(){return this._events??=new Pt(this._options)}};var Me=k(require("url-join"));var ft=class{static{u(this,"Subscriptions")}_options;constructor(o){this._options=o}accountStatus(o){return g.fromPromise(this.__accountStatus(o))}async __accountStatus(o){let e=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/account-status"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/account-status.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}createSetupIntent(o){return g.fromPromise(this.__createSetupIntent(o))}async __createSetupIntent(o){let e=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/payment-methods/setup-intent"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/payment-methods/setup-intent.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listSubscriptions(o={},e){return g.fromPromise(this.__listSubscriptions(o,e))}async __listSubscriptions(o={},e){let{limit:t,cursor:r,status:s}=o,n={};t!=null&&(n.limit=t.toString()),r!=null&&(n.cursor=r),s!=null&&(n.status=s);let p=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/subscriptions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/subscriptions.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}createSubscription(o,e){return g.fromPromise(this.__createSubscription(o,e))}async __createSubscription(o,e){let t=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/subscriptions"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/subscriptions.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieveSubscription(o,e){return g.fromPromise(this.__retrieveSubscription(o,e))}async __retrieveSubscription(o,e){let{subscriptionId:t}=o,r=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/billing/subscriptions/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/subscriptions/{subscriptionId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancelSubscription(o={},e){return g.fromPromise(this.__cancelSubscription(o,e))}async __cancelSubscription(o={},e){let t=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/subscriptions/cancel"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/subscriptions/cancel.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}confirmSubscriptionPayment(o,e){return g.fromPromise(this.__confirmSubscriptionPayment(o,e))}async __confirmSubscriptionPayment(o,e){let t=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/subscriptions/confirm-payment"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/subscriptions/confirm-payment.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}previewTierChange(o,e){return g.fromPromise(this.__previewTierChange(o,e))}async __previewTierChange(o,e){let t=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/subscriptions/preview"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/subscriptions/preview.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}reactivateSubscription(o){return g.fromPromise(this.__reactivateSubscription(o))}async __reactivateSubscription(o){let e=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/subscriptions/reactivate"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/subscriptions/reactivate.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}applyTierChange(o,e){return g.fromPromise(this.__applyTierChange(o,e))}async __applyTierChange(o,e){let t=await(this._options.fetcher??P)({url:(0,Me.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/subscriptions/tier-change"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/subscriptions/tier-change.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Yo=k(require("url-join"));var vt=class{static{u(this,"Functions")}_options;constructor(o){this._options=o}setBillingAddress(o,e){return g.fromPromise(this.__setBillingAddress(o,e))}async __setBillingAddress(o,e){let t=await(this._options.fetcher??P)({url:(0,Yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/account/address"),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/billing/account/address.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}updateBillingEmail(o,e){return g.fromPromise(this.__updateBillingEmail(o,e))}async __updateBillingEmail(o,e){let t=await(this._options.fetcher??P)({url:(0,Yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/account/email"),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/billing/account/email.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listPlanCatalogue(o){return g.fromPromise(this.__listPlanCatalogue(o))}async __listPlanCatalogue(o){let e=await(this._options.fetcher??P)({url:(0,Yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/plans/catalogue"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/plans/catalogue.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listTierChangesForOrg(o={},e){return g.fromPromise(this.__listTierChangesForOrg(o,e))}async __listTierChangesForOrg(o={},e){let{limit:t}=o,r={};t!=null&&(r.limit=t.toString());let s=await(this._options.fetcher??P)({url:(0,Yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/plans/tier-changes"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/plans/tier-changes.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var bp=k(require("url-join"));var Nt=class{static{u(this,"ConnectAccounts")}_options;constructor(o){this._options=o}ensureConnectAccount(o={},e){return g.fromPromise(this.__ensureConnectAccount(o,e))}async __ensureConnectAccount(o={},e){let t=await(this._options.fetcher??P)({url:(0,bp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/connect-accounts/ensure"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/connect-accounts/ensure.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}createAccountSession(o,e){return g.fromPromise(this.__createAccountSession(o,e))}async __createAccountSession(o,e){let t=await(this._options.fetcher??P)({url:(0,bp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/connect-accounts/session"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/connect-accounts/session.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ih=k(require("url-join"));var Et=class{static{u(this,"Credits")}_options;constructor(o){this._options=o}listCredits(o={},e){return g.fromPromise(this.__listCredits(o,e))}async __listCredits(o={},e){let{sinceMs:t,limit:r}=o,s={};t!=null&&(s.sinceMs=t.toString()),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Ih.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/credits"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/credits.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var fp=k(require("url-join"));var St=class{static{u(this,"Disputes")}_options;constructor(o){this._options=o}listDisputes(o={},e){return g.fromPromise(this.__listDisputes(o,e))}async __listDisputes(o={},e){let{limit:t,cursor:r,status:s}=o,n={};t!=null&&(n.limit=t.toString()),r!=null&&(n.cursor=r),s!=null&&(n.status=s);let p=await(this._options.fetcher??P)({url:(0,fp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/disputes"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/disputes.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}retrieveDispute(o,e){return g.fromPromise(this.__retrieveDispute(o,e))}async __retrieveDispute(o,e){let{disputeId:t}=o,r=await(this._options.fetcher??P)({url:(0,fp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/billing/disputes/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/disputes/{disputeId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var vp=k(require("url-join"));var _t=class{static{u(this,"Dunning")}_options;constructor(o){this._options=o}listDelinquencies(o={},e){return g.fromPromise(this.__listDelinquencies(o,e))}async __listDelinquencies(o={},e){let{limit:t,cursor:r,state:s}=o,n={};t!=null&&(n.limit=t.toString()),r!=null&&(n.cursor=r),s!=null&&(n.state=s);let p=await(this._options.fetcher??P)({url:(0,vp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/dunning"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/dunning.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getRecoveryStatus(o){return g.fromPromise(this.__getRecoveryStatus(o))}async __getRecoveryStatus(o){let e=await(this._options.fetcher??P)({url:(0,vp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/dunning/recovery-status"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/dunning/recovery-status.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Xo=k(require("url-join"));var kt=class{static{u(this,"Payouts")}_options;constructor(o){this._options=o}getEarningsSummary(o={},e){return g.fromPromise(this.__getEarningsSummary(o,e))}async __getEarningsSummary(o={},e){let{sinceMs:t}=o,r={};t!=null&&(r.sinceMs=t.toString());let s=await(this._options.fetcher??P)({url:(0,Xo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/earnings/summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/earnings/summary.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPayouts(o={},e){return g.fromPromise(this.__listPayouts(o,e))}async __listPayouts(o={},e){let{sinceMs:t,limit:r}=o,s={};t!=null&&(s.sinceMs=t.toString()),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Xo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/payouts"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/payouts.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getRevenueSummary(o={},e){return g.fromPromise(this.__getRevenueSummary(o,e))}async __getRevenueSummary(o={},e){let{sinceMs:t}=o,r={};t!=null&&(r.sinceMs=t.toString());let s=await(this._options.fetcher??P)({url:(0,Xo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/revenue/summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/revenue/summary.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{cursor:t,limit:r}=o,s={};t!=null&&(s.cursor=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Xo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/payouts"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/payouts.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Zo=k(require("url-join"));var Tt=class{static{u(this,"FeedListings")}_options;constructor(o){this._options=o}canSubscribeToListing(o={},e){return g.fromPromise(this.__canSubscribeToListing(o,e))}async __canSubscribeToListing(o={},e){let{listingGid:t}=o,r={};t!=null&&(r.listingGid=t);let s=await(this._options.fetcher??P)({url:(0,Zo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/feed-listings/can-subscribe"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/feed-listings/can-subscribe.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getDefaultPaymentMethodPreview(o){return g.fromPromise(this.__getDefaultPaymentMethodPreview(o))}async __getDefaultPaymentMethodPreview(o){let e=await(this._options.fetcher??P)({url:(0,Zo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/feed-listings/default-payment-method-preview"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/feed-listings/default-payment-method-preview.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}subscribeToListing(o,e){return g.fromPromise(this.__subscribeToListing(o,e))}async __subscribeToListing(o,e){let t=await(this._options.fetcher??P)({url:(0,Zo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/feed-listings/subscribe"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/feed-listings/subscribe.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}subscribeToListingWithSavedCard(o,e){return g.fromPromise(this.__subscribeToListingWithSavedCard(o,e))}async __subscribeToListingWithSavedCard(o,e){let t=await(this._options.fetcher??P)({url:(0,Zo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/feed-listings/subscribe-with-saved-card"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/feed-listings/subscribe-with-saved-card.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ct=k(require("url-join"));var xt=class{static{u(this,"Invoices")}_options;constructor(o){this._options=o}listInvoices(o={},e){return g.fromPromise(this.__listInvoices(o,e))}async __listInvoices(o={},e){let{limit:t,startingAfter:r,createdAfter:s,createdBefore:n,status:p}=o,c={};t!=null&&(c.limit=t.toString()),r!=null&&(c.startingAfter=r),s!=null&&(c.createdAfter=s.toString()),n!=null&&(c.createdBefore=n.toString()),p!=null&&(c.status=p);let N=await(this._options.fetcher??P)({url:(0,Ct.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/invoices"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/invoices.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}retrieveInvoice(o,e){return g.fromPromise(this.__retrieveInvoice(o,e))}async __retrieveInvoice(o,e){let{invoiceId:t}=o,r=await(this._options.fetcher??P)({url:(0,Ct.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/billing/invoices/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/invoices/{invoiceId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getInvoicePdfUrl(o,e){return g.fromPromise(this.__getInvoicePdfUrl(o,e))}async __getInvoicePdfUrl(o,e){let{invoiceId:t}=o,r=await(this._options.fetcher??P)({url:(0,Ct.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/billing/invoices/${encodeURIComponent(t)}/pdf`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/invoices/{invoiceId}/pdf.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var es=k(require("url-join"));var At=class{static{u(this,"PaymentMethods")}_options;constructor(o){this._options=o}listPaymentMethods(o){return g.fromPromise(this.__listPaymentMethods(o))}async __listPaymentMethods(o){let e=await(this._options.fetcher??P)({url:(0,es.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/payment-methods"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/payment-methods.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}attachPaymentMethod(o,e){return g.fromPromise(this.__attachPaymentMethod(o,e))}async __attachPaymentMethod(o,e){let t=await(this._options.fetcher??P)({url:(0,es.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/payment-methods/attach"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/payment-methods/attach.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}detachPaymentMethod(o,e){return g.fromPromise(this.__detachPaymentMethod(o,e))}async __detachPaymentMethod(o,e){let t=await(this._options.fetcher??P)({url:(0,es.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/payment-methods/detach"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/payment-methods/detach.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}setDefaultPaymentMethod(o,e){return g.fromPromise(this.__setDefaultPaymentMethod(o,e))}async __setDefaultPaymentMethod(o,e){let t=await(this._options.fetcher??P)({url:(0,es.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/payment-methods/set-default"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/payment-methods/set-default.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var It=k(require("url-join"));var Gt=class{static{u(this,"TaxIds")}_options;constructor(o){this._options=o}listTaxIds(o){return g.fromPromise(this.__listTaxIds(o))}async __listTaxIds(o){let e=await(this._options.fetcher??P)({url:(0,It.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/tax-ids"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/tax-ids.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}addTaxId(o,e){return g.fromPromise(this.__addTaxId(o,e))}async __addTaxId(o,e){let t=await(this._options.fetcher??P)({url:(0,It.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/tax-ids"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/tax-ids.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}removeTaxId(o,e){return g.fromPromise(this.__removeTaxId(o,e))}async __removeTaxId(o,e){let{taxIdId:t}=o,r=await(this._options.fetcher??P)({url:(0,It.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/billing/tax-ids/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/billing/tax-ids/{taxIdId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Gh=k(require("url-join"));var Mt=class{static{u(this,"Tax")}_options;constructor(o){this._options=o}previewTax(o,e){return g.fromPromise(this.__previewTax(o,e))}async __previewTax(o,e){let t=await(this._options.fetcher??P)({url:(0,Gh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/tax/preview"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/tax/preview.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Mh=k(require("url-join"));var Ut=class{static{u(this,"TestClocks")}_options;constructor(o){this._options=o}advanceTestClock(o,e){return g.fromPromise(this.__advanceTestClock(o,e))}async __advanceTestClock(o,e){let t=await(this._options.fetcher??P)({url:(0,Mh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/test-clock/advance"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/billing/test-clock/advance.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Np=k(require("url-join"));var Ht=class{static{u(this,"Usage")}_options;constructor(o){this._options=o}getQuotas(o){return g.fromPromise(this.__getQuotas(o))}async __getQuotas(o){let e=await(this._options.fetcher??P)({url:(0,Np.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/usage/quotas"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/usage/quotas.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getUsageSummary(o={},e){return g.fromPromise(this.__getUsageSummary(o,e))}async __getUsageSummary(o={},e){let{periodStart:t,periodEnd:r}=o,s={};t!=null&&(s.periodStart=t.toString()),r!=null&&(s.periodEnd=r.toString());let n=await(this._options.fetcher??P)({url:(0,Np.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/billing/usage/summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/billing/usage/summary.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ep=k(require("url-join"));var Bt=class{static{u(this,"Revenue")}_options;constructor(o){this._options=o}customer(o,e){return g.fromPromise(this.__customer(o,e))}async __customer(o,e){let{subscriptionGid:t,sinceMs:r}=o,s={};r!=null&&(s.sinceMs=r.toString());let n=await(this._options.fetcher??P)({url:(0,Ep.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/revenue/customers/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/revenue/customers/{subscriptionGid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listings(o={},e){return g.fromPromise(this.__listings(o,e))}async __listings(o={},e){let{sinceMs:t}=o,r={};t!=null&&(r.sinceMs=t.toString());let s=await(this._options.fetcher??P)({url:(0,Ep.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/revenue/listings"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/revenue/listings.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var qt=class{static{u(this,"Billing")}_options;_subscriptions;_functions;_connectAccounts;_credits;_disputes;_dunning;_payouts;_feedListings;_invoices;_paymentMethods;_taxIds;_tax;_testClocks;_usage;_revenue;constructor(o){this._options=o}get subscriptions(){return this._subscriptions??=new ft(this._options)}get functions(){return this._functions??=new vt(this._options)}get connectAccounts(){return this._connectAccounts??=new Nt(this._options)}get credits(){return this._credits??=new Et(this._options)}get disputes(){return this._disputes??=new St(this._options)}get dunning(){return this._dunning??=new _t(this._options)}get payouts(){return this._payouts??=new kt(this._options)}get feedListings(){return this._feedListings??=new Tt(this._options)}get invoices(){return this._invoices??=new xt(this._options)}get paymentMethods(){return this._paymentMethods??=new At(this._options)}get taxIds(){return this._taxIds??=new Gt(this._options)}get tax(){return this._tax??=new Mt(this._options)}get testClocks(){return this._testClocks??=new Ut(this._options)}get usage(){return this._usage??=new Ht(this._options)}get revenue(){return this._revenue??=new Bt(this._options)}};var Sp=k(require("url-join"));var Lt=class{static{u(this,"ConnectBridges")}_options;constructor(o){this._options=o}listBridges(o={},e){return g.fromPromise(this.__listBridges(o,e))}async __listBridges(o={},e){let{status:t,sourceOrgId:r,targetOrgId:s,cursor:n,limit:p}=o,c={};t!=null&&(c.status=t),r!=null&&(c.sourceOrgId=r),s!=null&&(c.targetOrgId=s),n!=null&&(c.cursor=n),p!=null&&(c.limit=p.toString());let N=await(this._options.fetcher??P)({url:(0,Sp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/bridges"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/bridges.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}retrieveBridge(o,e){return g.fromPromise(this.__retrieveBridge(o,e))}async __retrieveBridge(o,e){let{bridgeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Sp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/bridges/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/bridges/{bridgeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var io=k(require("url-join"));var Ft=class{static{u(this,"ConnectTenantApproval")}_options;constructor(o){this._options=o}listConsents(o={},e){return g.fromPromise(this.__listConsents(o,e))}async __listConsents(o={},e){let{grantGid:t,status:r,app:s,cursor:n,limit:p}=o,c={};t!=null&&(c.grantGid=t),r!=null&&(c.status=r),s!=null&&(c.app=s),n!=null&&(c.cursor=n),p!=null&&(c.limit=p.toString());let N=await(this._options.fetcher??P)({url:(0,io.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/consents"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/consents.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}listPartnerTenantApprovals(o={},e){return g.fromPromise(this.__listPartnerTenantApprovals(o,e))}async __listPartnerTenantApprovals(o={},e){let{status:t,cursor:r,limit:s}=o,n={};t!=null&&(n.status=t),r!=null&&(n.cursor=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,io.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/partner/tenant-approvals"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/partner/tenant-approvals.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listPlatformConnectApprovals(o,e){return g.fromPromise(this.__listPlatformConnectApprovals(o,e))}async __listPlatformConnectApprovals(o,e){let{connectGid:t,status:r,cursor:s,limit:n}=o,p={};r!=null&&(p.status=r),s!=null&&(p.cursor=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,io.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/platform-connects/${encodeURIComponent(t)}/approvals`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/platform-connects/{connectGid}/approvals.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}listTenantApprovals(o,e){return g.fromPromise(this.__listTenantApprovals(o,e))}async __listTenantApprovals(o,e){let{grantGid:t,status:r,cursor:s,limit:n}=o,p={};p.grantGid=t,r!=null&&(p.status=r),s!=null&&(p.cursor=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,io.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/tenant-approvals"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/tenant-approvals.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}getTenantApproval(o,e){return g.fromPromise(this.__getTenantApproval(o,e))}async __getTenantApproval(o,e){let{approvalGid:t}=o,r=await(this._options.fetcher??P)({url:(0,io.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/tenant-approvals/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/tenant-approvals/{approvalGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Dt=k(require("url-join"));var zt=class{static{u(this,"ConnectExplore")}_options;constructor(o){this._options=o}listExploreApps(o={},e){return g.fromPromise(this.__listExploreApps(o,e))}async __listExploreApps(o={},e){let{platformSlug:t,search:r,cursor:s,limit:n}=o,p={};t!=null&&(p.platformSlug=t),r!=null&&(p.search=r),s!=null&&(p.cursor=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,Dt.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/explore"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/explore.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}getExploreApp(o,e){return g.fromPromise(this.__getExploreApp(o,e))}async __getExploreApp(o,e){let{appId:t}=o,r=await(this._options.fetcher??P)({url:(0,Dt.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/explore/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/explore/{appId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}searchExploreApps(o,e){return g.fromPromise(this.__searchExploreApps(o,e))}async __searchExploreApps(o,e){let{query:t,cursor:r,limit:s}=o,n={};n.query=t,r!=null&&(n.cursor=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,Dt.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/explore/search"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/explore/search.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var _p=k(require("url-join"));var Ot=class{static{u(this,"ConnectInsights")}_options;constructor(o){this._options=o}getPublisherCompliance(o,e){return g.fromPromise(this.__getPublisherCompliance(o,e))}async __getPublisherCompliance(o,e){let{appId:t,publisherOrgId:r}=o,s={};r!=null&&(s.publisherOrgId=r);let n=await(this._options.fetcher??P)({url:(0,_p.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/explore/${encodeURIComponent(t)}/compliance`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/explore/{appId}/compliance.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getEcosystemGraph(o={},e){return g.fromPromise(this.__getEcosystemGraph(o,e))}async __getEcosystemGraph(o={},e){let{partnerSlug:t,envKind:r,direction:s,status:n,include:p}=o,c={};t!=null&&(c.partnerSlug=t),r!=null&&(c.envKind=r),s!=null&&(c.direction=s),n!=null&&(c.status=n),p!=null&&(c.include=p);let N=await(this._options.fetcher??P)({url:(0,_p.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/graph"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/graph.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ue=k(require("url-join"));var jt=class{static{u(this,"ConnectAccess")}_options;constructor(o){this._options=o}listMyGrants(o={},e){return g.fromPromise(this.__listMyGrants(o,e))}async __listMyGrants(o={},e){let{status:t,direction:r,app:s,envKind:n,cursor:p,limit:c}=o,N={};t!=null&&(N.status=t),r!=null&&(N.direction=r),s!=null&&(N.app=s),n!=null&&(N.envKind=n),p!=null&&(N.cursor=p),c!=null&&(N.limit=c.toString());let E=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/grants"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:N,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(E.ok)return{data:E.body,rawResponse:E.rawResponse};if(E.error.reason==="status-code")switch(E.error.statusCode){case 400:throw new w(E.error.body,E.rawResponse);case 401:throw new h(E.error.body,E.rawResponse);case 403:throw new m(E.error.body,E.rawResponse);case 404:throw new y(E.error.body,E.rawResponse);case 429:throw new R(E.error.body,E.rawResponse);default:throw new a({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse})}switch(E.error.reason){case"non-json":throw new a({statusCode:E.error.statusCode,body:E.error.rawBody,rawResponse:E.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/grants.");case"unknown":throw new a({message:E.error.errorMessage,rawResponse:E.rawResponse})}}getGrant(o,e){return g.fromPromise(this.__getGrant(o,e))}async __getGrant(o,e){let{grantGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pauseGrant(o,e){return g.fromPromise(this.__pauseGrant(o,e))}async __pauseGrant(o,e){let{grantGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants/{grantGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getGrantRates(o,e){return g.fromPromise(this.__getGrantRates(o,e))}async __getGrantRates(o,e){let{grantGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/rates`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}/rates.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}replayDroppedForGrant(o,e){return g.fromPromise(this.__replayDroppedForGrant(o,e))}async __replayDroppedForGrant(o,e){let{grantGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/replay-dropped`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants/{grantGid}/replay-dropped.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}resumeGrant(o,e){return g.fromPromise(this.__resumeGrant(o,e))}async __resumeGrant(o,e){let{grantGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/resume`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants/{grantGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getGrantTrustScore(o,e){return g.fromPromise(this.__getGrantTrustScore(o,e))}async __getGrantTrustScore(o,e){let{grantGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/trust-score`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}/trust-score.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getGrantUsage(o,e){return g.fromPromise(this.__getGrantUsage(o,e))}async __getGrantUsage(o,e){let{grantGid:t,period:r,windowStartMs:s,windowEndMs:n}=o,p={};r!=null&&(p.period=r),s!=null&&(p.windowStartMs=s.toString()),n!=null&&(p.windowEndMs=n.toString());let c=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/usage`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}/usage.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}resumeAllGrantsForOrg(o){return g.fromPromise(this.__resumeAllGrantsForOrg(o))}async __resumeAllGrantsForOrg(o){let e=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/grants/resume-all"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants/resume-all.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}suspendAllGrantsForOrg(o={},e){return g.fromPromise(this.__suspendAllGrantsForOrg(o,e))}async __suspendAllGrantsForOrg(o={},e){let t=await(this._options.fetcher??P)({url:(0,Ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/grants/suspend-all"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants/suspend-all.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Uh=k(require("url-join"));var Wt=class{static{u(this,"ConsentReceipts")}_options;constructor(o){this._options=o}listReceiptsByGrant(o,e){return g.fromPromise(this.__listReceiptsByGrant(o,e))}async __listReceiptsByGrant(o,e){let{grantGid:t,status:r,cursor:s,limit:n}=o,p={};r!=null&&(p.status=r),s!=null&&(p.cursor=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,Uh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/consents`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/grants/{grantGid}/consents.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Hh=k(require("url-join"));var $t=class{static{u(this,"ConnectPartner")}_options;constructor(o){this._options=o}getPartnerAuditFeed(o={},e){return g.fromPromise(this.__getPartnerAuditFeed(o,e))}async __getPartnerAuditFeed(o={},e){let{cursor:t,limit:r,action:s}=o,n={};t!=null&&(n.cursor=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.action=s);let p=await(this._options.fetcher??P)({url:(0,Hh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/partner/audit"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/partner/audit.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Bh=k(require("url-join"));var Kt=class{static{u(this,"ConnectProfile")}_options;constructor(o){this._options=o}getAppProfile(o){return g.fromPromise(this.__getAppProfile(o))}async __getAppProfile(o){let e=await(this._options.fetcher??P)({url:(0,Bh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/profile"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/profile.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var kp=k(require("url-join"));var Vt=class{static{u(this,"EntityNat")}_options;constructor(o){this._options=o}resolveEntity(o,e){return g.fromPromise(this.__resolveEntity(o,e))}async __resolveEntity(o,e){let{entityTypeSlug:t,localEntityId:r}=o,s={};s.entityTypeSlug=t,s.localEntityId=r;let n=await(this._options.fetcher??P)({url:(0,kp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/entity-nat/resolve"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/entity-nat/resolve.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}reverseResolve(o,e){return g.fromPromise(this.__reverseResolve(o,e))}async __reverseResolve(o,e){let{universalEntityToken:t}=o,r={};r.universalEntityToken=t;let s=await(this._options.fetcher??P)({url:(0,kp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/entity-nat/reverse-resolve"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/entity-nat/reverse-resolve.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var re=k(require("url-join"));var Jt=class{static{u(this,"Connect")}_options;constructor(o){this._options=o}createBridge(o,e){return g.fromPromise(this.__createBridge(o,e))}async __createBridge(o,e){let t=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/bridges"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/bridges.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}confirmBridge(o,e){return g.fromPromise(this.__confirmBridge(o,e))}async __confirmBridge(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/bridges/${encodeURIComponent(t)}/confirm`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/bridges/{gid}/confirm.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}requestAccess(o,e){return g.fromPromise(this.__requestAccess(o,e))}async __requestAccess(o,e){let t=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/grants"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}approveAccess(o,e){return g.fromPromise(this.__approveAccess(o,e))}async __approveAccess(o,e){let{grantId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/approve`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants/{grantId}/approve.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listRevocationAudit(o,e){return g.fromPromise(this.__listRevocationAudit(o,e))}async __listRevocationAudit(o,e){let{grantId:t}=o,r=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/audit`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/grants/{grantId}/audit.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rejectAccess(o,e){return g.fromPromise(this.__rejectAccess(o,e))}async __rejectAccess(o,e){let{grantId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/reject`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants/{grantId}/reject.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}revokeGrant(o,e){return g.fromPromise(this.__revokeGrant(o,e))}async __revokeGrant(o,e){let{grantId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/grants/${encodeURIComponent(t)}/revoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/grants/{grantId}/revoke.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPartnerGovernedApps(o={},e){return g.fromPromise(this.__listPartnerGovernedApps(o,e))}async __listPartnerGovernedApps(o={},e){let{cursor:t,limit:r}=o,s={};t!=null&&(s.cursor=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/partner/apps"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/partner/apps.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}partnerDelistApp(o,e){return g.fromPromise(this.__partnerDelistApp(o,e))}async __partnerDelistApp(o,e){let{targetAppId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/partner/apps/${encodeURIComponent(t)}/delist`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/partner/apps/{targetAppId}/delist.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}partnerFreezeApp(o,e){return g.fromPromise(this.__partnerFreezeApp(o,e))}async __partnerFreezeApp(o,e){let{targetAppId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/partner/apps/${encodeURIComponent(t)}/freeze`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/partner/apps/{targetAppId}/freeze.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}partnerReinstateApp(o,e){return g.fromPromise(this.__partnerReinstateApp(o,e))}async __partnerReinstateApp(o,e){let{targetAppId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/partner/apps/${encodeURIComponent(t)}/reinstate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/partner/apps/{targetAppId}/reinstate.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPartnerAppTenantApprovals(o,e){return g.fromPromise(this.__listPartnerAppTenantApprovals(o,e))}async __listPartnerAppTenantApprovals(o,e){let{targetAppId:t,status:r,cursor:s,limit:n}=o,p={};r!=null&&(p.status=r),s!=null&&(p.cursor=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/partner/apps/${encodeURIComponent(t)}/tenant-approvals`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/partner/apps/{targetAppId}/tenant-approvals.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}partnerOverrideTenantApproval(o,e){return g.fromPromise(this.__partnerOverrideTenantApproval(o,e))}async __partnerOverrideTenantApproval(o,e){let{targetTenantApprovalGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/partner/tenant-approvals/${encodeURIComponent(t)}/override`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/partner/tenant-approvals/{targetTenantApprovalGid}/override.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}updateAppProfile(o,e){return g.fromPromise(this.__updateAppProfile(o,e))}async __updateAppProfile(o,e){let{appId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/profile/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/connect/profile/{appId}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}initiateTenantApproval(o,e){return g.fromPromise(this.__initiateTenantApproval(o,e))}async __initiateTenantApproval(o,e){let t=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/tenant-approvals"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/tenant-approvals.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}revokeTenantApproval(o,e){return g.fromPromise(this.__revokeTenantApproval(o,e))}async __revokeTenantApproval(o,e){let{approvalId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/tenant-approvals/${encodeURIComponent(t)}/revoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/tenant-approvals/{approvalId}/revoke.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Tp=k(require("url-join"));var Qt=class{static{u(this,"IdentityBridges")}_options;constructor(o){this._options=o}archiveBridge(o,e){return g.fromPromise(this.__archiveBridge(o,e))}async __archiveBridge(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,Tp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/bridges/${encodeURIComponent(t)}/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/bridges/{gid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}suspendBridge(o,e){return g.fromPromise(this.__suspendBridge(o,e))}async __suspendBridge(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,Tp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/bridges/${encodeURIComponent(t)}/suspend`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/bridges/{gid}/suspend.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Lr=k(require("url-join"));var Yt=class{static{u(this,"PublishGrants")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{direction:t,status:r,cursor:s,limit:n}=o,p={};p.direction=t,r!=null&&(p.status=r),s!=null&&(p.cursor=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,Lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/publish-grants"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/publish-grants.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/connect/publish-grants"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/publish-grants.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{id:t}=o,r=await(this._options.fetcher??P)({url:(0,Lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/publish-grants/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/connect/publish-grants/{id}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pause(o,e){return g.fromPromise(this.__pause(o,e))}async __pause(o,e){let{id:t}=o,r=await(this._options.fetcher??P)({url:(0,Lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/publish-grants/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/publish-grants/{id}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resume(o,e){return g.fromPromise(this.__resume(o,e))}async __resume(o,e){let{id:t}=o,r=await(this._options.fetcher??P)({url:(0,Lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/publish-grants/${encodeURIComponent(t)}/resume`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/publish-grants/{id}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}revoke(o,e){return g.fromPromise(this.__revoke(o,e))}async __revoke(o,e){let{id:t}=o,r=await(this._options.fetcher??P)({url:(0,Lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/connect/publish-grants/${encodeURIComponent(t)}/revoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/connect/publish-grants/{id}/revoke.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Xt=class{static{u(this,"Connect")}_options;_connectBridges;_connectTenantApproval;_connectExplore;_connectInsights;_connectAccess;_consentReceipts;_connectPartner;_connectProfile;_entityNat;_connect;_identityBridges;_publishGrants;constructor(o){this._options=o}get connectBridges(){return this._connectBridges??=new Lt(this._options)}get connectTenantApproval(){return this._connectTenantApproval??=new Ft(this._options)}get connectExplore(){return this._connectExplore??=new zt(this._options)}get connectInsights(){return this._connectInsights??=new Ot(this._options)}get connectAccess(){return this._connectAccess??=new jt(this._options)}get consentReceipts(){return this._consentReceipts??=new Wt(this._options)}get connectPartner(){return this._connectPartner??=new $t(this._options)}get connectProfile(){return this._connectProfile??=new Kt(this._options)}get entityNat(){return this._entityNat??=new Vt(this._options)}get connect(){return this._connect??=new Jt(this._options)}get identityBridges(){return this._identityBridges??=new Qt(this._options)}get publishGrants(){return this._publishGrants??=new Yt(this._options)}};var Cp=k(require("url-join"));var Zt=class{static{u(this,"Origins")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{appGID:t,envId:r}=o,s={};s.appGID=t,s.envId=r;let n=await(this._options.fetcher??P)({url:(0,Cp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/embed/origins"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/embed/origins.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}set(o,e){return g.fromPromise(this.__set(o,e))}async __set(o,e){let t=await(this._options.fetcher??P)({url:(0,Cp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/embed/origins"),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/embed/origins.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var xp=k(require("url-join"));var en=class{static{u(this,"Sessions")}_options;constructor(o){this._options=o}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,xp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/embed/sessions"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/embed/sessions.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}revoke(o,e){return g.fromPromise(this.__revoke(o,e))}async __revoke(o,e){let{sessionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,xp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/embed/sessions/${encodeURIComponent(t)}/revoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/embed/sessions/{sessionGid}/revoke.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var rn=class{static{u(this,"Embed")}_options;_origins;_sessions;constructor(o){this._options=o}get origins(){return this._origins??=new Zt(this._options)}get sessions(){return this._sessions??=new en(this._options)}};var po=k(require("url-join"));var on=class{static{u(this,"Adapters")}_options;constructor(o){this._options=o}listAdapters(o){return g.fromPromise(this.__listAdapters(o))}async __listAdapters(o){let e=await(this._options.fetcher??P)({url:(0,po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/adapters"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/adapters.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}createAdapter(o,e){return g.fromPromise(this.__createAdapter(o,e))}async __createAdapter(o,e){let t=await(this._options.fetcher??P)({url:(0,po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/adapters"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/adapters.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getAdapter(o,e){return g.fromPromise(this.__getAdapter(o,e))}async __getAdapter(o,e){let{adapterGid:t}=o,r=await(this._options.fetcher??P)({url:(0,po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/adapters/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/adapters/{adapterGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteAdapter(o,e){return g.fromPromise(this.__deleteAdapter(o,e))}async __deleteAdapter(o,e){let{adapterGid:t}=o,r=await(this._options.fetcher??P)({url:(0,po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/adapters/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/adapters/{adapterGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateAdapter(o,e){return g.fromPromise(this.__updateAdapter(o,e))}async __updateAdapter(o,e){let{adapterGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/adapters/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/adapters/{adapterGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ye=k(require("url-join"));var sn=class{static{u(this,"Channels")}_options;constructor(o){this._options=o}listAppIds(o={},e){return g.fromPromise(this.__listAppIds(o,e))}async __listAppIds(o={},e){let{includeArchived:t}=o,r={};t!=null&&(r.includeArchived=t.toString());let s=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{status:t,excludeFeedReceiving:r,includeArchived:s}=o,n={};t!=null&&(n.status=t),r!=null&&(n.excludeFeedReceiving=r.toString()),s!=null&&(n.includeArchived=s.toString());let p=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/channels"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/channels.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/channels"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/apps/channels.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getBySlug(o,e){return g.fromPromise(this.__getBySlug(o,e))}async __getBySlug(o,e){let{slug:t}=o,r=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/apps/channels/by-slug/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/channels/by-slug/{slug}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listPaginated(o={},e){return g.fromPromise(this.__listPaginated(o,e))}async __listPaginated(o={},e){let{status:t,cursor:r,limit:s,includeArchived:n,fields:p}=o,c={};t!=null&&(c.status=t),r!=null&&(c.cursor=r),s!=null&&(c.limit=s.toString()),n!=null&&(c.includeArchived=n.toString()),p!=null&&(c.fields=p);let N=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/channels/paginated"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/channels/paginated.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}listWithStats(o={},e){return g.fromPromise(this.__listWithStats(o,e))}async __listWithStats(o={},e){let{status:t,includeArchived:r}=o,s={};t!=null&&(s.status=t),r!=null&&(s.includeArchived=r.toString());let n=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/channels/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/channels/stats.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/channels/{channelGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/channels/{channelGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}archive(o,e){return g.fromPromise(this.__archive(o,e))}async __archive(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pause(o,e){return g.fromPromise(this.__pause(o,e))}async __pause(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resume(o,e){return g.fromPromise(this.__resume(o,e))}async __resume(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/resume`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Fr=k(require("url-join"));var tn=class{static{u(this,"Deliveries")}_options;constructor(o){this._options=o}listByApp(o={},e){return g.fromPromise(this.__listByApp(o,e))}async __listByApp(o={},e){let{status:t,limit:r}=o,s={};t!=null&&(s.status=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Fr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/deliveries"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/deliveries.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{deliveryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Fr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/deliveries/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/deliveries/{deliveryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancel(o,e){return g.fromPromise(this.__cancel(o,e))}async __cancel(o,e){let{deliveryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Fr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/deliveries/${encodeURIComponent(t)}/cancel`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/deliveries/{deliveryGid}/cancel.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}retry(o,e){return g.fromPromise(this.__retry(o,e))}async __retry(o,e){let{deliveryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Fr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/deliveries/${encodeURIComponent(t)}/retry`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/deliveries/{deliveryGid}/retry.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listByMessage(o,e){return g.fromPromise(this.__listByMessage(o,e))}async __listByMessage(o,e){let{messageGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Fr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/messages/${encodeURIComponent(t)}/deliveries`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/messages/{messageGid}/deliveries.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBySubscription(o,e){return g.fromPromise(this.__listBySubscription(o,e))}async __listBySubscription(o,e){let{subscriptionGid:t,status:r,limit:s}=o,n={};r!=null&&(n.status=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,Fr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/deliveries`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/deliveries.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ve=k(require("url-join"));var nn=class{static{u(this,"Dlq")}_options;constructor(o){this._options=o}listByApp(o={},e){return g.fromPromise(this.__listByApp(o,e))}async __listByApp(o={},e){let{status:t,limit:r,cursor:s}=o,n={};t!=null&&(n.status=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/dlq"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/dlq.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{dlqEntryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/dlq/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/dlq/{dlqEntryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}discard(o,e){return g.fromPromise(this.__discard(o,e))}async __discard(o,e){let{dlqEntryGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/dlq/${encodeURIComponent(t)}/discard`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/dlq/{dlqEntryGid}/discard.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}reprocess(o,e){return g.fromPromise(this.__reprocess(o,e))}async __reprocess(o,e){let{dlqEntryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/dlq/${encodeURIComponent(t)}/reprocess`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/dlq/{dlqEntryGid}/reprocess.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}bulkDiscard(o,e){return g.fromPromise(this.__bulkDiscard(o,e))}async __bulkDiscard(o,e){let t=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/dlq/discard"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/dlq/discard.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}reprocessWithFilter(o={},e){return g.fromPromise(this.__reprocessWithFilter(o,e))}async __reprocessWithFilter(o={},e){let t=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/dlq/reprocess"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/dlq/reprocess.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}bulkReprocess(o,e){return g.fromPromise(this.__bulkReprocess(o,e))}async __bulkReprocess(o,e){let t=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/dlq/retry"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/dlq/retry.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listBySubscription(o,e){return g.fromPromise(this.__listBySubscription(o,e))}async __listBySubscription(o,e){let{subscriptionGid:t,status:r,limit:s}=o,n={};r!=null&&(n.status=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/dlq`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/dlq.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}reprocessAllPending(o,e){return g.fromPromise(this.__reprocessAllPending(o,e))}async __reprocessAllPending(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/dlq/reprocess`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/dlq/reprocess.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getStats(o,e){return g.fromPromise(this.__getStats(o,e))}async __getStats(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/dlq/stats`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/dlq/stats.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getTrend(o,e){return g.fromPromise(this.__getTrend(o,e))}async __getTrend(o,e){let{subscriptionGid:t,hours:r}=o,s={};r!=null&&(s.hours=r.toString());let n=await(this._options.fetcher??P)({url:(0,ve.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/dlq/trend`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/dlq/trend.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var an=k(require("url-join"));var dn=class{static{u(this,"AppDpopKeys")}_options;constructor(o){this._options=o}listKeys(o={},e){return g.fromPromise(this.__listKeys(o,e))}async __listKeys(o={},e){let{status:t,cursor:r,limit:s}=o,n={};t!=null&&(n.status=t),r!=null&&(n.cursor=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,an.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/dpop-keys"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/dpop-keys.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}register(o,e){return g.fromPromise(this.__register(o,e))}async __register(o,e){let t=await(this._options.fetcher??P)({url:(0,an.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/dpop-keys"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/apps/dpop-keys.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}revokeByThumbprint(o,e){return g.fromPromise(this.__revokeByThumbprint(o,e))}async __revokeByThumbprint(o,e){let{jwkThumbprint:t,reason:r}=o,s={};r!=null&&(s.reason=r);let n=await(this._options.fetcher??P)({url:(0,an.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/apps/dpop-keys/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/apps/dpop-keys/{jwkThumbprint}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var pe=k(require("url-join"));var pn=class{static{u(this,"Catalogue")}_options;constructor(o){this._options=o}listEventTypes(o={},e){return g.fromPromise(this.__listEventTypes(o,e))}async __listEventTypes(o={},e){let{domain:t,status:r,tag:s}=o,n={};t!=null&&(n.domain=t),r!=null&&(n.status=r),s!=null&&(n.tag=s);let p=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/events/types"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/events/types.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}registerEventType(o,e){return g.fromPromise(this.__registerEventType(o,e))}async __registerEventType(o,e){let t=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/events/types"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/apps/events/types.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listDeprecated(o){return g.fromPromise(this.__listDeprecated(o))}async __listDeprecated(o){let e=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/events/types/deprecated"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/events/types/deprecated.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getEventTypeByGid(o,e){return g.fromPromise(this.__getEventTypeByGid(o,e))}async __getEventTypeByGid(o,e){let{eventTypeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/events/types/{eventTypeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateEventType(o,e){return g.fromPromise(this.__updateEventType(o,e))}async __updateEventType(o,e){let{eventTypeGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/events/types/{eventTypeGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}activateEventType(o,e){return g.fromPromise(this.__activateEventType(o,e))}async __activateEventType(o,e){let{eventTypeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}/activate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/events/types/{eventTypeGid}/activate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}checkCompatibility(o,e){return g.fromPromise(this.__checkCompatibility(o,e))}async __checkCompatibility(o,e){let{eventTypeGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}/compatibility`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/events/types/{eventTypeGid}/compatibility.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getConsumers(o,e){return g.fromPromise(this.__getConsumers(o,e))}async __getConsumers(o,e){let{eventTypeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}/consumers`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/events/types/{eventTypeGid}/consumers.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deprecateEventType(o,e){return g.fromPromise(this.__deprecateEventType(o,e))}async __deprecateEventType(o,e){let{eventTypeGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}/deprecate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/events/types/{eventTypeGid}/deprecate.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getImpactAnalysis(o,e){return g.fromPromise(this.__getImpactAnalysis(o,e))}async __getImpactAnalysis(o,e){let{eventTypeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}/impact`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/events/types/{eventTypeGid}/impact.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getVersions(o,e){return g.fromPromise(this.__getVersions(o,e))}async __getVersions(o,e){let{eventTypeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}/versions`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/events/types/{eventTypeGid}/versions.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}registerVersion(o,e){return g.fromPromise(this.__registerVersion(o,e))}async __registerVersion(o,e){let{eventTypeGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/${encodeURIComponent(t)}/versions`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/events/types/{eventTypeGid}/versions.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getEventTypeByName(o,e){return g.fromPromise(this.__getEventTypeByName(o,e))}async __getEventTypeByName(o,e){let{name:t}=o,r=await(this._options.fetcher??P)({url:(0,pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/events/types/by-name/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/events/types/by-name/{name}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Qe=k(require("url-join"));var cn=class{static{u(this,"Messages")}_options;constructor(o){this._options=o}listByApp(o={},e){return g.fromPromise(this.__listByApp(o,e))}async __listByApp(o={},e){let{limit:t}=o,r={};t!=null&&(r.limit=t.toString());let s=await(this._options.fetcher??P)({url:(0,Qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/messages"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/messages.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{channelGid:t,limit:r,afterTimestamp:s}=o,n={};r!=null&&(n.limit=r.toString()),s!=null&&(n.afterTimestamp=s.toString());let p=await(this._options.fetcher??P)({url:(0,Qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/messages`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/messages.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}publish(o,e){return g.fromPromise(this.__publish(o,e))}async __publish(o,e){let{channelGid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,Qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/messages`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}publishBatch(o,e){return g.fromPromise(this.__publishBatch(o,e))}async __publishBatch(o,e){let{channelGid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,Qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/messages/batch`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages/batch.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}publishBatchNpp(o,e){return g.fromPromise(this.__publishBatchNpp(o,e))}async __publishBatchNpp(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/messages/batch-npp`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages/batch-npp.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}publishGroup(o,e){return g.fromPromise(this.__publishGroup(o,e))}async __publishGroup(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/messages/group`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages/group.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listByPartition(o,e){return g.fromPromise(this.__listByPartition(o,e))}async __listByPartition(o,e){let{channelGid:t,partitionKey:r,limit:s}=o,n={};s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,Qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/messages/partition/${encodeURIComponent(r)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/messages/partition/{partitionKey}.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{messageGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/messages/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/messages/{messageGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ce=k(require("url-join"));var un=class{static{u(this,"Subscriptions")}_options;constructor(o){this._options=o}listByApp(o={},e){return g.fromPromise(this.__listByApp(o,e))}async __listByApp(o={},e){let{status:t}=o,r={};t!=null&&(r.status=t);let s=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/apps/subscriptions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/apps/subscriptions.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}subscribe(o,e){return g.fromPromise(this.__subscribe(o,e))}async __subscribe(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/subscribe`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/subscribe.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{channelGid:t,status:r}=o,s={};r!=null&&(s.status=r);let n=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/subscriptions`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/subscriptions.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let{channelGid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/subscriptions`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/subscriptions.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/subscriptions/{subscriptionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/subscriptions/{subscriptionGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}archive(o,e){return g.fromPromise(this.__archive(o,e))}async __archive(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pause(o,e){return g.fromPromise(this.__pause(o,e))}async __pause(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resume(o,e){return g.fromPromise(this.__resume(o,e))}async __resume(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/resume`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rotateSecret(o,e){return g.fromPromise(this.__rotateSecret(o,e))}async __rotateSecret(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/rotate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/rotate.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}revealSecret(o,e){return g.fromPromise(this.__revealSecret(o,e))}async __revealSecret(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/secret/reveal`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/secret/reveal.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}unsubscribe(o,e){return g.fromPromise(this.__unsubscribe(o,e))}async __unsubscribe(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ce.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/unsubscribe`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/unsubscribe.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var qh=k(require("url-join"));var ln=class{static{u(this,"TieredStorage")}_options;constructor(o){this._options=o}getColdTierReplay(o,e){return g.fromPromise(this.__getColdTierReplay(o,e))}async __getColdTierReplay(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,qh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/cold-tier/replay`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/cold-tier/replay.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var He=k(require("url-join"));var wn=class{static{u(this,"ConsumerGroups")}_options;constructor(o){this._options=o}listGroups(o,e){return g.fromPromise(this.__listGroups(o,e))}async __listGroups(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/consumer-groups`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/consumer-groups.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createGroup(o,e){return g.fromPromise(this.__createGroup(o,e))}async __createGroup(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/consumer-groups`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/consumer-groups.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getGroup(o,e){return g.fromPromise(this.__getGroup(o,e))}async __getGroup(o,e){let{groupGid:t}=o,r=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/consumer-groups/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/consumer-groups/{groupGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteGroup(o,e){return g.fromPromise(this.__deleteGroup(o,e))}async __deleteGroup(o,e){let{groupGid:t}=o,r=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/consumer-groups/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/consumer-groups/{groupGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateGroup(o,e){return g.fromPromise(this.__updateGroup(o,e))}async __updateGroup(o,e){let{groupGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/consumer-groups/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/consumer-groups/{groupGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}joinGroup(o,e){return g.fromPromise(this.__joinGroup(o,e))}async __joinGroup(o,e){let{groupGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/consumer-groups/${encodeURIComponent(t)}/members`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/consumer-groups/{groupGid}/members.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}leaveGroup(o,e){return g.fromPromise(this.__leaveGroup(o,e))}async __leaveGroup(o,e){let{groupGid:t,subscriptionGid:r}=o,s=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/consumer-groups/${encodeURIComponent(t)}/members/${encodeURIComponent(r)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/consumer-groups/{groupGid}/members/{subscriptionGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}receive(o,e){return g.fromPromise(this.__receive(o,e))}async __receive(o,e){let{groupGid:t,subscriptionGid:r,...s}=o,n=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/consumer-groups/${encodeURIComponent(t)}/members/${encodeURIComponent(r)}/receive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/consumer-groups/{groupGid}/members/{subscriptionGid}/receive.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}pauseGroup(o,e){return g.fromPromise(this.__pauseGroup(o,e))}async __pauseGroup(o,e){let{groupGid:t}=o,r=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/consumer-groups/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/consumer-groups/{groupGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resumeGroup(o,e){return g.fromPromise(this.__resumeGroup(o,e))}async __resumeGroup(o,e){let{groupGid:t}=o,r=await(this._options.fetcher??P)({url:(0,He.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/consumer-groups/${encodeURIComponent(t)}/resume`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/consumer-groups/{groupGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Dr=k(require("url-join"));var hn=class{static{u(this,"Scheduling")}_options;constructor(o){this._options=o}scheduleMessage(o,e){return g.fromPromise(this.__scheduleMessage(o,e))}async __scheduleMessage(o,e){let{channelGid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,Dr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/schedule`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/schedule.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}scheduleDelay(o,e){return g.fromPromise(this.__scheduleDelay(o,e))}async __scheduleDelay(o,e){let{channelGid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,Dr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/schedule/delay`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/schedule/delay.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listScheduled(o,e){return g.fromPromise(this.__listScheduled(o,e))}async __listScheduled(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Dr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/scheduled-messages`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/scheduled-messages.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getScheduledStatus(o,e){return g.fromPromise(this.__getScheduledStatus(o,e))}async __getScheduledStatus(o,e){let{scheduledMessageGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Dr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/scheduled-messages/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/scheduled-messages/{scheduledMessageGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateScheduled(o,e){return g.fromPromise(this.__updateScheduled(o,e))}async __updateScheduled(o,e){let{scheduledMessageGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Dr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/scheduled-messages/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/scheduled-messages/{scheduledMessageGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}cancelScheduled(o,e){return g.fromPromise(this.__cancelScheduled(o,e))}async __cancelScheduled(o,e){let{scheduledMessageGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Dr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/scheduled-messages/${encodeURIComponent(t)}/cancel`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/scheduled-messages/{scheduledMessageGid}/cancel.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var rs=k(require("url-join"));var mn=class{static{u(this,"Snapshots")}_options;constructor(o){this._options=o}seekToTimestamp(o,e){return g.fromPromise(this.__seekToTimestamp(o,e))}async __seekToTimestamp(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,rs.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/seek-to-timestamp`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/seek-to-timestamp.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}seekToSnapshot(o,e){return g.fromPromise(this.__seekToSnapshot(o,e))}async __seekToSnapshot(o,e){let{snapshotGid:t}=o,r=await(this._options.fetcher??P)({url:(0,rs.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/snapshots/${encodeURIComponent(t)}/seek`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/snapshots/{snapshotGid}/seek.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listSnapshots(o,e){return g.fromPromise(this.__listSnapshots(o,e))}async __listSnapshots(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,rs.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/snapshots`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/snapshots.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createSnapshot(o,e){return g.fromPromise(this.__createSnapshot(o,e))}async __createSnapshot(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,rs.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/snapshots`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/snapshots.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var os=k(require("url-join"));var yn=class{static{u(this,"TimeTravel")}_options;constructor(o){this._options=o}diffChannelBetween(o,e){return g.fromPromise(this.__diffChannelBetween(o,e))}async __diffChannelBetween(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,os.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/time-travel/diff`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/time-travel/diff.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getChannelSnapshotAtTime(o,e){return g.fromPromise(this.__getChannelSnapshotAtTime(o,e))}async __getChannelSnapshotAtTime(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,os.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/time-travel/snapshot`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/time-travel/snapshot.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getChannelSnapshotAtTimeWithGrantApi(o,e){return g.fromPromise(this.__getChannelSnapshotAtTimeWithGrantApi(o,e))}async __getChannelSnapshotAtTimeWithGrantApi(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,os.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/time-travel/snapshot/grant`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/time-travel/snapshot/grant.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getMessageAtTime(o,e){return g.fromPromise(this.__getMessageAtTime(o,e))}async __getMessageAtTime(o,e){let{messageGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,os.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/messages/${encodeURIComponent(t)}/time-travel`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/messages/{messageGid}/time-travel.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var co=k(require("url-join"));var Rn=class{static{u(this,"ArchiveReplay")}_options;constructor(o){this._options=o}getArchiveStatus(o,e){return g.fromPromise(this.__getArchiveStatus(o,e))}async __getArchiveStatus(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/archive-status`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/archive-status.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}archiveChannel(o,e){return g.fromPromise(this.__archiveChannel(o,e))}async __archiveChannel(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/messages/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/messages/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}restoreChannel(o,e){return g.fromPromise(this.__restoreChannel(o,e))}async __restoreChannel(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/restore`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/restore.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}replayMessages(o,e){return g.fromPromise(this.__replayMessages(o,e))}async __replayMessages(o,e){let{targetChannelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/replay`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{targetChannelGid}/replay.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}replayMessagesWithGrant(o,e){return g.fromPromise(this.__replayMessagesWithGrant(o,e))}async __replayMessagesWithGrant(o,e){let{targetChannelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,co.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/replay-with-grant`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{targetChannelGid}/replay-with-grant.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var uo=k(require("url-join"));var gn=class{static{u(this,"Observability")}_options;constructor(o){this._options=o}getChannelDeliveryOverview(o,e){return g.fromPromise(this.__getChannelDeliveryOverview(o,e))}async __getChannelDeliveryOverview(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,uo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/delivery-overview`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/delivery-overview.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getChannelSubscriptionHealth(o,e){return g.fromPromise(this.__getChannelSubscriptionHealth(o,e))}async __getChannelSubscriptionHealth(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,uo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/subscriptions/health`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/subscriptions/health.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getDeliveryTimeline(o,e){return g.fromPromise(this.__getDeliveryTimeline(o,e))}async __getDeliveryTimeline(o,e){let{deliveryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,uo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/deliveries/${encodeURIComponent(t)}/timeline`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/deliveries/{deliveryGid}/timeline.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getMessageDeliveryStatus(o,e){return g.fromPromise(this.__getMessageDeliveryStatus(o,e))}async __getMessageDeliveryStatus(o,e){let{messageGid:t}=o,r=await(this._options.fetcher??P)({url:(0,uo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/messages/${encodeURIComponent(t)}/delivery-status`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/messages/{messageGid}/delivery-status.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}searchMessages(o={},e){return g.fromPromise(this.__searchMessages(o,e))}async __searchMessages(o={},e){let{channelGid:t,routingKey:r,status:s,fromDate:n,toDate:p,limit:c}=o,N={};t!=null&&(N.channelGid=t),r!=null&&(N.routingKey=r),s!=null&&(N.status=s),n!=null&&(N.fromDate=n.toString()),p!=null&&(N.toDate=p.toString()),c!=null&&(N.limit=c.toString());let E=await(this._options.fetcher??P)({url:(0,uo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/messages/search"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:N,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(E.ok)return{data:E.body,rawResponse:E.rawResponse};if(E.error.reason==="status-code")switch(E.error.statusCode){case 400:throw new w(E.error.body,E.rawResponse);case 401:throw new h(E.error.body,E.rawResponse);case 403:throw new m(E.error.body,E.rawResponse);case 404:throw new y(E.error.body,E.rawResponse);case 429:throw new R(E.error.body,E.rawResponse);default:throw new a({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse})}switch(E.error.reason){case"non-json":throw new a({statusCode:E.error.statusCode,body:E.error.rawBody,rawResponse:E.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/messages/search.");case"unknown":throw new a({message:E.error.errorMessage,rawResponse:E.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Lh=k(require("url-join"));var Pn=class{static{u(this,"ChannelDetail")}_options;constructor(o){this._options=o}getChannelDetail(o,e){return g.fromPromise(this.__getChannelDetail(o,e))}async __getChannelDetail(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Lh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/detail`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/detail.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var lr=k(require("url-join"));var bn=class{static{u(this,"Receipts")}_options;constructor(o){this._options=o}listByChannel(o,e){return g.fromPromise(this.__listByChannel(o,e))}async __listByChannel(o,e){let{channelGid:t,status:r,limit:s,cursor:n}=o,p={};r!=null&&(p.status=r),s!=null&&(p.limit=s.toString()),n!=null&&(p.cursor=n.toString());let c=await(this._options.fetcher??P)({url:(0,lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/receipts`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/receipts.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}getByDelivery(o,e){return g.fromPromise(this.__getByDelivery(o,e))}async __getByDelivery(o,e){let{deliveryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/deliveries/${encodeURIComponent(t)}/receipt`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/deliveries/{deliveryGid}/receipt.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listByMessage(o,e){return g.fromPromise(this.__listByMessage(o,e))}async __listByMessage(o,e){let{messageGid:t,limit:r}=o,s={};r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/messages/${encodeURIComponent(t)}/receipts`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/messages/{messageGid}/receipts.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/receipts/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/receipts/{gid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}acknowledge(o,e){return g.fromPromise(this.__acknowledge(o,e))}async __acknowledge(o,e){let{receiptGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/receipts/${encodeURIComponent(t)}/acknowledge`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/receipts/{receiptGid}/acknowledge.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listBySubscription(o,e){return g.fromPromise(this.__listBySubscription(o,e))}async __listBySubscription(o,e){let{subscriptionGid:t,limit:r,cursor:s}=o,n={};r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s.toString());let p=await(this._options.fetcher??P)({url:(0,lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/receipts`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/receipts.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getStats(o,e){return g.fromPromise(this.__getStats(o,e))}async __getStats(o,e){let{subscriptionGid:t,startTime:r,endTime:s}=o,n={};r!=null&&(n.startTime=r.toString()),s!=null&&(n.endTime=s.toString());let p=await(this._options.fetcher??P)({url:(0,lr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/receipts/stats`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/receipts/stats.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Fh=k(require("url-join"));var fn=class{static{u(this,"Security")}_options;constructor(o){this._options=o}scanChannelSample(o,e){return g.fromPromise(this.__scanChannelSample(o,e))}async __scanChannelSample(o,e){let{channelGid:t,limit:r}=o,s={};r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Fh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/security/scan-sample`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/security/scan-sample.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var vn=k(require("url-join"));var Nn=class{static{u(this,"Consume")}_options;constructor(o){this._options=o}seek(o,e){return g.fromPromise(this.__seek(o,e))}async __seek(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,vn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/seek`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/seek.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}ack(o,e){return g.fromPromise(this.__ack(o,e))}async __ack(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,vn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/ack`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/ack.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}flowCredit(o,e){return g.fromPromise(this.__flowCredit(o,e))}async __flowCredit(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,vn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/flow-credit`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/flow-credit.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var wr=k(require("url-join"));var En=class{static{u(this,"Streams")}_options;constructor(o){this._options=o}openCrossOrgStream(o,e){return g.fromPromise(this.__openCrossOrgStream(o,e))}async __openCrossOrgStream(o,e){let{channelGid:t,publisherAppId:r,subscriberOrgId:s}=o,n={};n.publisherAppId=r,n.subscriberOrgId=s;let p=await(this._options.fetcher??P)({url:(0,wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/streams/cross-org`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/streams/cross-org.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}readFromOffsetWithGrant(o,e){return g.fromPromise(this.__readFromOffsetWithGrant(o,e))}async __readFromOffsetWithGrant(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/streams/cross-org/read`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/streams/cross-org/read.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getOffset(o,e){return g.fromPromise(this.__getOffset(o,e))}async __getOffset(o,e){let{channelGid:t,consumerId:r}=o,s={};s.consumerId=r;let n=await(this._options.fetcher??P)({url:(0,wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/streams/offset`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/streams/offset.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}commitOffset(o,e){return g.fromPromise(this.__commitOffset(o,e))}async __commitOffset(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/streams/offset`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/streams/offset.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listOffsets(o,e){return g.fromPromise(this.__listOffsets(o,e))}async __listOffsets(o,e){let{channelGid:t}=o,r=await(this._options.fetcher??P)({url:(0,wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/streams/offsets`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/streams/offsets.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}readFromOffset(o,e){return g.fromPromise(this.__readFromOffset(o,e))}async __readFromOffset(o,e){let{channelGid:t,offset:r,limit:s,subscriptionGid:n}=o,p={};p.offset=r.toString(),s!=null&&(p.limit=s.toString()),n!=null&&(p.subscriptionGid=n);let c=await(this._options.fetcher??P)({url:(0,wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/streams/read`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/channels/{channelGid}/streams/read.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}seekToTimestamp(o,e){return g.fromPromise(this.__seekToTimestamp(o,e))}async __seekToTimestamp(o,e){let{channelGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/channels/${encodeURIComponent(t)}/streams/seek`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/channels/{channelGid}/streams/seek.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var lo=k(require("url-join"));var Sn=class{static{u(this,"DeliveryReceipts")}_options;constructor(o){this._options=o}getByDelivery(o,e){return g.fromPromise(this.__getByDelivery(o,e))}async __getByDelivery(o,e){let{deliveryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,lo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/delivery-receipts/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/delivery-receipts/{deliveryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}confirm(o,e){return g.fromPromise(this.__confirm(o,e))}async __confirm(o,e){let{deliveryGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,lo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/delivery-receipts/${encodeURIComponent(t)}/confirm`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/delivery-receipts/{deliveryGid}/confirm.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listBySubscription(o,e){return g.fromPromise(this.__listBySubscription(o,e))}async __listBySubscription(o,e){let{subscriptionGid:t,limit:r}=o,s={};r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,lo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/delivery-receipts`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/delivery-receipts.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getHealth(o,e){return g.fromPromise(this.__getHealth(o,e))}async __getHealth(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,lo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/webhook-health`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/webhook-health.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listDegraded(o){return g.fromPromise(this.__listDegraded(o))}async __listDegraded(o){let e=await(this._options.fetcher??P)({url:(0,lo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/webhook-health/degraded"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/webhook-health/degraded.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Dh=k(require("url-join"));var _n=class{static{u(this,"Stats")}_options;constructor(o){this._options=o}retrieve(o){return g.fromPromise(this.__retrieve(o))}async __retrieve(o){let e=await(this._options.fetcher??P)({url:(0,Dh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/events/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/events/stats.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var kn=k(require("url-join"));var Tn=class{static{u(this,"ExactlyOnce")}_options;constructor(o){this._options=o}isDelivered(o,e){return g.fromPromise(this.__isDelivered(o,e))}async __isDelivered(o,e){let{subscriptionGid:t,messageGid:r}=o,s={};s.subscriptionGid=t,s.messageGid=r;let n=await(this._options.fetcher??P)({url:(0,kn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/exactly-once/delivered"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/exactly-once/delivered.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}generateDeliveryToken(o,e){return g.fromPromise(this.__generateDeliveryToken(o,e))}async __generateDeliveryToken(o,e){let t=await(this._options.fetcher??P)({url:(0,kn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/exactly-once/tokens"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/exactly-once/tokens.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}confirmDelivery(o,e){return g.fromPromise(this.__confirmDelivery(o,e))}async __confirmDelivery(o,e){let{token:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,kn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exactly-once/tokens/${encodeURIComponent(t)}/confirm`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/exactly-once/tokens/{token}/confirm.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ne=k(require("url-join"));var Cn=class{static{u(this,"Exchanges")}_options;constructor(o){this._options=o}removeBinding(o,e){return g.fromPromise(this.__removeBinding(o,e))}async __removeBinding(o,e){let{bindingGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchange-bindings/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/exchange-bindings/{bindingGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}list(o){return g.fromPromise(this.__list(o))}async __list(o){let e=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/exchanges"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/exchanges.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/exchanges"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/exchanges.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{exchangeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/exchanges/{exchangeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{exchangeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/exchanges/{exchangeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{exchangeGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/exchanges/{exchangeGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listBindings(o,e){return g.fromPromise(this.__listBindings(o,e))}async __listBindings(o,e){let{exchangeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}/bindings`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/exchanges/{exchangeGid}/bindings.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createBinding(o,e){return g.fromPromise(this.__createBinding(o,e))}async __createBinding(o,e){let{exchangeGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}/bindings`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/bindings.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}disable(o,e){return g.fromPromise(this.__disable(o,e))}async __disable(o,e){let{exchangeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}/disable`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/disable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}dryRun(o,e){return g.fromPromise(this.__dryRun(o,e))}async __dryRun(o,e){let{exchangeGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}/dry-run`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/dry-run.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}enable(o,e){return g.fromPromise(this.__enable(o,e))}async __enable(o,e){let{exchangeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}/enable`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/enable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}publishToExchange(o,e){return g.fromPromise(this.__publishToExchange(o,e))}async __publishToExchange(o,e){let{exchangeGid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}/publish`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/exchanges/{exchangeGid}/publish.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getByGid(o,e){return g.fromPromise(this.__getByGid(o,e))}async __getByGid(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/exchanges/${encodeURIComponent(t)}/raw`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/exchanges/{gid}/raw.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listWithStats(o){return g.fromPromise(this.__listWithStats(o))}async __listWithStats(o){let e=await(this._options.fetcher??P)({url:(0,ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/exchanges/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/exchanges/stats.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var xn=k(require("url-join"));var An=class{static{u(this,"Transactional")}_options;constructor(o){this._options=o}listDeliveriesByGroupGrantFifo(o,e){return g.fromPromise(this.__listDeliveriesByGroupGrantFifo(o,e))}async __listDeliveriesByGroupGrantFifo(o,e){let{groupId:t,grantId:r}=o,s=await(this._options.fetcher??P)({url:(0,xn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/groups/${encodeURIComponent(t)}/grants/${encodeURIComponent(r)}/deliveries`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/groups/{groupId}/grants/{grantId}/deliveries.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}consumeAndPublish(o,e){return g.fromPromise(this.__consumeAndPublish(o,e))}async __consumeAndPublish(o,e){let t=await(this._options.fetcher??P)({url:(0,xn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/messages/transactional"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/messages/transactional.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}consumeAndPublishMulti(o,e){return g.fromPromise(this.__consumeAndPublishMulti(o,e))}async __consumeAndPublishMulti(o,e){let t=await(this._options.fetcher??P)({url:(0,xn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/messages/transactional/multi"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/messages/transactional/multi.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var wo=k(require("url-join"));var In=class{static{u(this,"KvStore")}_options;constructor(o){this._options=o}getEntry(o,e){return g.fromPromise(this.__getEntry(o,e))}async __getEntry(o,e){let{channelGid:t,key:r}=o,s=await(this._options.fetcher??P)({url:(0,wo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/kv/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/kv/{channelGid}/{key}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}setEntry(o,e){return g.fromPromise(this.__setEntry(o,e))}async __setEntry(o,e){let{channelGid:t,key:r,...s}=o,n=await(this._options.fetcher??P)({url:(0,wo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/kv/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/kv/{channelGid}/{key}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}deleteEntry(o,e){return g.fromPromise(this.__deleteEntry(o,e))}async __deleteEntry(o,e){let{channelGid:t,key:r}=o,s=await(this._options.fetcher??P)({url:(0,wo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/kv/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/kv/{channelGid}/{key}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getHistory(o,e){return g.fromPromise(this.__getHistory(o,e))}async __getHistory(o,e){let{channelGid:t,key:r,limit:s}=o,n={};s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,wo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/kv/${encodeURIComponent(t)}/${encodeURIComponent(r)}/history`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/kv/{channelGid}/{key}/history.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listKeys(o,e){return g.fromPromise(this.__listKeys(o,e))}async __listKeys(o,e){let{channelGid:t,limit:r}=o,s={};r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,wo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/kv/${encodeURIComponent(t)}/keys`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/kv/{channelGid}/keys.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ho=k(require("url-join"));var Gn=class{static{u(this,"Sources")}_options;constructor(o){this._options=o}listSources(o){return g.fromPromise(this.__listSources(o))}async __listSources(o){let e=await(this._options.fetcher??P)({url:(0,ho.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/sources"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/sources.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getSource(o,e){return g.fromPromise(this.__getSource(o,e))}async __getSource(o,e){let{sourceGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ho.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/sources/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/sources/{sourceGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}removeSource(o,e){return g.fromPromise(this.__removeSource(o,e))}async __removeSource(o,e){let{sourceGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ho.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/sources/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/sources/{sourceGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}pauseSource(o,e){return g.fromPromise(this.__pauseSource(o,e))}async __pauseSource(o,e){let{sourceGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ho.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/sources/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/sources/{sourceGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resumeSource(o,e){return g.fromPromise(this.__resumeSource(o,e))}async __resumeSource(o,e){let{sourceGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ho.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/sources/${encodeURIComponent(t)}/resume`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/sources/{sourceGid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Mn=k(require("url-join"));var Un=class{static{u(this,"Queues")}_options;constructor(o){this._options=o}deleteMessage(o,e){return g.fromPromise(this.__deleteMessage(o,e))}async __deleteMessage(o,e){let{subscriptionGid:t,receiptHandle:r}=o,s=await(this._options.fetcher??P)({url:(0,Mn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/${encodeURIComponent(r)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/subscriptions/{subscriptionGid}/messages/{receiptHandle}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}changeMessageVisibility(o,e){return g.fromPromise(this.__changeMessageVisibility(o,e))}async __changeMessageVisibility(o,e){let{subscriptionGid:t,receiptHandle:r,...s}=o,n=await(this._options.fetcher??P)({url:(0,Mn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/${encodeURIComponent(r)}/visibility`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/messages/{receiptHandle}/visibility.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}receiveMessages(o,e){return g.fromPromise(this.__receiveMessages(o,e))}async __receiveMessages(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Mn.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/receive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/messages/receive.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ap=k(require("url-join"));var Hn=class{static{u(this,"QueueBatch")}_options;constructor(o){this._options=o}deleteMessageBatch(o,e){return g.fromPromise(this.__deleteMessageBatch(o,e))}async __deleteMessageBatch(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ap.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/batch-delete`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/messages/batch-delete.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}changeMessageVisibilityBatch(o,e){return g.fromPromise(this.__changeMessageVisibilityBatch(o,e))}async __changeMessageVisibilityBatch(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ap.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/messages/batch-visibility`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/messages/batch-visibility.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ip=k(require("url-join"));var Bn=class{static{u(this,"QueueQueries")}_options;constructor(o){this._options=o}getQueueInfo(o,e){return g.fromPromise(this.__getQueueInfo(o,e))}async __getQueueInfo(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ip.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/queue`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/queue.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listMessages(o,e){return g.fromPromise(this.__listMessages(o,e))}async __listMessages(o,e){let{subscriptionGid:t,limit:r}=o,s={};r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Ip.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/queue/messages`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/subscriptions/{subscriptionGid}/queue/messages.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Gp=k(require("url-join"));var qn=class{static{u(this,"QueueAdmin")}_options;constructor(o){this._options=o}updateQueueConfig(o,e){return g.fromPromise(this.__updateQueueConfig(o,e))}async __updateQueueConfig(o,e){let{subscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Gp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/queue/config`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/subscriptions/{subscriptionGid}/queue/config.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}purgeQueue(o,e){return g.fromPromise(this.__purgeQueue(o,e))}async __purgeQueue(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Gp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/subscriptions/${encodeURIComponent(t)}/queue/purge`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/subscriptions/{subscriptionGid}/queue/purge.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var mo=k(require("url-join"));var Ln=class{static{u(this,"SystemEvents")}_options;constructor(o){this._options=o}listCatalog(o){return g.fromPromise(this.__listCatalog(o))}async __listCatalog(o){let e=await(this._options.fetcher??P)({url:(0,mo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/system-events/catalog"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/system-events/catalog.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}subscribe(o,e){return g.fromPromise(this.__subscribe(o,e))}async __subscribe(o,e){let t=await(this._options.fetcher??P)({url:(0,mo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/system-events/subscriptions"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/system-events/subscriptions.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}unsubscribe(o,e){return g.fromPromise(this.__unsubscribe(o,e))}async __unsubscribe(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,mo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/system-events/subscriptions/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/system-events/subscriptions/{subscriptionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listDeliveries(o,e){return g.fromPromise(this.__listDeliveries(o,e))}async __listDeliveries(o,e){let{subscriptionGid:t,limit:r}=o,s={};r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,mo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/system-events/subscriptions/${encodeURIComponent(t)}/deliveries`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/system-events/subscriptions/{subscriptionGid}/deliveries.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}rotateSecret(o,e){return g.fromPromise(this.__rotateSecret(o,e))}async __rotateSecret(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,mo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/system-events/subscriptions/${encodeURIComponent(t)}/rotate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/system-events/subscriptions/{subscriptionGid}/rotate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Fn=class{static{u(this,"Events")}_options;_adapters;_channels;_deliveries;_dlq;_appDpopKeys;_catalogue;_messages;_subscriptions;_tieredStorage;_consumerGroups;_scheduling;_snapshots;_timeTravel;_archiveReplay;_observability;_channelDetail;_receipts;_security;_consume;_streams;_deliveryReceipts;_stats;_exactlyOnce;_exchanges;_transactional;_kvStore;_sources;_queues;_queueBatch;_queueQueries;_queueAdmin;_systemEvents;constructor(o){this._options=o}get adapters(){return this._adapters??=new on(this._options)}get channels(){return this._channels??=new sn(this._options)}get deliveries(){return this._deliveries??=new tn(this._options)}get dlq(){return this._dlq??=new nn(this._options)}get appDpopKeys(){return this._appDpopKeys??=new dn(this._options)}get catalogue(){return this._catalogue??=new pn(this._options)}get messages(){return this._messages??=new cn(this._options)}get subscriptions(){return this._subscriptions??=new un(this._options)}get tieredStorage(){return this._tieredStorage??=new ln(this._options)}get consumerGroups(){return this._consumerGroups??=new wn(this._options)}get scheduling(){return this._scheduling??=new hn(this._options)}get snapshots(){return this._snapshots??=new mn(this._options)}get timeTravel(){return this._timeTravel??=new yn(this._options)}get archiveReplay(){return this._archiveReplay??=new Rn(this._options)}get observability(){return this._observability??=new gn(this._options)}get channelDetail(){return this._channelDetail??=new Pn(this._options)}get receipts(){return this._receipts??=new bn(this._options)}get security(){return this._security??=new fn(this._options)}get consume(){return this._consume??=new Nn(this._options)}get streams(){return this._streams??=new En(this._options)}get deliveryReceipts(){return this._deliveryReceipts??=new Sn(this._options)}get stats(){return this._stats??=new _n(this._options)}get exactlyOnce(){return this._exactlyOnce??=new Tn(this._options)}get exchanges(){return this._exchanges??=new Cn(this._options)}get transactional(){return this._transactional??=new An(this._options)}get kvStore(){return this._kvStore??=new In(this._options)}get sources(){return this._sources??=new Gn(this._options)}get queues(){return this._queues??=new Un(this._options)}get queueBatch(){return this._queueBatch??=new Hn(this._options)}get queueQueries(){return this._queueQueries??=new Bn(this._options)}get queueAdmin(){return this._queueAdmin??=new qn(this._options)}get systemEvents(){return this._systemEvents??=new Ln(this._options)}};var Mp=k(require("url-join"));var Dn=class{static{u(this,"Customers")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{listingGid:t,status:r,cursor:s,limit:n}=o,p={};t!=null&&(p.listingGid=t),r!=null&&(p.status=r),s!=null&&(p.cursor=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,Mp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/customers"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/customers.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Mp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/customers/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/customers/{subscriptionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Z=k(require("url-join"));var zn=class{static{u(this,"Listings")}_options;constructor(o){this._options=o}enrichment(o){return g.fromPromise(this.__enrichment(o))}async __enrichment(o){let e=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/enrichment/listings"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/enrichment/listings.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}promise(o,e){return g.fromPromise(this.__promise(o,e))}async __promise(o,e){let{listingGid:t,at:r}=o,s={};r!=null&&(s.at=r.toString());let n=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/promise`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/listings/{listingGid}/promise.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}declarePromise(o,e){return g.fromPromise(this.__declarePromise(o,e))}async __declarePromise(o,e){let{listingGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/promise`),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/feeds/listings/{listingGid}/promise.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{listingGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/mirror/listings/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/mirror/listings/{listingGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listEligibleListingChannelApps(o){return g.fromPromise(this.__listEligibleListingChannelApps(o))}async __listEligibleListingChannelApps(o){let e=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/listing-eligible-apps"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/listing-eligible-apps.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listPublished(o={},e){return g.fromPromise(this.__listPublished(o,e))}async __listPublished(o={},e){let{limit:t,cursor:r,domain:s,category:n,priceTier:p,query:c,environment:N}=o,E={};t!=null&&(E.limit=t.toString()),r!=null&&(E.cursor=r),s!=null&&(E.domain=s),n!=null&&(E.category=n),p!=null&&(E.priceTier=p),c!=null&&(E.query=c),N!=null&&(E.environment=N);let S=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/listings"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:E,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(S.ok)return{data:S.body,rawResponse:S.rawResponse};if(S.error.reason==="status-code")switch(S.error.statusCode){case 400:throw new w(S.error.body,S.rawResponse);case 401:throw new h(S.error.body,S.rawResponse);case 403:throw new m(S.error.body,S.rawResponse);case 404:throw new y(S.error.body,S.rawResponse);case 429:throw new R(S.error.body,S.rawResponse);default:throw new a({statusCode:S.error.statusCode,body:S.error.body,rawResponse:S.rawResponse})}switch(S.error.reason){case"non-json":throw new a({statusCode:S.error.statusCode,body:S.error.rawBody,rawResponse:S.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/listings.");case"unknown":throw new a({message:S.error.errorMessage,rawResponse:S.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/listings"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getByGid(o,e){return g.fromPromise(this.__getByGid(o,e))}async __getByGid(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/listings/{gid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{listingGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}archive(o,e){return g.fromPromise(this.__archive(o,e))}async __archive(o,e){let{listingGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/feeds/listings/{listingGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updatePricing(o,e){return g.fromPromise(this.__updatePricing(o,e))}async __updatePricing(o,e){let{listingGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/pricing`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/pricing.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}publish(o,e){return g.fromPromise(this.__publish(o,e))}async __publish(o,e){let{listingGid:t,"Idempotency-Key":r}=o,s=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/publish`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/publish.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}submitForReview(o,e){return g.fromPromise(this.__submitForReview(o,e))}async __submitForReview(o,e){let{listingGid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/submit`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/submit.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}unpublish(o,e){return g.fromPromise(this.__unpublish(o,e))}async __unpublish(o,e){let{listingGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/unpublish`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/unpublish.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}withdrawSubmission(o,e){return g.fromPromise(this.__withdrawSubmission(o,e))}async __withdrawSubmission(o,e){let{listingGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/withdraw`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/withdraw.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}generateUploadUrl(o){return g.fromPromise(this.__generateUploadUrl(o))}async __generateUploadUrl(o){let e=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/listings/upload-url"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/upload-url.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}canCreateListing(o){return g.fromPromise(this.__canCreateListing(o))}async __canCreateListing(o){let e=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/publisher-eligibility"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/publisher-eligibility.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listByPublisherWire(o,e){return g.fromPromise(this.__listByPublisherWire(o,e))}async __listByPublisherWire(o,e){let{publisherGid:t,limit:r,cursor:s}=o,n={};r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/publishers/${encodeURIComponent(t)}/listings`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/publishers/{publisherGid}/listings.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getBySlug(o,e){return g.fromPromise(this.__getBySlug(o,e))}async __getBySlug(o,e){let{publisherSlug:t,listingSlug:r}=o,s=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/publishers/${encodeURIComponent(t)}/listings/${encodeURIComponent(r)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/publishers/{publisherSlug}/listings/{listingSlug}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}resolveByRef(o,e){return g.fromPromise(this.__resolveByRef(o,e))}async __resolveByRef(o,e){let{publisherSlug:t,listingSlug:r}=o,s=await(this._options.fetcher??P)({url:(0,Z.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/resolve/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/resolve/{publisherSlug}/{listingSlug}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ne=k(require("url-join"));var On=class{static{u(this,"Subscriptions")}_options;constructor(o){this._options=o}getEnrichmentForSubscriber(o={},e){return g.fromPromise(this.__getEnrichmentForSubscriber(o,e))}async __getEnrichmentForSubscriber(o={},e){let{subscriberOrgId:t}=o,r={};t!=null&&(r.subscriberOrgId=t);let s=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/enrichment/subscriptions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/enrichment/subscriptions.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getTrialStatus(o,e){return g.fromPromise(this.__getTrialStatus(o,e))}async __getTrialStatus(o,e){let{subscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/trial`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/subscriptions/{subscriptionGid}/trial.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}subscribe(o,e){return g.fromPromise(this.__subscribe(o,e))}async __subscribe(o,e){let{listingGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/subscribe`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/{listingGid}/subscribe.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}countByPublisher(o,e){return g.fromPromise(this.__countByPublisher(o,e))}async __countByPublisher(o,e){let{publisherGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/publishers/${encodeURIComponent(t)}/subscriber-count`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/publishers/{publisherGid}/subscriber-count.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBySubscriber(o={},e){return g.fromPromise(this.__listBySubscriber(o,e))}async __listBySubscriber(o={},e){let{status:t}=o,r={};t!=null&&(r.status=t);let s=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/subscriptions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/subscriptions.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getByGid(o,e){return g.fromPromise(this.__getByGid(o,e))}async __getByGid(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/subscriptions/{gid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancel(o,e){return g.fromPromise(this.__cancel(o,e))}async __cancel(o,e){let{gid:t,reason:r}=o,s={};r!=null&&(s.reason=r);let n=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/feeds/subscriptions/{gid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}convertTrialToPaid(o,e){return g.fromPromise(this.__convertTrialToPaid(o,e))}async __convertTrialToPaid(o,e){let{gid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/convert-to-paid`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/subscriptions/{gid}/convert-to-paid.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}pause(o,e){return g.fromPromise(this.__pause(o,e))}async __pause(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/subscriptions/{gid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}resume(o,e){return g.fromPromise(this.__resume(o,e))}async __resume(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/resume`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/subscriptions/{gid}/resume.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listBySubscriberEnriched(o){return g.fromPromise(this.__listBySubscriberEnriched(o))}async __listBySubscriberEnriched(o){let e=await(this._options.fetcher??P)({url:(0,Ne.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/subscriptions/enriched"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/subscriptions/enriched.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var zr=k(require("url-join"));var jn=class{static{u(this,"Reviews")}_options;constructor(o){this._options=o}listByListing(o,e){return g.fromPromise(this.__listByListing(o,e))}async __listByListing(o,e){let{listingGid:t,limit:r}=o,s={};r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,zr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/listings/${encodeURIComponent(t)}/reviews`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/listings/{listingGid}/reviews.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getListingStatsBatch(o,e){return g.fromPromise(this.__getListingStatsBatch(o,e))}async __getListingStatsBatch(o,e){let t=await(this._options.fetcher??P)({url:(0,zr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/listings/review-stats"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/listings/review-stats.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{reviewGid:t}=o,r=await(this._options.fetcher??P)({url:(0,zr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/reviews/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/reviews/{reviewGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}flagReview(o,e){return g.fromPromise(this.__flagReview(o,e))}async __flagReview(o,e){let{reviewGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,zr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/reviews/${encodeURIComponent(t)}/flag`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/reviews/{reviewGid}/flag.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}respondToReview(o,e){return g.fromPromise(this.__respondToReview(o,e))}async __respondToReview(o,e){let{reviewGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,zr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/reviews/${encodeURIComponent(t)}/respond`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/reviews/{reviewGid}/respond.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let{feedSubscriptionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,zr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/reviews`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/subscriptions/{feedSubscriptionGid}/reviews.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ye=k(require("url-join"));var Wn=class{static{u(this,"Publishers")}_options;constructor(o){this._options=o}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{publisherGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/mirror/publishers/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/mirror/publishers/{publisherGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listVerified(o={},e){return g.fromPromise(this.__listVerified(o,e))}async __listVerified(o={},e){let{limit:t}=o,r={};t!=null&&(r.limit=t.toString());let s=await(this._options.fetcher??P)({url:(0,Ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/publishers"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/publishers.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}register(o,e){return g.fromPromise(this.__register(o,e))}async __register(o,e){let t=await(this._options.fetcher??P)({url:(0,Ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/publishers"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/publishers.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getByGid(o,e){return g.fromPromise(this.__getByGid(o,e))}async __getByGid(o,e){let{gid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/publishers/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/publishers/{gid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{publisherGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/publishers/${encodeURIComponent(t)}`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/publishers/{publisherGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}revokePublisher(o,e){return g.fromPromise(this.__revokePublisher(o,e))}async __revokePublisher(o,e){let{publisherGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/publishers/${encodeURIComponent(t)}/revoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/feeds/publishers/{publisherGid}/revoke.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getBySlug(o,e){return g.fromPromise(this.__getBySlug(o,e))}async __getBySlug(o,e){let{slug:t}=o,r=await(this._options.fetcher??P)({url:(0,Ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/publishers/by-slug/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/publishers/by-slug/{slug}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getMine(o){return g.fromPromise(this.__getMine(o))}async __getMine(o){let e=await(this._options.fetcher??P)({url:(0,Ye.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/publishers/me"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/publishers/me.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var zh=k(require("url-join"));var $n=class{static{u(this,"PublisherReputation")}_options;constructor(o){this._options=o}getOwnReputation(o){return g.fromPromise(this.__getOwnReputation(o))}async __getOwnReputation(o){let e=await(this._options.fetcher??P)({url:(0,zh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/feeds/reputation/me"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/reputation/me.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Oh=k(require("url-join"));var Kn=class{static{u(this,"FeedDeliveryBindings")}_options;constructor(o){this._options=o}listBindings(o,e){return g.fromPromise(this.__listBindings(o,e))}async __listBindings(o,e){let{feedSubscriptionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Oh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/feeds/subscriptions/${encodeURIComponent(t)}/bindings`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/feeds/subscriptions/{feedSubscriptionGid}/bindings.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Vn=class{static{u(this,"Feed")}_options;_customers;_listings;_subscriptions;_reviews;_publishers;_publisherReputation;_feedDeliveryBindings;constructor(o){this._options=o}get customers(){return this._customers??=new Dn(this._options)}get listings(){return this._listings??=new zn(this._options)}get subscriptions(){return this._subscriptions??=new On(this._options)}get reviews(){return this._reviews??=new jn(this._options)}get publishers(){return this._publishers??=new Wn(this._options)}get publisherReputation(){return this._publisherReputation??=new $n(this._options)}get feedDeliveryBindings(){return this._feedDeliveryBindings??=new Kn(this._options)}};var jh=k(require("url-join"));var Jn=class{static{u(this,"Dispatches")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{appId:t,status:r,cursor:s,limit:n}=o,p={};p.appId=t,r!=null&&(p.status=r),s!==void 0&&(p.cursor=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,jh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/dispatches"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/notifications/dispatches.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ss=k(require("url-join"));var Qn=class{static{u(this,"Inbox")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{appId:t,user:r,status:s,cursor:n,limit:p}=o,c={};c.appId=t,c.user=r,s!=null&&(c.status=s),n!==void 0&&(c.cursor=n),p!=null&&(c.limit=p.toString());let N=await(this._options.fetcher??P)({url:(0,ss.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/inbox"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/notifications/inbox.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}archive(o,e){return g.fromPromise(this.__archive(o,e))}async __archive(o,e){let{gid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,ss.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/notifications/inbox/${encodeURIComponent(t)}/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/notifications/inbox/{gid}/archive.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}markRead(o,e){return g.fromPromise(this.__markRead(o,e))}async __markRead(o,e){let{gid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,ss.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/notifications/inbox/${encodeURIComponent(t)}/mark-read`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/notifications/inbox/{gid}/mark-read.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}markAllRead(o,e){return g.fromPromise(this.__markAllRead(o,e))}async __markAllRead(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ss.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/inbox/mark-all-read"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/notifications/inbox/mark-all-read.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Or=k(require("url-join"));var Yn=class{static{u(this,"Preferences")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{appId:t,user:r}=o,s={};s.appId=t,s.user=r;let n=await(this._options.fetcher??P)({url:(0,Or.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/preferences"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/notifications/preferences.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}upsert(o,e){return g.fromPromise(this.__upsert(o,e))}async __upsert(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Or.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/preferences"),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/notifications/preferences.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}clear(o,e){return g.fromPromise(this.__clear(o,e))}async __clear(o,e){let{appId:t,user:r,typeSlug:s,channel:n,"Idempotency-Key":p}=o,c={};c.appId=t,c.user=r,s!=null&&(c.typeSlug=s),n!=null&&(c.channel=n);let N=await(this._options.fetcher??P)({url:(0,Or.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/preferences"),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":p??void 0}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/notifications/preferences.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}setDigestCadence(o,e){return g.fromPromise(this.__setDigestCadence(o,e))}async __setDigestCadence(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Or.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/preferences/digest"),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/notifications/preferences/digest.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}setGlobalMute(o,e){return g.fromPromise(this.__setGlobalMute(o,e))}async __setGlobalMute(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Or.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/preferences/global-mute"),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/notifications/preferences/global-mute.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}setQuietHours(o,e){return g.fromPromise(this.__setQuietHours(o,e))}async __setQuietHours(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Or.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/preferences/quiet-hours"),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/notifications/preferences/quiet-hours.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Wh=k(require("url-join"));var Xn=class{static{u(this,"Summary")}_options;constructor(o){this._options=o}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{appId:t,user:r}=o,s={};s.appId=t,s.user=r;let n=await(this._options.fetcher??P)({url:(0,Wh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/notifications/summary.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var hr=k(require("url-join"));var Zn=class{static{u(this,"Templates")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{appId:t,typeSlug:r,includeRetired:s,limit:n}=o,p={};p.appId=t,r!=null&&(p.typeSlug=r),s!=null&&(p.includeRetired=s.toString()),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,hr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/templates"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/notifications/templates.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,hr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/templates"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/notifications/templates.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{gid:t,appId:r}=o,s={};s.appId=r;let n=await(this._options.fetcher??P)({url:(0,hr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/notifications/templates/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/notifications/templates/{gid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{gid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,hr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/notifications/templates/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/notifications/templates/{gid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}retire(o,e){return g.fromPromise(this.__retire(o,e))}async __retire(o,e){let{gid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,hr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/notifications/templates/${encodeURIComponent(t)}/retire`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/notifications/templates/{gid}/retire.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}sendTest(o,e){return g.fromPromise(this.__sendTest(o,e))}async __sendTest(o,e){let{gid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,hr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/notifications/templates/${encodeURIComponent(t)}/test-send`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/notifications/templates/{gid}/test-send.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}preview(o,e){return g.fromPromise(this.__preview(o,e))}async __preview(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,hr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/templates/preview"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/notifications/templates/preview.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Up=k(require("url-join"));var ea=class{static{u(this,"Types")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{appId:t,limit:r}=o,s={};s.appId=t,r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Up.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/notifications/types"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/notifications/types.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{typeSlug:t,appId:r,version:s}=o,n={};n.appId=r,s!=null&&(n.version=s.toString());let p=await(this._options.fetcher??P)({url:(0,Up.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/notifications/types/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/notifications/types/{typeSlug}.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ra=class{static{u(this,"Notify")}_options;_dispatches;_inbox;_preferences;_summary;_templates;_types;constructor(o){this._options=o}get dispatches(){return this._dispatches??=new Jn(this._options)}get inbox(){return this._inbox??=new Qn(this._options)}get preferences(){return this._preferences??=new Yn(this._options)}get summary(){return this._summary??=new Xn(this._options)}get templates(){return this._templates??=new Zn(this._options)}get types(){return this._types??=new ea(this._options)}};var Hp=k(require("url-join"));var oa=class{static{u(this,"AgentExecutions")}_options;constructor(o){this._options=o}listAgentExecutions(o={},e){return g.fromPromise(this.__listAgentExecutions(o,e))}async __listAgentExecutions(o={},e){let{workflowGid:t,limit:r,cursor:s}=o,n={};t!=null&&(n.workflowGid=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,Hp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/agent-executions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/agent-executions.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getAgentExecution(o,e){return g.fromPromise(this.__getAgentExecution(o,e))}async __getAgentExecution(o,e){let{agentExecutionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Hp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/agent-executions/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/agent-executions/{agentExecutionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Bp=k(require("url-join"));var sa=class{static{u(this,"Analyses")}_options;constructor(o){this._options=o}listAnalyses(o={},e){return g.fromPromise(this.__listAnalyses(o,e))}async __listAnalyses(o={},e){let{workflowGid:t,limit:r,cursor:s}=o,n={};t!=null&&(n.workflowGid=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,Bp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/analyses"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/analyses.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getAnalysis(o,e){return g.fromPromise(this.__getAnalysis(o,e))}async __getAnalysis(o,e){let{analysisGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Bp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/analyses/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/analyses/{analysisGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ee=k(require("url-join"));var ta=class{static{u(this,"Workflows")}_options;constructor(o){this._options=o}listConnectors(o={},e){return g.fromPromise(this.__listConnectors(o,e))}async __listConnectors(o={},e){let{limit:t,cursor:r}=o,s={};t!=null&&(s.limit=t.toString()),r!=null&&(s.cursor=r);let n=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/connectors"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/connectors.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listWorkflows(o={},e){return g.fromPromise(this.__listWorkflows(o,e))}async __listWorkflows(o={},e){let{limit:t,cursor:r}=o,s={};t!=null&&(s.limit=t.toString()),r!=null&&(s.cursor=r);let n=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/workflows"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/workflows.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}createWorkflow(o,e){return g.fromPromise(this.__createWorkflow(o,e))}async __createWorkflow(o,e){let t=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/workflows"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/workflows.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getWorkflow(o,e){return g.fromPromise(this.__getWorkflow(o,e))}async __getWorkflow(o,e){let{workflowGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/workflows/{workflowGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}deleteWorkflow(o,e){return g.fromPromise(this.__deleteWorkflow(o,e))}async __deleteWorkflow(o,e){let{workflowGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/pipes/workflows/{workflowGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWorkflow(o,e){return g.fromPromise(this.__updateWorkflow(o,e))}async __updateWorkflow(o,e){let{workflowGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/pipes/workflows/{workflowGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}activateWorkflow(o,e){return g.fromPromise(this.__activateWorkflow(o,e))}async __activateWorkflow(o,e){let{workflowGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/activate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/activate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}archiveWorkflow(o,e){return g.fromPromise(this.__archiveWorkflow(o,e))}async __archiveWorkflow(o,e){let{workflowGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWorkflowMeta(o,e){return g.fromPromise(this.__updateWorkflowMeta(o,e))}async __updateWorkflowMeta(o,e){let{workflowGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/meta`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/pipes/workflows/{workflowGid}/meta.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}pauseWorkflow(o,e){return g.fromPromise(this.__pauseWorkflow(o,e))}async __pauseWorkflow(o,e){let{workflowGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateWorkflowTriggerConfig(o,e){return g.fromPromise(this.__updateWorkflowTriggerConfig(o,e))}async __updateWorkflowTriggerConfig(o,e){let{workflowGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Ee.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/trigger-config`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/pipes/workflows/{workflowGid}/trigger-config.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var mr=k(require("url-join"));var na=class{static{u(this,"Connectors")}_options;constructor(o){this._options=o}listCredentials(o={},e){return g.fromPromise(this.__listCredentials(o,e))}async __listCredentials(o={},e){let{limit:t,cursor:r}=o,s={};t!=null&&(s.limit=t.toString()),r!=null&&(s.cursor=r);let n=await(this._options.fetcher??P)({url:(0,mr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/credentials"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/credentials.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}storeCredential(o,e){return g.fromPromise(this.__storeCredential(o,e))}async __storeCredential(o,e){let t=await(this._options.fetcher??P)({url:(0,mr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/credentials"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/credentials.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}deleteCredential(o,e){return g.fromPromise(this.__deleteCredential(o,e))}async __deleteCredential(o,e){let{credentialGid:t}=o,r=await(this._options.fetcher??P)({url:(0,mr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/credentials/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/pipes/credentials/{credentialGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}updateCredential(o,e){return g.fromPromise(this.__updateCredential(o,e))}async __updateCredential(o,e){let{credentialGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,mr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/credentials/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/pipes/credentials/{credentialGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}revokeCredential(o,e){return g.fromPromise(this.__revokeCredential(o,e))}async __revokeCredential(o,e){let{credentialGid:t}=o,r=await(this._options.fetcher??P)({url:(0,mr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/credentials/${encodeURIComponent(t)}/revoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/credentials/{credentialGid}/revoke.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rotateCredential(o,e){return g.fromPromise(this.__rotateCredential(o,e))}async __rotateCredential(o,e){let{credentialGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,mr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/credentials/${encodeURIComponent(t)}/rotate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/credentials/{credentialGid}/rotate.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}testCredentialPublic(o,e){return g.fromPromise(this.__testCredentialPublic(o,e))}async __testCredentialPublic(o,e){let t=await(this._options.fetcher??P)({url:(0,mr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/credentials/test"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/credentials/test.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ts=k(require("url-join"));var aa=class{static{u(this,"Decisions")}_options;constructor(o){this._options=o}listDecisions(o={},e){return g.fromPromise(this.__listDecisions(o,e))}async __listDecisions(o={},e){let{gateState:t,workflowGid:r,limit:s,cursor:n}=o,p={};t!=null&&(p.gateState=t),r!=null&&(p.workflowGid=r),s!=null&&(p.limit=s.toString()),n!=null&&(p.cursor=n);let c=await(this._options.fetcher??P)({url:(0,ts.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/decisions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/decisions.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}getDecision(o,e){return g.fromPromise(this.__getDecision(o,e))}async __getDecision(o,e){let{decisionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ts.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/decisions/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/decisions/{decisionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}approveDecision(o,e){return g.fromPromise(this.__approveDecision(o,e))}async __approveDecision(o,e){let{decisionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ts.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/decisions/${encodeURIComponent(t)}/approve`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/decisions/{decisionGid}/approve.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}rejectDecision(o,e){return g.fromPromise(this.__rejectDecision(o,e))}async __rejectDecision(o,e){let{decisionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ts.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/decisions/${encodeURIComponent(t)}/reject`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/decisions/{decisionGid}/reject.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ns=k(require("url-join"));var ia=class{static{u(this,"Dlq")}_options;constructor(o){this._options=o}listDlqEntries(o={},e){return g.fromPromise(this.__listDlqEntries(o,e))}async __listDlqEntries(o={},e){let{status:t,limit:r,cursor:s}=o,n={};t!=null&&(n.status=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,ns.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/dlq"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/dlq.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getDlqEntry(o,e){return g.fromPromise(this.__getDlqEntry(o,e))}async __getDlqEntry(o,e){let{dlqEntryId:t}=o,r=await(this._options.fetcher??P)({url:(0,ns.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/dlq/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/dlq/{dlqEntryId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}discardDlqEntry(o,e){return g.fromPromise(this.__discardDlqEntry(o,e))}async __discardDlqEntry(o,e){let{dlqEntryId:t}=o,r=await(this._options.fetcher??P)({url:(0,ns.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/dlq/${encodeURIComponent(t)}/discard`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/dlq/{dlqEntryId}/discard.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getDlqStats(o){return g.fromPromise(this.__getDlqStats(o))}async __getDlqStats(o){let e=await(this._options.fetcher??P)({url:(0,ns.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/dlq/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/dlq/stats.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var jr=k(require("url-join"));var da=class{static{u(this,"Executions")}_options;constructor(o){this._options=o}getExecution(o,e){return g.fromPromise(this.__getExecution(o,e))}async __getExecution(o,e){let{executionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,jr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/executions/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/executions/{executionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancelExecution(o,e){return g.fromPromise(this.__cancelExecution(o,e))}async __cancelExecution(o,e){let{executionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,jr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/executions/${encodeURIComponent(t)}/cancel`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/executions/{executionGid}/cancel.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getExecutionStatus(o,e){return g.fromPromise(this.__getExecutionStatus(o,e))}async __getExecutionStatus(o,e){let{executionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,jr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/executions/${encodeURIComponent(t)}/status`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/executions/{executionGid}/status.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listExecutions(o,e){return g.fromPromise(this.__listExecutions(o,e))}async __listExecutions(o,e){let{workflowGid:t,status:r,limit:s,cursor:n}=o,p={};r!=null&&(p.status=r),s!=null&&(p.limit=s.toString()),n!=null&&(p.cursor=n);let c=await(this._options.fetcher??P)({url:(0,jr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/executions`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/workflows/{workflowGid}/executions.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}executeNode(o,e){return g.fromPromise(this.__executeNode(o,e))}async __executeNode(o,e){let{workflowGid:t,nodeId:r,...s}=o,n=await(this._options.fetcher??P)({url:(0,jr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/nodes/${encodeURIComponent(r)}/execute`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/nodes/{nodeId}/execute.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}triggerExecution(o,e){return g.fromPromise(this.__triggerExecution(o,e))}async __triggerExecution(o,e){let{workflowGid:t,"Idempotency-Key":r,...s}=o,n=await(this._options.fetcher??P)({url:(0,jr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/workflows/${encodeURIComponent(t)}/trigger`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/workflows/{workflowGid}/trigger.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ue=k(require("url-join"));var pa=class{static{u(this,"Governance")}_options;constructor(o){this._options=o}getGovernanceSettings(o){return g.fromPromise(this.__getGovernanceSettings(o))}async __getGovernanceSettings(o){let e=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/governance.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}updateGovernanceSettings(o={},e){return g.fromPromise(this.__updateGovernanceSettings(o,e))}async __updateGovernanceSettings(o={},e){let t=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance"),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/pipes/governance.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}addToAllowlist(o,e){return g.fromPromise(this.__addToAllowlist(o,e))}async __addToAllowlist(o,e){let t=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance/allowlist"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/governance/allowlist.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}removeFromAllowlist(o={},e){return g.fromPromise(this.__removeFromAllowlist(o,e))}async __removeFromAllowlist(o={},e){let{connectorIds:t}=o,r={};t!=null&&(Array.isArray(t)?r.connectorIds=t.map(n=>n):r.connectorIds=t);let s=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance/allowlist"),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/pipes/governance/allowlist.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listApprovalRequests(o={},e){return g.fromPromise(this.__listApprovalRequests(o,e))}async __listApprovalRequests(o={},e){let{status:t,limit:r,cursor:s}=o,n={};t!=null&&(n.status=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance/approvals"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/governance/approvals.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}requestConnectorApproval(o,e){return g.fromPromise(this.__requestConnectorApproval(o,e))}async __requestConnectorApproval(o,e){let t=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance/approvals"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/governance/approvals.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}approveConnectorRequest(o,e){return g.fromPromise(this.__approveConnectorRequest(o,e))}async __approveConnectorRequest(o,e){let{requestId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/governance/approvals/${encodeURIComponent(t)}/approve`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/governance/approvals/{requestId}/approve.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}rejectConnectorRequest(o,e){return g.fromPromise(this.__rejectConnectorRequest(o,e))}async __rejectConnectorRequest(o,e){let{requestId:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/governance/approvals/${encodeURIComponent(t)}/reject`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/governance/approvals/{requestId}/reject.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listPendingApprovals(o={},e){return g.fromPromise(this.__listPendingApprovals(o,e))}async __listPendingApprovals(o={},e){let{limit:t,cursor:r}=o,s={};t!=null&&(s.limit=t.toString()),r!=null&&(s.cursor=r);let n=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance/approvals/pending"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/governance/approvals/pending.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listGovernanceAuditLogs(o={},e){return g.fromPromise(this.__listGovernanceAuditLogs(o,e))}async __listGovernanceAuditLogs(o={},e){let{limit:t,cursor:r,eventType:s,targetType:n,targetId:p,actorId:c}=o,N={};t!=null&&(N.limit=t.toString()),r!=null&&(N.cursor=r),s!=null&&(N.eventType=s),n!=null&&(N.targetType=n),p!=null&&(N.targetId=p),c!=null&&(N.actorId=c);let E=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance/audit"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:N,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(E.ok)return{data:E.body,rawResponse:E.rawResponse};if(E.error.reason==="status-code")switch(E.error.statusCode){case 400:throw new w(E.error.body,E.rawResponse);case 401:throw new h(E.error.body,E.rawResponse);case 403:throw new m(E.error.body,E.rawResponse);case 404:throw new y(E.error.body,E.rawResponse);case 429:throw new R(E.error.body,E.rawResponse);default:throw new a({statusCode:E.error.statusCode,body:E.error.body,rawResponse:E.rawResponse})}switch(E.error.reason){case"non-json":throw new a({statusCode:E.error.statusCode,body:E.error.rawBody,rawResponse:E.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/governance/audit.");case"unknown":throw new a({message:E.error.errorMessage,rawResponse:E.rawResponse})}}addToBlocklist(o,e){return g.fromPromise(this.__addToBlocklist(o,e))}async __addToBlocklist(o,e){let t=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance/blocklist"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/governance/blocklist.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}removeFromBlocklist(o={},e){return g.fromPromise(this.__removeFromBlocklist(o,e))}async __removeFromBlocklist(o={},e){let{connectorIds:t}=o,r={};t!=null&&(Array.isArray(t)?r.connectorIds=t.map(n=>n):r.connectorIds=t);let s=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/governance/blocklist"),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/pipes/governance/blocklist.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}revokeConnectorApproval(o,e){return g.fromPromise(this.__revokeConnectorApproval(o,e))}async __revokeConnectorApproval(o,e){let{connectorGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ue.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/governance/connectors/${encodeURIComponent(t)}/revoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/governance/connectors/{connectorGid}/revoke.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var yo=k(require("url-join"));var ca=class{static{u(this,"RecordDlq")}_options;constructor(o){this._options=o}listRecordDlq(o={},e){return g.fromPromise(this.__listRecordDlq(o,e))}async __listRecordDlq(o={},e){let{workflowGid:t,status:r,limit:s,cursor:n}=o,p={};t!=null&&(p.workflowGid=t),r!=null&&(p.status=r),s!=null&&(p.limit=s.toString()),n!=null&&(p.cursor=n);let c=await(this._options.fetcher??P)({url:(0,yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/record-dlq"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/record-dlq.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}getRecordDlqEntry(o,e){return g.fromPromise(this.__getRecordDlqEntry(o,e))}async __getRecordDlqEntry(o,e){let{entryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/record-dlq/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/record-dlq/{entryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}discardRecordDlqEntry(o,e){return g.fromPromise(this.__discardRecordDlqEntry(o,e))}async __discardRecordDlqEntry(o,e){let{entryGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/record-dlq/${encodeURIComponent(t)}/discard`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/record-dlq/{entryGid}/discard.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}replayRecordDlqEntry(o,e){return g.fromPromise(this.__replayRecordDlqEntry(o,e))}async __replayRecordDlqEntry(o,e){let{entryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/record-dlq/${encodeURIComponent(t)}/replay`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/record-dlq/{entryGid}/replay.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getRecordDlqStats(o={},e){return g.fromPromise(this.__getRecordDlqStats(o,e))}async __getRecordDlqStats(o={},e){let{workflowGid:t}=o,r={};t!=null&&(r.workflowGid=t);let s=await(this._options.fetcher??P)({url:(0,yo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/record-dlq/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/record-dlq/stats.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var qp=k(require("url-join"));var ua=class{static{u(this,"Tools")}_options;constructor(o){this._options=o}listTools(o={},e){return g.fromPromise(this.__listTools(o,e))}async __listTools(o={},e){let{stage:t,limit:r,cursor:s}=o,n={};t!=null&&(n.stage=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,qp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/tools"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/tools.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getTool(o,e){return g.fromPromise(this.__getTool(o,e))}async __getTool(o,e){let{toolName:t}=o,r=await(this._options.fetcher??P)({url:(0,qp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/tools/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/tools/{toolName}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var la=k(require("url-join"));var wa=class{static{u(this,"Watermarks")}_options;constructor(o){this._options=o}listWatermarks(o={},e){return g.fromPromise(this.__listWatermarks(o,e))}async __listWatermarks(o={},e){let{workflowGid:t,limit:r,cursor:s}=o,n={};t!=null&&(n.workflowGid=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,la.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/watermarks"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/watermarks.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}getWatermark(o,e){return g.fromPromise(this.__getWatermark(o,e))}async __getWatermark(o,e){let{sourceId:t,workflowGid:r}=o,s={};s.workflowGid=r;let n=await(this._options.fetcher??P)({url:(0,la.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/watermarks/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/watermarks/{sourceId}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}resetWatermark(o,e){return g.fromPromise(this.__resetWatermark(o,e))}async __resetWatermark(o,e){let{watermarkGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,la.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/watermarks/${encodeURIComponent(t)}/reset`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/watermarks/{watermarkGid}/reset.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ha=k(require("url-join"));var ma=class{static{u(this,"Webhooks")}_options;constructor(o){this._options=o}listWebhookWorkflows(o={},e){return g.fromPromise(this.__listWebhookWorkflows(o,e))}async __listWebhookWorkflows(o={},e){let{limit:t,cursor:r}=o,s={};t!=null&&(s.limit=t.toString()),r!=null&&(s.cursor=r);let n=await(this._options.fetcher??P)({url:(0,ha.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/pipes/webhook-triggers"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/webhook-triggers.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getTriggerUrl(o,e){return g.fromPromise(this.__getTriggerUrl(o,e))}async __getTriggerUrl(o,e){let{workflowGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ha.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/webhook-triggers/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/pipes/webhook-triggers/{workflowGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rotateWebhookSecret(o,e){return g.fromPromise(this.__rotateWebhookSecret(o,e))}async __rotateWebhookSecret(o,e){let{workflowGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ha.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/pipes/webhook-triggers/${encodeURIComponent(t)}/rotate-secret`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/pipes/webhook-triggers/{workflowGid}/rotate-secret.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ya=class{static{u(this,"Pipes")}_options;_agentExecutions;_analyses;_workflows;_connectors;_decisions;_dlq;_executions;_governance;_recordDlq;_tools;_watermarks;_webhooks;constructor(o){this._options=o}get agentExecutions(){return this._agentExecutions??=new oa(this._options)}get analyses(){return this._analyses??=new sa(this._options)}get workflows(){return this._workflows??=new ta(this._options)}get connectors(){return this._connectors??=new na(this._options)}get decisions(){return this._decisions??=new aa(this._options)}get dlq(){return this._dlq??=new ia(this._options)}get executions(){return this._executions??=new da(this._options)}get governance(){return this._governance??=new pa(this._options)}get recordDlq(){return this._recordDlq??=new ca(this._options)}get tools(){return this._tools??=new ua(this._options)}get watermarks(){return this._watermarks??=new wa(this._options)}get webhooks(){return this._webhooks??=new ma(this._options)}};var Wr=k(require("url-join"));var Ra=class{static{u(this,"AgentGoals")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{agentGid:t,status:r,limit:s}=o,n={};n.agentGid=t,r!=null&&(n.status=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,Wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/agent-goals"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/agent-goals.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,Wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/agent-goals"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agent-goals.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{goalGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agent-goals/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/agent-goals/{goalGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{goalGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agent-goals/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/agent-goals/{goalGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}recordProgress(o,e){return g.fromPromise(this.__recordProgress(o,e))}async __recordProgress(o,e){let{goalGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agent-goals/${encodeURIComponent(t)}/progress`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agent-goals/{goalGid}/progress.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}setStatus(o,e){return g.fromPromise(this.__setStatus(o,e))}async __setStatus(o,e){let{goalGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Wr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agent-goals/${encodeURIComponent(t)}/status`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agent-goals/{goalGid}/status.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Re=k(require("url-join"));var ga=class{static{u(this,"Agents")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{activeOnly:t,status:r,limit:s,cursor:n}=o,p={};t!=null&&(p.activeOnly=t.toString()),r!=null&&(p.status=r),s!=null&&(p.limit=s.toString()),n!=null&&(p.cursor=n);let c=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/agents"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/agents.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/agents"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agents.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{agentGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/agents/{agentGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{agentGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/agents/{agentGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{agentGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/agents/{agentGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}activate(o,e){return g.fromPromise(this.__activate(o,e))}async __activate(o,e){let{agentGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}/activate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/activate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}archive(o,e){return g.fromPromise(this.__archive(o,e))}async __archive(o,e){let{agentGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}invoke(o,e){return g.fromPromise(this.__invoke(o,e))}async __invoke(o,e){let{agentGid:t,traceparent:r,...s}=o,n=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}/invoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),traceparent:r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/invoke.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}pause(o,e){return g.fromPromise(this.__pause(o,e))}async __pause(o,e){let{agentGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}/pause`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/pause.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}run(o,e){return g.fromPromise(this.__run(o,e))}async __run(o,e){let{agentGid:t,traceparent:r,...s}=o,n=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}/run`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),traceparent:r??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/run.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}assignSkill(o,e){return g.fromPromise(this.__assignSkill(o,e))}async __assignSkill(o,e){let{agentGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}/skills/assign`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/skills/assign.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}unassignSkill(o,e){return g.fromPromise(this.__unassignSkill(o,e))}async __unassignSkill(o,e){let{agentGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Re.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/agents/${encodeURIComponent(t)}/skills/unassign`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/agents/{agentGid}/skills/unassign.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ze=k(require("url-join"));var Pa=class{static{u(this,"Approvals")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{status:t}=o,r={};t!=null&&(r.status=t);let s=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/approvals"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/approvals.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/approvals"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/approvals.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{approvalGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/approvals/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/approvals/{approvalGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}approve(o,e){return g.fromPromise(this.__approve(o,e))}async __approve(o,e){let{approvalGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/approvals/${encodeURIComponent(t)}/approve`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/approvals/{approvalGid}/approve.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}reject(o,e){return g.fromPromise(this.__reject(o,e))}async __reject(o,e){let{approvalGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/approvals/${encodeURIComponent(t)}/reject`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/approvals/{approvalGid}/reject.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listByAgent(o,e){return g.fromPromise(this.__listByAgent(o,e))}async __listByAgent(o,e){let{agentGid:t,pendingOnly:r}=o,s={};s.agentGid=t,r!=null&&(s.pendingOnly=r.toString());let n=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/approvals/by-agent"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/approvals/by-agent.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listPending(o){return g.fromPromise(this.__listPending(o))}async __listPending(o){let e=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/approvals/pending"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/approvals/pending.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}pendingCount(o){return g.fromPromise(this.__pendingCount(o))}async __pendingCount(o){let e=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/approvals/pending/count"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/approvals/pending/count.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getPendingSummary(o){return g.fromPromise(this.__getPendingSummary(o))}async __getPendingSummary(o){let e=await(this._options.fetcher??P)({url:(0,ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/approvals/pending/summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/approvals/pending/summary.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var yr=k(require("url-join"));var ba=class{static{u(this,"BrainConfig")}_options;constructor(o){this._options=o}getConfig(o){return g.fromPromise(this.__getConfig(o))}async __getConfig(o){let e=await(this._options.fetcher??P)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/config"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/brain/config.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}configure(o,e){return g.fromPromise(this.__configure(o,e))}async __configure(o,e){let t=await(this._options.fetcher??P)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/config"),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/primus/brain/config.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}deleteConfig(o){return g.fromPromise(this.__deleteConfig(o))}async __deleteConfig(o){let e=await(this._options.fetcher??P)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/config"),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/brain/config.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getLlmDashboard(o){return g.fromPromise(this.__getLlmDashboard(o))}async __getLlmDashboard(o){let e=await(this._options.fetcher??P)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/llm-dashboard"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/brain/llm-dashboard.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}storeProviderKey(o,e){return g.fromPromise(this.__storeProviderKey(o,e))}async __storeProviderKey(o,e){let t=await(this._options.fetcher??P)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/provider-keys"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/brain/provider-keys.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listProviderModels(o,e){return g.fromPromise(this.__listProviderModels(o,e))}async __listProviderModels(o,e){let t=await(this._options.fetcher??P)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/provider-models"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/brain/provider-models.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getUsageDashboard(o={},e){return g.fromPromise(this.__getUsageDashboard(o,e))}async __getUsageDashboard(o={},e){let{range:t}=o,r={};t!=null&&(r.range=t);let s=await(this._options.fetcher??P)({url:(0,yr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/usage-dashboard"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/brain/usage-dashboard.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Lp=k(require("url-join"));var fa=class{static{u(this,"BrainModels")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{provider:t}=o,r={};t!=null&&(r.provider=t);let s=await(this._options.fetcher??P)({url:(0,Lp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/models"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/brain/models.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}refresh(o={},e){return g.fromPromise(this.__refresh(o,e))}async __refresh(o={},e){let t=await(this._options.fetcher??P)({url:(0,Lp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/brain/models/refresh"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/brain/models/refresh.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Fp=k(require("url-join"));var va=class{static{u(this,"ConfigPromotion")}_options;constructor(o){this._options=o}applyConfigBundle(o,e){return g.fromPromise(this.__applyConfigBundle(o,e))}async __applyConfigBundle(o,e){let t=await(this._options.fetcher??P)({url:(0,Fp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/config/apply"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/config/apply.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}exportConfig(o){return g.fromPromise(this.__exportConfig(o))}async __exportConfig(o){let e=await(this._options.fetcher??P)({url:(0,Fp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/config/export"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/config/export.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Oe=k(require("url-join"));var Na=class{static{u(this,"Conversations")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{status:t,limit:r,cursor:s}=o,n={};t!=null&&(n.status=t),r!=null&&(n.limit=r.toString()),s!=null&&(n.cursor=s);let p=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/conversations"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/conversations.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/conversations"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/conversations.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{conversationGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/conversations/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/conversations/{conversationGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{conversationGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/conversations/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/conversations/{conversationGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{conversationGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/conversations/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/conversations/{conversationGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}archive(o,e){return g.fromPromise(this.__archive(o,e))}async __archive(o,e){let{conversationGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/conversations/${encodeURIComponent(t)}/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/conversations/{conversationGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWithMessages(o,e){return g.fromPromise(this.__getWithMessages(o,e))}async __getWithMessages(o,e){let{conversationGid:t,messageLimit:r}=o,s={};r!=null&&(s.messageLimit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/conversations/${encodeURIComponent(t)}/messages`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/conversations/{conversationGid}/messages.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listByAgent(o,e){return g.fromPromise(this.__listByAgent(o,e))}async __listByAgent(o,e){let{agentGid:t,includeArchived:r}=o,s={};s.agentGid=t,r!=null&&(s.includeArchived=r.toString());let n=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/conversations/by-agent"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/conversations/by-agent.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listWithStats(o={},e){return g.fromPromise(this.__listWithStats(o,e))}async __listWithStats(o={},e){let{status:t,limit:r}=o,s={};t!=null&&(s.status=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Oe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/conversations/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/conversations/stats.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Dp=k(require("url-join"));var Ea=class{static{u(this,"Actions")}_options;constructor(o){this._options=o}send(o,e){return g.fromPromise(this.__send(o,e))}async __send(o,e){let{conversationGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Dp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/conversations/${encodeURIComponent(t)}/send`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/conversations/{conversationGid}/send.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}testFire(o,e){return g.fromPromise(this.__testFire(o,e))}async __testFire(o,e){let{triggerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Dp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/triggers/${encodeURIComponent(t)}/test-fire`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/triggers/{triggerGid}/test-fire.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Sa=k(require("url-join"));var _a=class{static{u(this,"Delegations")}_options;constructor(o){this._options=o}listByDelegate(o,e){return g.fromPromise(this.__listByDelegate(o,e))}async __listByDelegate(o,e){let{agentGid:t,limit:r}=o,s={};s.agentGid=t,r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Sa.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/delegations/by-delegate"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/delegations/by-delegate.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listByDelegator(o,e){return g.fromPromise(this.__listByDelegator(o,e))}async __listByDelegator(o,e){let{agentGid:t,limit:r}=o,s={};s.agentGid=t,r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Sa.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/delegations/by-delegator"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/delegations/by-delegator.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listByTeam(o,e){return g.fromPromise(this.__listByTeam(o,e))}async __listByTeam(o,e){let{teamGid:t,limit:r}=o,s={};s.teamGid=t,r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Sa.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/delegations/by-team"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/delegations/by-team.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var $h=k(require("url-join"));var ka=class{static{u(this,"Entitlements")}_options;constructor(o){this._options=o}retrieve(o){return g.fromPromise(this.__retrieve(o))}async __retrieve(o){let e=await(this._options.fetcher??P)({url:(0,$h.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/entitlements"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/entitlements.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ae=k(require("url-join"));var Ta=class{static{u(this,"Execution")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{agentGid:t,status:r,includeLeadRuns:s,limit:n}=o,p={};t!=null&&(p.agentGid=t),r!=null&&(p.status=r),s!=null&&(p.includeLeadRuns=s.toString()),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/executions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/executions"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/executions.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{executionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/executions/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions/{executionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}approve(o,e){return g.fromPromise(this.__approve(o,e))}async __approve(o,e){let{executionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/executions/${encodeURIComponent(t)}/approve`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/executions/{executionGid}/approve.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}cancel(o,e){return g.fromPromise(this.__cancel(o,e))}async __cancel(o,e){let{executionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/executions/${encodeURIComponent(t)}/cancel`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/executions/{executionGid}/cancel.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getDetails(o,e){return g.fromPromise(this.__getDetails(o,e))}async __getDetails(o,e){let{executionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/executions/${encodeURIComponent(t)}/details`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions/{executionGid}/details.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}streamEvents(o,e){return g.fromPromise(this.__streamEvents(o,e))}async __streamEvents(o,e){let{executionGid:t,afterSequence:r}=o,s={};r!=null&&(s.afterSequence=r.toString());let n=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/executions/${encodeURIComponent(t)}/events`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions/{executionGid}/events.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}reject(o,e){return g.fromPromise(this.__reject(o,e))}async __reject(o,e){let{executionGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/executions/${encodeURIComponent(t)}/reject`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/executions/{executionGid}/reject.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}traces(o,e){return g.fromPromise(this.__traces(o,e))}async __traces(o,e){let{executionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/executions/${encodeURIComponent(t)}/traces`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions/{executionGid}/traces.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}createBatch(o,e){return g.fromPromise(this.__createBatch(o,e))}async __createBatch(o,e){let t=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/executions/batch"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/executions/batch.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listByAgent(o,e){return g.fromPromise(this.__listByAgent(o,e))}async __listByAgent(o,e){let{agentGid:t,status:r,limit:s}=o,n={};n.agentGid=t,r!=null&&(n.status=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/executions/by-agent"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions/by-agent.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listByConversation(o,e){return g.fromPromise(this.__listByConversation(o,e))}async __listByConversation(o,e){let{conversationGid:t,limit:r}=o,s={};s.conversationGid=t,r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/executions/by-conversation"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions/by-conversation.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getPendingApprovals(o={},e){return g.fromPromise(this.__getPendingApprovals(o,e))}async __getPendingApprovals(o={},e){let{agentGid:t}=o,r={};t!=null&&(r.agentGid=t);let s=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/executions/pending-approvals"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions/pending-approvals.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getStats(o={},e){return g.fromPromise(this.__getStats(o,e))}async __getStats(o={},e){let{agentGid:t,timeRange:r}=o,s={};t!=null&&(s.agentGid=t),r!=null&&(s.timeRange=r.toString());let n=await(this._options.fetcher??P)({url:(0,ae.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/executions/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/executions/stats.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var zp=k(require("url-join"));var Ca=class{static{u(this,"GuardrailOutcomes")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{agentGid:t,limit:r}=o,s={};t!=null&&(s.agentGid=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,zp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/guardrails/outcomes"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/guardrails/outcomes.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{outcomeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,zp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/guardrails/outcomes/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/guardrails/outcomes/{outcomeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ro=k(require("url-join"));var xa=class{static{u(this,"Integrations")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{status:t,activeOnly:r}=o,s={};t!=null&&(s.status=t),r!=null&&(s.activeOnly=r.toString());let n=await(this._options.fetcher??P)({url:(0,Ro.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/integrations"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/integrations.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{connectionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ro.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/integrations/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/integrations/{connectionGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}disconnect(o,e){return g.fromPromise(this.__disconnect(o,e))}async __disconnect(o,e){let{connectionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ro.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/integrations/${encodeURIComponent(t)}/disconnect`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/integrations/{connectionGid}/disconnect.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}refresh(o,e){return g.fromPromise(this.__refresh(o,e))}async __refresh(o,e){let{connectionGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ro.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/integrations/${encodeURIComponent(t)}/refresh`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/integrations/{connectionGid}/refresh.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}connect(o,e){return g.fromPromise(this.__connect(o,e))}async __connect(o,e){let t=await(this._options.fetcher??P)({url:(0,Ro.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/integrations/connect"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/integrations/connect.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Rr=k(require("url-join"));var Aa=class{static{u(this,"KillSwitch")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{level:t,agentGid:r}=o,s={};t!=null&&(s.level=t),r!=null&&(s.agentGid=r);let n=await(this._options.fetcher??P)({url:(0,Rr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/kill-switch"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/kill-switch.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{killSwitchGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Rr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/kill-switch/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/kill-switch/{killSwitchGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}activate(o,e){return g.fromPromise(this.__activate(o,e))}async __activate(o,e){let t=await(this._options.fetcher??P)({url:(0,Rr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/kill-switch/activate"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/kill-switch/activate.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listActive(o){return g.fromPromise(this.__listActive(o))}async __listActive(o){let e=await(this._options.fetcher??P)({url:(0,Rr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/kill-switch/active"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/kill-switch/active.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}checkBlocking(o,e){return g.fromPromise(this.__checkBlocking(o,e))}async __checkBlocking(o,e){let{agentGid:t}=o,r={};r.agentGid=t;let s=await(this._options.fetcher??P)({url:(0,Rr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/kill-switch/check"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/kill-switch/check.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}deactivate(o,e){return g.fromPromise(this.__deactivate(o,e))}async __deactivate(o,e){let t=await(this._options.fetcher??P)({url:(0,Rr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/kill-switch/deactivate"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/kill-switch/deactivate.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}status(o={},e){return g.fromPromise(this.__status(o,e))}async __status(o={},e){let{agentGid:t}=o,r={};t!=null&&(r.agentGid=t);let s=await(this._options.fetcher??P)({url:(0,Rr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/kill-switch/status"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/kill-switch/status.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var je=k(require("url-join"));var Ia=class{static{u(this,"Learning")}_options;constructor(o){this._options=o}listFeedback(o={},e){return g.fromPromise(this.__listFeedback(o,e))}async __listFeedback(o={},e){let{agentGid:t,limit:r}=o,s={};t!=null&&(s.agentGid=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/feedback"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/learning/feedback.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}submitFeedback(o,e){return g.fromPromise(this.__submitFeedback(o,e))}async __submitFeedback(o,e){let t=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/feedback"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/learning/feedback.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listFeedbackByAgent(o,e){return g.fromPromise(this.__listFeedbackByAgent(o,e))}async __listFeedbackByAgent(o,e){let{agentGid:t,timeRange:r,limit:s}=o,n={};n.agentGid=t,r!=null&&(n.timeRange=r.toString()),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/feedback/by-agent"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/learning/feedback/by-agent.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listPatterns(o={},e){return g.fromPromise(this.__listPatterns(o,e))}async __listPatterns(o={},e){let{agentGid:t,type:r,limit:s}=o,n={};t!=null&&(n.agentGid=t),r!=null&&(n.type=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/patterns"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/learning/patterns.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listPatternsByAgent(o,e){return g.fromPromise(this.__listPatternsByAgent(o,e))}async __listPatternsByAgent(o,e){let{agentGid:t,timeRange:r,type:s,limit:n}=o,p={};p.agentGid=t,r!=null&&(p.timeRange=r.toString()),s!=null&&(p.type=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/patterns/by-agent"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/learning/patterns/by-agent.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}setPatternActive(o,e){return g.fromPromise(this.__setPatternActive(o,e))}async __setPatternActive(o,e){let t=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/patterns/set-active"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/learning/patterns/set-active.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}listPredictions(o,e){return g.fromPromise(this.__listPredictions(o,e))}async __listPredictions(o,e){let{agentGid:t,status:r,limit:s}=o,n={};n.agentGid=t,r!=null&&(n.status=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/predictions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/learning/predictions.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listProactiveActions(o,e){return g.fromPromise(this.__listProactiveActions(o,e))}async __listProactiveActions(o,e){let{agentGid:t,status:r,limit:s}=o,n={};n.agentGid=t,r!=null&&(n.status=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/proactive-actions"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/learning/proactive-actions.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}decideProactiveAction(o,e){return g.fromPromise(this.__decideProactiveAction(o,e))}async __decideProactiveAction(o,e){let t=await(this._options.fetcher??P)({url:(0,je.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/proactive-actions/decide"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/learning/proactive-actions/decide.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Kh=k(require("url-join"));var Ga=class{static{u(this,"Stats")}_options;constructor(o){this._options=o}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{agentGid:t,timeRange:r}=o,s={};s.agentGid=t,r!=null&&(s.timeRange=r.toString());let n=await(this._options.fetcher??P)({url:(0,Kh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/learning/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/learning/stats.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ma=k(require("url-join"));var Ua=class{static{u(this,"McpConnect")}_options;constructor(o){this._options=o}listConnections(o){return g.fromPromise(this.__listConnections(o))}async __listConnections(o){let e=await(this._options.fetcher??P)({url:(0,Ma.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/mcp-connections"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/mcp-connections.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}revokeConnection(o,e){return g.fromPromise(this.__revokeConnection(o,e))}async __revokeConnection(o,e){let{credentialGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ma.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-connections/${encodeURIComponent(t)}/revoke`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-connections/{credentialGid}/revoke.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}beginConnect(o,e){return g.fromPromise(this.__beginConnect(o,e))}async __beginConnect(o,e){let{mcpServerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ma.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/connect/begin`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/connect/begin.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Xe=k(require("url-join"));var Ha=class{static{u(this,"McpServers")}_options;constructor(o){this._options=o}list(o){return g.fromPromise(this.__list(o))}async __list(o){let e=await(this._options.fetcher??P)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/mcp-servers"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/mcp-servers.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}connect(o,e){return g.fromPromise(this.__connect(o,e))}async __connect(o,e){let t=await(this._options.fetcher??P)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/mcp-servers"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{mcpServerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/mcp-servers/{mcpServerGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}disconnect(o,e){return g.fromPromise(this.__disconnect(o,e))}async __disconnect(o,e){let{mcpServerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/disconnect`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/disconnect.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}reconnect(o,e){return g.fromPromise(this.__reconnect(o,e))}async __reconnect(o,e){let{mcpServerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/reconnect`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/reconnect.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rename(o,e){return g.fromPromise(this.__rename(o,e))}async __rename(o,e){let{mcpServerGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/rename`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/rename.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}rotateAuth(o,e){return g.fromPromise(this.__rotateAuth(o,e))}async __rotateAuth(o,e){let{mcpServerGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/rotate-auth`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/rotate-auth.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}test(o,e){return g.fromPromise(this.__test(o,e))}async __test(o,e){let t=await(this._options.fetcher??P)({url:(0,Xe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/mcp-servers/test"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers/test.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Op=k(require("url-join"));var Ba=class{static{u(this,"McpOauth")}_options;constructor(o){this._options=o}beginOauth(o,e){return g.fromPromise(this.__beginOauth(o,e))}async __beginOauth(o,e){let{mcpServerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Op.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/oauth/begin`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/oauth/begin.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}setPreregisteredClient(o,e){return g.fromPromise(this.__setPreregisteredClient(o,e))}async __setPreregisteredClient(o,e){let{mcpServerGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Op.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/mcp-servers/${encodeURIComponent(t)}/oauth/client`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/mcp-servers/{mcpServerGid}/oauth/client.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var qa=k(require("url-join"));var La=class{static{u(this,"MemoriesEncrypted")}_options;constructor(o){this._options=o}decryptMemory(o,e){return g.fromPromise(this.__decryptMemory(o,e))}async __decryptMemory(o,e){let{memoryGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,qa.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memories/${encodeURIComponent(t)}/decrypt`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/memories/{memoryGid}/decrypt.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getEncryption(o,e){return g.fromPromise(this.__getEncryption(o,e))}async __getEncryption(o,e){let{memoryGid:t,revealNonce:r}=o,s={};r!=null&&(s.revealNonce=r.toString());let n=await(this._options.fetcher??P)({url:(0,qa.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memories/${encodeURIComponent(t)}/encryption`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memories/{memoryGid}/encryption.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}reencrypt(o,e){return g.fromPromise(this.__reencrypt(o,e))}async __reencrypt(o,e){let{memoryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,qa.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memories/${encodeURIComponent(t)}/reencrypt`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/memories/{memoryGid}/reencrypt.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Be=k(require("url-join"));var Fa=class{static{u(this,"Memories")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{type:t,limit:r}=o,s={};t!=null&&(s.type=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/memory.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{memoryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memory/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/{memoryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{memoryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memory/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/memory/{memoryGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{memoryGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memory/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/memory/{memoryGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}quarantine(o,e){return g.fromPromise(this.__quarantine(o,e))}async __quarantine(o,e){let{memoryGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memory/${encodeURIComponent(t)}/quarantine`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/memory/{memoryGid}/quarantine.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}unquarantine(o,e){return g.fromPromise(this.__unquarantine(o,e))}async __unquarantine(o,e){let{memoryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memory/${encodeURIComponent(t)}/unquarantine`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/memory/{memoryGid}/unquarantine.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listByAgent(o,e){return g.fromPromise(this.__listByAgent(o,e))}async __listByAgent(o,e){let{agentGid:t,type:r,limit:s}=o,n={};n.agentGid=t,r!=null&&(n.type=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/by-agent"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/by-agent.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listByConversation(o,e){return g.fromPromise(this.__listByConversation(o,e))}async __listByConversation(o,e){let{conversationGid:t}=o,r={};r.conversationGid=t;let s=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/by-conversation"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/by-conversation.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listQuarantined(o){return g.fromPromise(this.__listQuarantined(o))}async __listQuarantined(o){let e=await(this._options.fetcher??P)({url:(0,Be.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/quarantined"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/quarantined.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Ze=k(require("url-join"));var Da=class{static{u(this,"Memory")}_options;constructor(o){this._options=o}recall(o,e){return g.fromPromise(this.__recall(o,e))}async __recall(o,e){let{agentGid:t,query:r,type:s,limit:n,cursor:p}=o,c={};c.agentGid=t,r!=null&&(c.query=r),s!=null&&(c.type=s),n!=null&&(c.limit=n.toString()),p!=null&&(c.cursor=p);let N=await(this._options.fetcher??P)({url:(0,Ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/recall"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/recall.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}store(o,e){return g.fromPromise(this.__store(o,e))}async __store(o,e){let t=await(this._options.fetcher??P)({url:(0,Ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/store"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/memory/store.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getLineage(o,e){return g.fromPromise(this.__getLineage(o,e))}async __getLineage(o,e){let{memoryGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memory/store/${encodeURIComponent(t)}/lineage`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/store/{memoryGid}/lineage.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getRetrievalHistory(o,e){return g.fromPromise(this.__getRetrievalHistory(o,e))}async __getRetrievalHistory(o,e){let{memoryGid:t,days:r}=o,s={};r!=null&&(s.days=r.toString());let n=await(this._options.fetcher??P)({url:(0,Ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/memory/store/${encodeURIComponent(t)}/retrieval-history`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/store/{memoryGid}/retrieval-history.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listByTeam(o,e){return g.fromPromise(this.__listByTeam(o,e))}async __listByTeam(o,e){let{teamGid:t,limit:r}=o,s={};s.teamGid=t,r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/store/by-team"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/store/by-team.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{type:t,limit:r}=o,s={};t!=null&&(s.type=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/store/list"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/store/list.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getQuarantineSummary(o){return g.fromPromise(this.__getQuarantineSummary(o))}async __getQuarantineSummary(o){let e=await(this._options.fetcher??P)({url:(0,Ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/store/quarantine-summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/store/quarantine-summary.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}listQuarantined(o={},e){return g.fromPromise(this.__listQuarantined(o,e))}async __listQuarantined(o={},e){let{limit:t}=o,r={};t!=null&&(r.limit=t.toString());let s=await(this._options.fetcher??P)({url:(0,Ze.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/store/quarantined"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/memory/store/quarantined.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var jp=k(require("url-join"));var za=class{static{u(this,"Rag")}_options;constructor(o){this._options=o}searchDualAuth(o,e){return g.fromPromise(this.__searchDualAuth(o,e))}async __searchDualAuth(o,e){let t=await(this._options.fetcher??P)({url:(0,jp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/search"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/memory/search.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}searchExplainDualAuth(o,e){return g.fromPromise(this.__searchExplainDualAuth(o,e))}async __searchExplainDualAuth(o,e){let t=await(this._options.fetcher??P)({url:(0,jp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/memory/search/explain"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/memory/search/explain.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ge=k(require("url-join"));var Oa=class{static{u(this,"Observability")}_options;constructor(o){this._options=o}getMetrics(o,e){return g.fromPromise(this.__getMetrics(o,e))}async __getMetrics(o,e){let{name:t,startTime:r,endTime:s,agentGid:n,labels:p}=o,c={};c.name=t,c.startTime=r.toString(),s!=null&&(c.endTime=s.toString()),n!=null&&(c.agentGid=n),p!=null&&(c.labels=ur(p));let N=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/metrics"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/metrics.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}aggregateMetrics(o,e){return g.fromPromise(this.__aggregateMetrics(o,e))}async __aggregateMetrics(o,e){let{name:t,startTime:r,endTime:s,aggregation:n,groupBy:p}=o,c={};c.name=t,c.startTime=r.toString(),s!=null&&(c.endTime=s.toString()),c.aggregation=n,p!=null&&(c.groupBy=p);let N=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/metrics/aggregate"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/metrics/aggregate.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}getSystemMetrics(o){return g.fromPromise(this.__getSystemMetrics(o))}async __getSystemMetrics(o){let e=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/metrics/system"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/metrics/system.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getActiveAlerts(o={},e){return g.fromPromise(this.__getActiveAlerts(o,e))}async __getActiveAlerts(o={},e){let{severity:t}=o,r={};t!=null&&(r.severity=t);let s=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/observability/alerts"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/observability/alerts.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}acknowledgeAlert(o,e){return g.fromPromise(this.__acknowledgeAlert(o,e))}async __acknowledgeAlert(o,e){let t=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/observability/alerts/acknowledge"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/observability/alerts/acknowledge.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}resolveAlert(o,e){return g.fromPromise(this.__resolveAlert(o,e))}async __resolveAlert(o,e){let t=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/observability/alerts/resolve"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/observability/alerts/resolve.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getErrors(o={},e){return g.fromPromise(this.__getErrors(o,e))}async __getErrors(o={},e){let{status:t,limit:r}=o,s={};t!=null&&(s.status=t),r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/observability/errors"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/observability/errors.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}listErrorsByAgent(o,e){return g.fromPromise(this.__listErrorsByAgent(o,e))}async __listErrorsByAgent(o,e){let{agentGid:t,status:r,limit:s}=o,n={};n.agentGid=t,r!=null&&(n.status=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/observability/errors/by-agent"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/observability/errors/by-agent.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}listErrorsByExecution(o,e){return g.fromPromise(this.__listErrorsByExecution(o,e))}async __listErrorsByExecution(o,e){let{executionGid:t,limit:r}=o,s={};s.executionGid=t,r!=null&&(s.limit=r.toString());let n=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/observability/errors/by-execution"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/observability/errors/by-execution.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getErrorDistribution(o,e){return g.fromPromise(this.__getErrorDistribution(o,e))}async __getErrorDistribution(o,e){let{startTime:t,endTime:r,byField:s,limit:n}=o,p={};p.startTime=t.toString(),r!=null&&(p.endTime=r.toString()),s!=null&&(p.byField=s),n!=null&&(p.limit=n.toString());let c=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/observability/errors/distribution"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/observability/errors/distribution.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}resolveError(o,e){return g.fromPromise(this.__resolveError(o,e))}async __resolveError(o,e){let t=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/observability/errors/resolve"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/observability/errors/resolve.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getTrace(o,e){return g.fromPromise(this.__getTrace(o,e))}async __getTrace(o,e){let{traceId:t}=o,r=await(this._options.fetcher??P)({url:(0,ge.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/observability/traces/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/observability/traces/{traceId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var go=k(require("url-join"));var ja=class{static{u(this,"Overview")}_options;constructor(o){this._options=o}getActiveTriggers(o={},e){return g.fromPromise(this.__getActiveTriggers(o,e))}async __getActiveTriggers(o={},e){let{limit:t}=o,r={};t!=null&&(r.limit=t.toString());let s=await(this._options.fetcher??P)({url:(0,go.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/overview/active-triggers"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/overview/active-triggers.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getMemoryHealth(o){return g.fromPromise(this.__getMemoryHealth(o))}async __getMemoryHealth(o){let e=await(this._options.fetcher??P)({url:(0,go.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/overview/memory-health"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/overview/memory-health.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getMetricsSummary(o){return g.fromPromise(this.__getMetricsSummary(o))}async __getMetricsSummary(o){let e=await(this._options.fetcher??P)({url:(0,go.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/overview/metrics-summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/overview/metrics-summary.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getStats(o){return g.fromPromise(this.__getStats(o))}async __getStats(o){let e=await(this._options.fetcher??P)({url:(0,go.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/overview/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/overview/stats.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getTopAgents(o={},e){return g.fromPromise(this.__getTopAgents(o,e))}async __getTopAgents(o={},e){let{limit:t}=o,r={};t!=null&&(r.limit=t.toString());let s=await(this._options.fetcher??P)({url:(0,go.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/overview/top-agents"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/overview/top-agents.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Po=k(require("url-join"));var Wa=class{static{u(this,"SelfKnowledge")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{category:t,activeOnly:r,limit:s}=o,n={};t!=null&&(n.category=t),r!=null&&(n.activeOnly=r.toString()),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,Po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/self-knowledge"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/self-knowledge.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}record(o,e){return g.fromPromise(this.__record(o,e))}async __record(o,e){let t=await(this._options.fetcher??P)({url:(0,Po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/self-knowledge"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/self-knowledge.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{knowledgeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/self-knowledge/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/self-knowledge/{knowledgeGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}setActive(o,e){return g.fromPromise(this.__setActive(o,e))}async __setActive(o,e){let{knowledgeGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/self-knowledge/${encodeURIComponent(t)}/active`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/self-knowledge/{knowledgeGid}/active.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}validate(o,e){return g.fromPromise(this.__validate(o,e))}async __validate(o,e){let{knowledgeGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Po.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/self-knowledge/${encodeURIComponent(t)}/validate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/self-knowledge/{knowledgeGid}/validate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var bo=k(require("url-join"));var $a=class{static{u(this,"SkillSynthesis")}_options;constructor(o){this._options=o}list(o,e){return g.fromPromise(this.__list(o,e))}async __list(o,e){let{agentGid:t,status:r,category:s}=o,n={};n.agentGid=t,r!=null&&(n.status=r),s!=null&&(n.category=s);let p=await(this._options.fetcher??P)({url:(0,bo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/skill-synthesis"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skill-synthesis.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{skillGid:t}=o,r=await(this._options.fetcher??P)({url:(0,bo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skill-synthesis/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skill-synthesis/{skillGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}promote(o,e){return g.fromPromise(this.__promote(o,e))}async __promote(o,e){let{skillGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,bo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skill-synthesis/${encodeURIComponent(t)}/promote`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/skill-synthesis/{skillGid}/promote.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getForTool(o,e){return g.fromPromise(this.__getForTool(o,e))}async __getForTool(o,e){let{agentGid:t}=o,r={};r.agentGid=t;let s=await(this._options.fetcher??P)({url:(0,bo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/skill-synthesis/for-tool"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skill-synthesis/for-tool.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}runPipeline(o={},e){return g.fromPromise(this.__runPipeline(o,e))}async __runPipeline(o={},e){let t=await(this._options.fetcher??P)({url:(0,bo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/skill-synthesis/run-pipeline"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/skill-synthesis/run-pipeline.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Se=k(require("url-join"));var Ka=class{static{u(this,"Skills")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{category:t,enabledOnly:r,includeBuiltIn:s}=o,n={};t!=null&&(n.category=t),r!=null&&(n.enabledOnly=r.toString()),s!=null&&(n.includeBuiltIn=s.toString());let p=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/skills"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skills.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/skills"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/skills.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{skillGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skills/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skills/{skillGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{skillGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skills/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/skills/{skillGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{skillGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skills/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/skills/{skillGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}disable(o,e){return g.fromPromise(this.__disable(o,e))}async __disable(o,e){let{skillGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skills/${encodeURIComponent(t)}/disable`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/skills/{skillGid}/disable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}enable(o,e){return g.fromPromise(this.__enable(o,e))}async __enable(o,e){let{skillGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skills/${encodeURIComponent(t)}/enable`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/skills/{skillGid}/enable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWithExecutions(o,e){return g.fromPromise(this.__getWithExecutions(o,e))}async __getWithExecutions(o,e){let{skillGid:t,executionLimit:r}=o,s={};r!=null&&(s.executionLimit=r.toString());let n=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skills/${encodeURIComponent(t)}/executions`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skills/{skillGid}/executions.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getStats(o,e){return g.fromPromise(this.__getStats(o,e))}async __getStats(o,e){let{skillGid:t,limit:r,startTime:s,endTime:n}=o,p={};r!=null&&(p.limit=r.toString()),s!=null&&(p.startTime=s.toString()),n!=null&&(p.endTime=n.toString());let c=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/skills/${encodeURIComponent(t)}/stats`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:p,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 400:throw new w(c.error.body,c.rawResponse);case 401:throw new h(c.error.body,c.rawResponse);case 403:throw new m(c.error.body,c.rawResponse);case 404:throw new y(c.error.body,c.rawResponse);case 429:throw new R(c.error.body,c.rawResponse);default:throw new a({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new a({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skills/{skillGid}/stats.");case"unknown":throw new a({message:c.error.errorMessage,rawResponse:c.rawResponse})}}listBuiltIn(o={},e){return g.fromPromise(this.__listBuiltIn(o,e))}async __listBuiltIn(o={},e){let{category:t}=o,r={};t!=null&&(r.category=t);let s=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/skills/built-in"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skills/built-in.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}listByCategory(o,e){return g.fromPromise(this.__listByCategory(o,e))}async __listByCategory(o,e){let{category:t}=o,r={};r.category=t;let s=await(this._options.fetcher??P)({url:(0,Se.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/skills/by-category"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/skills/by-category.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Wp=k(require("url-join"));var Va=class{static{u(this,"SpendCap")}_options;constructor(o){this._options=o}retrieve(o){return g.fromPromise(this.__retrieve(o))}async __retrieve(o){let e=await(this._options.fetcher??P)({url:(0,Wp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/spend-cap"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/spend-cap.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let t=await(this._options.fetcher??P)({url:(0,Wp.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/spend-cap"),method:"PUT",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PUT /v1/primus/spend-cap.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var _e=k(require("url-join"));var Ja=class{static{u(this,"Teams")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{status:t}=o,r={};t!=null&&(r.status=t);let s=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/teams"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/teams.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}create(o={},e){return g.fromPromise(this.__create(o,e))}async __create(o={},e){let t=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/teams"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/teams.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{teamGid:t}=o,r=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/teams/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/teams/{teamGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{teamGid:t,reason:r}=o,s={};r!=null&&(s.reason=r);let n=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/teams/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/teams/{teamGid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{teamGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/teams/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/teams/{teamGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}assignAgent(o,e){return g.fromPromise(this.__assignAgent(o,e))}async __assignAgent(o,e){let t=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/teams/assign"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/teams/assign.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}delegateByTag(o,e){return g.fromPromise(this.__delegateByTag(o,e))}async __delegateByTag(o,e){let t=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/teams/delegate"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/teams/delegate.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}addMember(o,e){return g.fromPromise(this.__addMember(o,e))}async __addMember(o,e){let t=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/teams/members"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/teams/members.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}removeMember(o,e){return g.fromPromise(this.__removeMember(o,e))}async __removeMember(o,e){let t=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/teams/remove-member"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/teams/remove-member.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}unassignAgent(o,e){return g.fromPromise(this.__unassignAgent(o,e))}async __unassignAgent(o,e){let t=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/teams/unassign"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/teams/unassign.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}createWithSpecialists(o={},e){return g.fromPromise(this.__createWithSpecialists(o,e))}async __createWithSpecialists(o={},e){let t=await(this._options.fetcher??P)({url:(0,_e.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/teams/with-specialists"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/teams/with-specialists.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var gr=k(require("url-join"));var Qa=class{static{u(this,"Tenants")}_options;constructor(o){this._options=o}list(o){return g.fromPromise(this.__list(o))}async __list(o){let e=await(this._options.fetcher??P)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/tenants"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/tenants.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/tenants"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/tenants.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{tenantGid:t}=o,r=await(this._options.fetcher??P)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tenants/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/tenants/{tenantGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{tenantGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tenants/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/tenants/{tenantGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}archive(o,e){return g.fromPromise(this.__archive(o,e))}async __archive(o,e){let{tenantGid:t}=o,r=await(this._options.fetcher??P)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tenants/${encodeURIComponent(t)}/archive`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/tenants/{tenantGid}/archive.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}suspend(o,e){return g.fromPromise(this.__suspend(o,e))}async __suspend(o,e){let{tenantGid:t}=o,r=await(this._options.fetcher??P)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tenants/${encodeURIComponent(t)}/suspend`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/tenants/{tenantGid}/suspend.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getByExternalId(o,e){return g.fromPromise(this.__getByExternalId(o,e))}async __getByExternalId(o,e){let{externalId:t}=o,r={};r.externalId=t;let s=await(this._options.fetcher??P)({url:(0,gr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/tenants/by-external-id"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/tenants/by-external-id.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Pe=k(require("url-join"));var Ya=class{static{u(this,"Tools")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{source:t,enabledOnly:r}=o,s={};t!=null&&(s.source=t),r!=null&&(s.enabledOnly=r.toString());let n=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/tools"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/tools.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/tools"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/tools.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{toolGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tools/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/tools/{toolGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{toolGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tools/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/tools/{toolGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{toolGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tools/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/tools/{toolGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}disable(o,e){return g.fromPromise(this.__disable(o,e))}async __disable(o,e){let{toolGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tools/${encodeURIComponent(t)}/disable`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/tools/{toolGid}/disable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}enable(o,e){return g.fromPromise(this.__enable(o,e))}async __enable(o,e){let{toolGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tools/${encodeURIComponent(t)}/enable`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/tools/{toolGid}/enable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}testCall(o,e){return g.fromPromise(this.__testCall(o,e))}async __testCall(o,e){let{toolGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/tools/${encodeURIComponent(t)}/test`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/tools/{toolGid}/test.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}getByName(o,e){return g.fromPromise(this.__getByName(o,e))}async __getByName(o,e){let{name:t}=o,r={};r.name=t;let s=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/tools/by-name"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/tools/by-name.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}importFromOpenApi(o={},e){return g.fromPromise(this.__importFromOpenApi(o,e))}async __importFromOpenApi(o={},e){let t=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/tools/import"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/tools/import.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}getStats(o={},e){return g.fromPromise(this.__getStats(o,e))}async __getStats(o={},e){let{agentGid:t,toolName:r,startTime:s,endTime:n,limit:p}=o,c={};t!=null&&(c.agentGid=t),r!=null&&(c.toolName=r),s!=null&&(c.startTime=s.toString()),n!=null&&(c.endTime=n.toString()),p!=null&&(c.limit=p.toString());let N=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/tools/stats"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:c,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(N.ok)return{data:N.body,rawResponse:N.rawResponse};if(N.error.reason==="status-code")switch(N.error.statusCode){case 400:throw new w(N.error.body,N.rawResponse);case 401:throw new h(N.error.body,N.rawResponse);case 403:throw new m(N.error.body,N.rawResponse);case 404:throw new y(N.error.body,N.rawResponse);case 429:throw new R(N.error.body,N.rawResponse);default:throw new a({statusCode:N.error.statusCode,body:N.error.body,rawResponse:N.rawResponse})}switch(N.error.reason){case"non-json":throw new a({statusCode:N.error.statusCode,body:N.error.rawBody,rawResponse:N.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/tools/stats.");case"unknown":throw new a({message:N.error.errorMessage,rawResponse:N.rawResponse})}}discover(o={},e){return g.fromPromise(this.__discover(o,e))}async __discover(o={},e){let{source:t,enabledOnly:r}=o,s={};t!=null&&(s.source=t),r!=null&&(s.enabledOnly=r.toString());let n=await(this._options.fetcher??P)({url:(0,Pe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/tools"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/tools.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var qe=k(require("url-join"));var Xa=class{static{u(this,"Triggers")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{type:t,enabled:r}=o,s={};t!=null&&(s.type=t),r!=null&&(s.enabled=r.toString());let n=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/triggers"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/triggers.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/triggers"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/triggers.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}retrieve(o,e){return g.fromPromise(this.__retrieve(o,e))}async __retrieve(o,e){let{triggerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/triggers/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/triggers/{triggerGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{triggerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/triggers/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/triggers/{triggerGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{triggerGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/triggers/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/primus/triggers/{triggerGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}disable(o,e){return g.fromPromise(this.__disable(o,e))}async __disable(o,e){let{triggerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/triggers/${encodeURIComponent(t)}/disable`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/triggers/{triggerGid}/disable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}enable(o,e){return g.fromPromise(this.__enable(o,e))}async __enable(o,e){let{triggerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/triggers/${encodeURIComponent(t)}/enable`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/triggers/{triggerGid}/enable.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}getWithExecutions(o,e){return g.fromPromise(this.__getWithExecutions(o,e))}async __getWithExecutions(o,e){let{triggerGid:t,executionLimit:r}=o,s={};r!=null&&(s.executionLimit=r.toString());let n=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/triggers/${encodeURIComponent(t)}/executions`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/triggers/{triggerGid}/executions.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}rotateSecret(o,e){return g.fromPromise(this.__rotateSecret(o,e))}async __rotateSecret(o,e){let{triggerGid:t}=o,r=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/triggers/${encodeURIComponent(t)}/rotate-secret`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/triggers/{triggerGid}/rotate-secret.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}listByAgent(o,e){return g.fromPromise(this.__listByAgent(o,e))}async __listByAgent(o,e){let{agentGid:t,enabledOnly:r}=o,s={};s.agentGid=t,r!=null&&(s.enabledOnly=r.toString());let n=await(this._options.fetcher??P)({url:(0,qe.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/triggers/by-agent"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/triggers/by-agent.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var as=k(require("url-join"));var Za=class{static{u(this,"Usage")}_options;constructor(o){this._options=o}byTenant(o,e){return g.fromPromise(this.__byTenant(o,e))}async __byTenant(o,e){let{tenantId:t,dayUtcMs:r}=o,s={};s.tenantId=t,s.dayUtcMs=r.toString();let n=await(this._options.fetcher??P)({url:(0,as.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/usage/by-tenant"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/usage/by-tenant.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}getHistory(o,e){return g.fromPromise(this.__getHistory(o,e))}async __getHistory(o,e){let{startMs:t,endMs:r,granularity:s}=o,n={};n.startMs=t.toString(),n.endMs=r.toString(),s!=null&&(n.granularity=s);let p=await(this._options.fetcher??P)({url:(0,as.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/usage/history"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/usage/history.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}checkLimits(o){return g.fromPromise(this.__checkLimits(o))}async __checkLimits(o){let e=await(this._options.fetcher??P)({url:(0,as.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/usage/limits"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/usage/limits.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}getSummary(o={},e){return g.fromPromise(this.__getSummary(o,e))}async __getSummary(o={},e){let{tenantId:t}=o,r={};t!=null&&(r.tenantId=t);let s=await(this._options.fetcher??P)({url:(0,as.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/usage/summary"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/usage/summary.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ei=k(require("url-join"));var ri=class{static{u(this,"Webhooks")}_options;constructor(o){this._options=o}list(o){return g.fromPromise(this.__list(o))}async __list(o){let e=await(this._options.fetcher??P)({url:(0,ei.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/webhooks"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/primus/webhooks.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let t=await(this._options.fetcher??P)({url:(0,ei.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/webhooks"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/webhooks.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}remove(o,e){return g.fromPromise(this.__remove(o,e))}async __remove(o,e){let{webhookId:t}=o,r=await(this._options.fetcher??P)({url:(0,ei.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/primus/webhooks/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/primus/webhooks/{webhookId}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var oi=class{static{u(this,"Primus")}_options;_agentGoals;_agents;_approvals;_brainConfig;_brainModels;_configPromotion;_conversations;_actions;_delegations;_entitlements;_execution;_guardrailOutcomes;_integrations;_killSwitch;_learning;_stats;_mcpConnect;_mcpServers;_mcpOauth;_memoriesEncrypted;_memories;_memory;_rag;_observability;_overview;_selfKnowledge;_skillSynthesis;_skills;_spendCap;_teams;_tenants;_tools;_triggers;_usage;_webhooks;constructor(o){this._options=o}get agentGoals(){return this._agentGoals??=new Ra(this._options)}get agents(){return this._agents??=new ga(this._options)}get approvals(){return this._approvals??=new Pa(this._options)}get brainConfig(){return this._brainConfig??=new ba(this._options)}get brainModels(){return this._brainModels??=new fa(this._options)}get configPromotion(){return this._configPromotion??=new va(this._options)}get conversations(){return this._conversations??=new Na(this._options)}get actions(){return this._actions??=new Ea(this._options)}get delegations(){return this._delegations??=new _a(this._options)}get entitlements(){return this._entitlements??=new ka(this._options)}get execution(){return this._execution??=new Ta(this._options)}get guardrailOutcomes(){return this._guardrailOutcomes??=new Ca(this._options)}get integrations(){return this._integrations??=new xa(this._options)}get killSwitch(){return this._killSwitch??=new Aa(this._options)}get learning(){return this._learning??=new Ia(this._options)}get stats(){return this._stats??=new Ga(this._options)}get mcpConnect(){return this._mcpConnect??=new Ua(this._options)}get mcpServers(){return this._mcpServers??=new Ha(this._options)}get mcpOauth(){return this._mcpOauth??=new Ba(this._options)}get memoriesEncrypted(){return this._memoriesEncrypted??=new La(this._options)}get memories(){return this._memories??=new Fa(this._options)}get memory(){return this._memory??=new Da(this._options)}get rag(){return this._rag??=new za(this._options)}get observability(){return this._observability??=new Oa(this._options)}get overview(){return this._overview??=new ja(this._options)}get selfKnowledge(){return this._selfKnowledge??=new Wa(this._options)}get skillSynthesis(){return this._skillSynthesis??=new $a(this._options)}get skills(){return this._skills??=new Ka(this._options)}get spendCap(){return this._spendCap??=new Va(this._options)}get teams(){return this._teams??=new Ja(this._options)}get tenants(){return this._tenants??=new Qa(this._options)}get tools(){return this._tools??=new Ya(this._options)}get triggers(){return this._triggers??=new Xa(this._options)}get usage(){return this._usage??=new Za(this._options)}get webhooks(){return this._webhooks??=new ri(this._options)}};var fo=k(require("url-join"));var si=class{static{u(this,"Tenants")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{platformId:t,status:r}=o,s={};t!=null&&(s.platformId=t),r!=null&&(s.status=r);let n=await(this._options.fetcher??P)({url:(0,fo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/tenants"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/tenants.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}upsert(o,e){return g.fromPromise(this.__upsert(o,e))}async __upsert(o,e){let t=await(this._options.fetcher??P)({url:(0,fo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/tenants"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/tenants.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}activate(o,e){return g.fromPromise(this.__activate(o,e))}async __activate(o,e){let{tenantId:t}=o,r=await(this._options.fetcher??P)({url:(0,fo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/tenants/${encodeURIComponent(t)}/activate`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/tenants/{tenantId}/activate.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}close(o,e){return g.fromPromise(this.__close(o,e))}async __close(o,e){let{tenantId:t,"Idempotency-Key":r}=o,s=await(this._options.fetcher??P)({url:(0,fo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/tenants/${encodeURIComponent(t)}/close`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":r??void 0}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/tenants/{tenantId}/close.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}suspend(o,e){return g.fromPromise(this.__suspend(o,e))}async __suspend(o,e){let{tenantId:t}=o,r=await(this._options.fetcher??P)({url:(0,fo.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/tenants/${encodeURIComponent(t)}/suspend`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/tenants/{tenantId}/suspend.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var Vh=k(require("url-join"));var ti=class{static{u(this,"ActAs")}_options;constructor(o){this._options=o}actAs(o,e){return g.fromPromise(this.__actAs(o,e))}async __actAs(o,e){let t=await(this._options.fetcher??P)({url:(0,Vh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/tenants/act-as"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:o,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(t.ok)return{data:t.body,rawResponse:t.rawResponse};if(t.error.reason==="status-code")switch(t.error.statusCode){case 400:throw new w(t.error.body,t.rawResponse);case 401:throw new h(t.error.body,t.rawResponse);case 403:throw new m(t.error.body,t.rawResponse);case 404:throw new y(t.error.body,t.rawResponse);case 429:throw new R(t.error.body,t.rawResponse);default:throw new a({statusCode:t.error.statusCode,body:t.error.body,rawResponse:t.rawResponse})}switch(t.error.reason){case"non-json":throw new a({statusCode:t.error.statusCode,body:t.error.rawBody,rawResponse:t.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/tenants/act-as.");case"unknown":throw new a({message:t.error.errorMessage,rawResponse:t.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ni=class{static{u(this,"Tenants")}_options;_tenants;_actAs;constructor(o){this._options=o}get tenants(){return this._tenants??=new si(this._options)}get actAs(){return this._actAs??=new ti(this._options)}};var Pr=k(require("url-join"));var ai=class{static{u(this,"Webhooks")}_options;constructor(o){this._options=o}list(o={},e){return g.fromPromise(this.__list(o,e))}async __list(o={},e){let{status:t,cursor:r,limit:s}=o,n={};t!=null&&(n.status=t),r!=null&&(n.cursor=r),s!=null&&(n.limit=s.toString());let p=await(this._options.fetcher??P)({url:(0,Pr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/webhooks"),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:n,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(p.ok)return{data:p.body,rawResponse:p.rawResponse};if(p.error.reason==="status-code")switch(p.error.statusCode){case 400:throw new w(p.error.body,p.rawResponse);case 401:throw new h(p.error.body,p.rawResponse);case 403:throw new m(p.error.body,p.rawResponse);case 404:throw new y(p.error.body,p.rawResponse);case 429:throw new R(p.error.body,p.rawResponse);default:throw new a({statusCode:p.error.statusCode,body:p.error.body,rawResponse:p.rawResponse})}switch(p.error.reason){case"non-json":throw new a({statusCode:p.error.statusCode,body:p.error.rawBody,rawResponse:p.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/webhooks.");case"unknown":throw new a({message:p.error.errorMessage,rawResponse:p.rawResponse})}}create(o,e){return g.fromPromise(this.__create(o,e))}async __create(o,e){let{"Idempotency-Key":t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Pr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/webhooks"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader(),"Idempotency-Key":t??void 0}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/webhooks.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}get(o,e){return g.fromPromise(this.__get(o,e))}async __get(o,e){let{webhookGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Pr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/webhooks/${encodeURIComponent(t)}`),method:"GET",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling GET /v1/webhooks/{webhookGid}.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}revoke(o,e){return g.fromPromise(this.__revoke(o,e))}async __revoke(o,e){let{webhookGid:t,reason:r}=o,s={};r!=null&&(s.reason=r);let n=await(this._options.fetcher??P)({url:(0,Pr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/webhooks/${encodeURIComponent(t)}`),method:"DELETE",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),queryParameters:s,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(n.ok)return{data:n.body,rawResponse:n.rawResponse};if(n.error.reason==="status-code")switch(n.error.statusCode){case 400:throw new w(n.error.body,n.rawResponse);case 401:throw new h(n.error.body,n.rawResponse);case 403:throw new m(n.error.body,n.rawResponse);case 404:throw new y(n.error.body,n.rawResponse);case 429:throw new R(n.error.body,n.rawResponse);default:throw new a({statusCode:n.error.statusCode,body:n.error.body,rawResponse:n.rawResponse})}switch(n.error.reason){case"non-json":throw new a({statusCode:n.error.statusCode,body:n.error.rawBody,rawResponse:n.rawResponse});case"timeout":throw new l("Timeout exceeded when calling DELETE /v1/webhooks/{webhookGid}.");case"unknown":throw new a({message:n.error.errorMessage,rawResponse:n.rawResponse})}}update(o,e){return g.fromPromise(this.__update(o,e))}async __update(o,e){let{webhookGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Pr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/webhooks/${encodeURIComponent(t)}`),method:"PATCH",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling PATCH /v1/webhooks/{webhookGid}.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}revealSecret(o,e){return g.fromPromise(this.__revealSecret(o,e))}async __revealSecret(o,e){let{webhookGid:t}=o,r=await(this._options.fetcher??P)({url:(0,Pr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/webhooks/${encodeURIComponent(t)}/reveal-secret`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(r.ok)return{data:r.body,rawResponse:r.rawResponse};if(r.error.reason==="status-code")switch(r.error.statusCode){case 400:throw new w(r.error.body,r.rawResponse);case 401:throw new h(r.error.body,r.rawResponse);case 403:throw new m(r.error.body,r.rawResponse);case 404:throw new y(r.error.body,r.rawResponse);case 429:throw new R(r.error.body,r.rawResponse);default:throw new a({statusCode:r.error.statusCode,body:r.error.body,rawResponse:r.rawResponse})}switch(r.error.reason){case"non-json":throw new a({statusCode:r.error.statusCode,body:r.error.rawBody,rawResponse:r.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/webhooks/{webhookGid}/reveal-secret.");case"unknown":throw new a({message:r.error.errorMessage,rawResponse:r.rawResponse})}}rotateSecret(o,e){return g.fromPromise(this.__rotateSecret(o,e))}async __rotateSecret(o,e){let{webhookGid:t,...r}=o,s=await(this._options.fetcher??P)({url:(0,Pr.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,`v1/webhooks/${encodeURIComponent(t)}/rotate-secret`),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),e?.headers),contentType:"application/json",requestType:"json",body:r,timeoutMs:e?.timeoutInSeconds!=null?e.timeoutInSeconds*1e3:6e4,maxRetries:e?.maxRetries,abortSignal:e?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 400:throw new w(s.error.body,s.rawResponse);case 401:throw new h(s.error.body,s.rawResponse);case 403:throw new m(s.error.body,s.rawResponse);case 404:throw new y(s.error.body,s.rawResponse);case 429:throw new R(s.error.body,s.rawResponse);default:throw new a({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new a({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/webhooks/{webhookGid}/rotate-secret.");case"unknown":throw new a({message:s.error.errorMessage,rawResponse:s.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var ii=class{static{u(this,"Webhooks")}_options;_webhooks;constructor(o){this._options=o}get webhooks(){return this._webhooks??=new ai(this._options)}};var vo=class{static{u(this,"NPayloadClient")}_options;_account;_analytics;_audit;_billing;_connect;_embed;_events;_feed;_notify;_pipes;_primus;_tenants;_webhooks;constructor(o){this._options={...o,headers:b({"X-Fern-Language":"JavaScript","X-Fern-Runtime":de.type,"X-Fern-Runtime-Version":de.version},o?.headers)}}get account(){return this._account??=new ut(this._options)}get analytics(){return this._analytics??=new yt(this._options)}get audit(){return this._audit??=new bt(this._options)}get billing(){return this._billing??=new qt(this._options)}get connect(){return this._connect??=new Xt(this._options)}get embed(){return this._embed??=new rn(this._options)}get events(){return this._events??=new Fn(this._options)}get feed(){return this._feed??=new Vn(this._options)}get notify(){return this._notify??=new ra(this._options)}get pipes(){return this._pipes??=new ya(this._options)}get primus(){return this._primus??=new oi(this._options)}get tenants(){return this._tenants??=new ni(this._options)}get webhooks(){return this._webhooks??=new ii(this._options)}chatStream(o){return g.fromPromise(this.__chatStream(o))}async __chatStream(o){let e=await(this._options.fetcher??P)({url:(0,Jh.default)(await d.get(this._options.baseUrl)??await d.get(this._options.environment)??f.Production,"v1/primus/chat/stream-pipeline"),method:"POST",headers:b(this._options?.headers,v({Authorization:await this._getAuthorizationHeader()}),o?.headers),timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(e.ok)return{data:e.body,rawResponse:e.rawResponse};if(e.error.reason==="status-code")switch(e.error.statusCode){case 400:throw new w(e.error.body,e.rawResponse);case 401:throw new h(e.error.body,e.rawResponse);case 403:throw new m(e.error.body,e.rawResponse);case 404:throw new y(e.error.body,e.rawResponse);case 429:throw new R(e.error.body,e.rawResponse);default:throw new a({statusCode:e.error.statusCode,body:e.error.body,rawResponse:e.rawResponse})}switch(e.error.reason){case"non-json":throw new a({statusCode:e.error.statusCode,body:e.error.rawBody,rawResponse:e.rawResponse});case"timeout":throw new l("Timeout exceeded when calling POST /v1/primus/chat/stream-pipeline.");case"unknown":throw new a({message:e.error.errorMessage,rawResponse:e.rawResponse})}}async _getAuthorizationHeader(){return`Bearer ${await d.get(this._options.token)}`}};var $r=class extends a{static{u(this,"NPayloadPlanRequiredError")}code;product;upgradeUrl;requestId;constructor(o){super({message:o.message,statusCode:402,body:{code:o.code,message:o.message,...o.npp!==void 0?{npp:o.npp}:{}},...o.rawResponse!==void 0?{rawResponse:o.rawResponse}:{}}),Object.setPrototypeOf(this,new.target.prototype),this.name="NPayloadPlanRequiredError",this.code=o.code,this.product=o.product,this.upgradeUrl=o.upgradeUrl,this.requestId=o.requestId}};var Kr=class extends a{static{u(this,"NPayloadSourceNotAllowedError")}code;reason;requestId;constructor(o){let e=o.statusCode??403;super({message:o.message,statusCode:e,body:{code:o.code,message:o.message},...o.rawResponse!==void 0?{rawResponse:o.rawResponse}:{}}),Object.setPrototypeOf(this,new.target.prototype),this.name="NPayloadSourceNotAllowedError",this.code=o.code,this.reason=o.code.toLowerCase()==="source_network_not_declared"?"not_declared":"not_allowed",this.requestId=o.requestId}},Vr=class extends a{static{u(this,"NPayloadFingerprintNotEnrolledError")}code;fingerprint;requestId;constructor(o){let e=o.statusCode??403;super({message:o.message,statusCode:e,body:{code:o.code,message:o.message,...o.fingerprint!==void 0?{fingerprint:o.fingerprint}:{}},...o.rawResponse!==void 0?{rawResponse:o.rawResponse}:{}}),Object.setPrototypeOf(this,new.target.prototype),this.name="NPayloadFingerprintNotEnrolledError",this.code=o.code,this.fingerprint=o.fingerprint,this.requestId=o.requestId}};var H=16,is=144,Ce=64,Wg=128;function Zh(i){return(i&We.PQ_HYBRID)!==0?Wg:Ce}u(Zh,"publishSignatureLen");var Eo=32,d2=new Uint8Array([78,80,80,1]),br=new Uint8Array([78,80,80,1]),L={HELLO:0,HELLO_ACK:1,PUBLISH:2,PUBLISH_BATCH:3,BULK_ACK:4,SUBSCRIBE:5,DELIVER:6,DELIVER_BATCH:7,ACK:8,SEEK:9,FLOW_CREDIT:13,PING:14,PONG:15,GOODBYE:16,ERROR:17,SYS_EVENT:18,REKEY:19},em={ZSTD:1,E2E:2,HLC:4,PQ_HYBRID:64};var rm=1,om=0,sm={AT_MOST_ONCE:0,AT_LEAST_ONCE:1,EXACTLY_ONCE:2},p2=sm.EXACTLY_ONCE;var We={COMPRESSED:1,ENCRYPTED:2,BATCH:4,URGENT:8,RESERVED_V2:16,EXTENDED_HEADER:32,PQ_HYBRID:64,SESSION_PARAMS:128},vr={ACCEPTED:0,ACCEPTED_DUPLICATE:1,REJECTED_GAP:16,REJECTED_DUPLICATE:17,REJECTED_SIGNATURE:32,REJECTED_AUTH:33,REJECTED_SCHEMA:48,REJECTED_PAYLOAD:49,REJECTED_INVALID_FILTER:50,REJECTED_QUOTA:64,REJECTED_GRANT:65,DEFERRED_RETRY:80,REJECTED_OTHER:255},tm={REJECTED_HW_ATTESTATION:144};function er(i){if(i.headerLen<H)throw new RangeError(`headerLen must be \u2265 ${H}, got ${i.headerLen}`);if(i.frameType<0||i.frameType>255)throw new RangeError(`frameType out of range: ${i.frameType}`);if(i.flags<0||i.flags>255)throw new RangeError(`flags out of range: ${i.flags}`);if(i.headerLen>65535)throw new RangeError(`headerLen exceeds u16: ${i.headerLen}`);if(i.sessionId<0||i.sessionId>4294967295)throw new RangeError(`sessionId out of range: ${i.sessionId}`);if(i.payloadLen<0||i.payloadLen>4294967295)throw new RangeError(`payloadLen out of range: ${i.payloadLen}`);let o=new Uint8Array(H);o.set(br,0),o[4]=i.frameType,o[5]=i.flags;let e=new DataView(o.buffer,o.byteOffset,o.byteLength);return e.setUint16(6,i.headerLen,!1),e.setUint32(8,i.sessionId,!1),e.setUint32(12,i.payloadLen,!1),o}u(er,"encodeCommonHeader");function be(i){if(i.byteLength<H)throw new RangeError(`frame too short for common header: ${i.byteLength} < ${H}`);for(let p=0;p<4;p+=1)if(i[p]!==br[p])throw new Error("npp: bad magic \u2014 not an NPP frame");let o=new DataView(i.buffer,i.byteOffset,i.byteLength),e=i[4],t=i[5],r=o.getUint16(6,!1),s=o.getUint32(8,!1),n=o.getUint32(12,!1);if(r<H)throw new RangeError(`headerLen below minimum: ${r} < ${H}`);return{frameType:e,flags:t,headerLen:r,sessionId:s,payloadLen:n}}u(be,"decodeCommonHeader");var Qh=5;function nm(i){if(i.nppVersionMajor<0||i.nppVersionMajor>255)throw new RangeError(`nppVersionMajor out of u8 range: ${i.nppVersionMajor}`);if(i.nppVersionMinor<0||i.nppVersionMinor>255)throw new RangeError(`nppVersionMinor out of u8 range: ${i.nppVersionMinor}`);if(i.capabilityFlags<0||i.capabilityFlags>65535)throw new RangeError(`capabilityFlags out of u16 range: ${i.capabilityFlags}`);let o=i.qosCapabilities??sm.AT_LEAST_ONCE;if(o<0||o>255)throw new RangeError(`qosCapabilities out of u8 range: ${o}`);let e=i.authBody??new Uint8Array(0),t=Qh+e.byteLength,r=new Uint8Array(H+t);return r.set(er({frameType:L.HELLO,flags:0,headerLen:H,sessionId:i.sessionId??0,payloadLen:t}),0),r[16]=i.nppVersionMajor,r[17]=i.nppVersionMinor,new DataView(r.buffer,r.byteOffset,r.byteLength).setUint16(18,i.capabilityFlags,!1),r[20]=o,e.byteLength>0&&r.set(e,H+Qh),r}u(nm,"encodeHello");var $p=6,No=32,Qp=32,$g=8+Qp,Kg=1,Vg=8,Kp=4+Vg,Yh=5;function Jg(i,o){let e=new DataView(i.buffer,i.byteOffset,i.byteLength),t,r=o;for(;r<i.byteLength;){if(r+Yh>i.byteLength)throw new RangeError(`HELLO_ACK SESSION_PARAMS entry header runs past the frame at ${r}`);let s=i[r],n=e.getUint32(r+1,!1),p=r+Yh,c=p+n;if(c>i.byteLength)throw new RangeError(`HELLO_ACK SESSION_PARAMS entry 0x${s.toString(16).padStart(2,"0")} runs past the frame: have ${i.byteLength}, need ${c}`);if(s===Kg){if(t!==void 0)throw new RangeError("HELLO_ACK SESSION_PARAMS carries two identity lists");t=Qg(i,e,p,c)}r=c}return t}u(Jg,"decodeSessionParamsEntries");function Qg(i,o,e,t){let r=e,s=u(c=>{if(r+2>t)throw new RangeError("HELLO_ACK identity list shorter than its counts");let N=o.getUint16(r,!1);r+=2;let E=[];for(let S=0;S<N;S+=1){if(r+Kp>t)throw new RangeError("HELLO_ACK identity list shorter than its tuples");E.push(c(o.getUint32(r,!1),i.slice(r+4,r+Kp))),r+=Kp}return E},"tuples"),n=s((c,N)=>({channelId:c,gidHash:N})),p=s((c,N)=>({schemaFingerprint:c,schemaGidHash:N}));if(r!==t)throw new RangeError("HELLO_ACK identity list longer than its tuples");return{channels:n,schemas:p}}u(Qg,"decodeIdentityList");function am(i){let o=Yg(i),e=Vp(o.prefix,o.nonce);return i.byteLength<=o.sigEnd?[e]:[Vp(e,i.slice(o.sigEnd)),e]}u(am,"helloAckSigningInputs");function Yg(i){let o=be(i),e=o.headerLen,t=e+o.payloadLen,r=t+No,s=r+Ce;if(i.byteLength<s)throw new RangeError(`HELLO_ACK truncated for signing input: have ${i.byteLength}, need ${s}`);return{prefix:Vp(i.slice(8,H),i.slice(e,t)),nonce:i.slice(t,r),sigEnd:s}}u(Yg,"helloAckSignedParts");function Vp(...i){let o=0;for(let r of i)o+=r.byteLength;let e=new Uint8Array(o),t=0;for(let r of i)e.set(r,t),t+=r.byteLength;return e}u(Vp,"concatBytes");function im(i){if(i.byteLength<H+$p)throw new RangeError(`HELLO_ACK too short: ${i.byteLength} < ${H+$p}`);let o=be(i);if(o.frameType!==L.HELLO_ACK)throw new Error(`decodeHelloAck: expected frameType=HELLO_ACK (0x01), got 0x${o.frameType.toString(16).padStart(2,"0")}`);let e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={sessionId:o.sessionId,nppVersionMajor:i[16],nppVersionMinor:i[17],negotiatedCapabilities:e.getUint16(20,!1)},r=H+$p,s=(o.flags&We.EXTENDED_HEADER)!==0,n=r+No+Ce;if(s&&i.byteLength>=n&&(t.nonceEcho=i.slice(r,r+No),t.serverSignature=i.slice(r+No,n)),(o.flags&We.SESSION_PARAMS)!==0){let p=r+(s?No+Ce:0),c=p+$g;if(i.byteLength<c)throw new RangeError(`HELLO_ACK SESSION_PARAMS truncated: have ${i.byteLength}, need ${c}`);t.sessionTtlSec=e.getUint32(p,!1),t.publishWindowMs=e.getUint32(p+4,!1),t.ephemeralPublicKey=i.slice(p+8,p+8+Qp);let N=Jg(i,c);N!==void 0&&(t.identities=N)}return t}u(im,"decodeHelloAck");function Yp(i,o){if(i.frameType!==L.PUBLISH)throw new Error(`encodePublishEnvelope: expected frameType=PUBLISH (0x02), got 0x${i.frameType.toString(16).padStart(2,"0")}`);if(o.payloadHash.byteLength!==Eo)throw new RangeError(`payloadHash must be ${Eo} bytes, got ${o.payloadHash.byteLength}`);let e=Zh(i.flags);if(o.detachedSignature.byteLength!==e)throw new RangeError(`detachedSignature must be ${e} bytes for ${(i.flags&We.PQ_HYBRID)!==0?"PQ_HYBRID":"classical"} mode, got ${o.detachedSignature.byteLength}`);if(o.qosLevel<0||o.qosLevel>2)throw new RangeError(`qosLevel must be 0..2, got ${o.qosLevel}`);if(o.encryptionMode<0||o.encryptionMode>3)throw new RangeError(`encryptionMode must be 0..3, got ${o.encryptionMode}`);if(o.attributesCount<0||o.attributesCount>65535)throw new RangeError(`attributesCount out of range: ${o.attributesCount}`);let t=o.priority!==void 0;if(t&&(o.priority<0||o.priority>9))throw new RangeError(`priority must be 0..9, got ${o.priority}`);let r=48+Eo+e,s=r+(t?1:0),n=t?i.flags|We.EXTENDED_HEADER:i.flags,p=new Uint8Array(s);p.set(er({...i,flags:n}),0);let c=new DataView(p.buffer,p.byteOffset,p.byteLength);return c.setUint32(16,o.channelId,!1),c.setUint32(20,o.partitionId,!1),c.setBigUint64(24,o.sequence,!1),c.setBigUint64(32,o.hlcTimestamp,!1),c.setUint32(40,o.schemaFingerprint,!1),p[44]=o.qosLevel,p[45]=o.encryptionMode,c.setUint16(46,o.attributesCount,!1),p.set(o.payloadHash,48),p.set(o.detachedSignature,80),t&&(p[r]=o.priority),p}u(Yp,"encodePublishEnvelope");function ui(i){if(i.byteLength<80)throw new RangeError(`envelope bytes too short for signing input: ${i.byteLength}`);return i.slice(8,80)}u(ui,"canonicalPublishSigningInput");var Xg=10;function dm(i){let o=be(i);if(o.frameType!==L.BULK_ACK)throw new Error(`decodeBulkAck: expected frameType=BULK_ACK (0x04), got 0x${o.frameType.toString(16).padStart(2,"0")}`);let e=Xg,t=H+o.payloadLen;if(i.byteLength<t)throw new RangeError(`BULK_ACK truncated: have ${i.byteLength}, need ${t}`);if(o.payloadLen%e!==0)throw new RangeError(`BULK_ACK payloadLen not a multiple of ${e}: ${o.payloadLen}`);let r=new DataView(i.buffer,i.byteOffset,i.byteLength),s=o.payloadLen/e,n=[];for(let c=0;c<s;c+=1){let N=H+c*e;n.push({seq:r.getBigUint64(N,!1),status:r.getUint16(N+8,!1)})}let p;return(o.flags&We.EXTENDED_HEADER)!==0&&i.byteLength>=t+Ce&&(p=i.slice(t,t+Ce)),{header:o,records:n,serverSignature:p}}u(dm,"decodeBulkAck");var fr=48,ke={LOG:0,QUEUE:1,TOPIC:2,TAIL:3,OUTCOMES:4,DEAD_LETTERS:5,TABLE_HEAD:6,WINDOW:7,COUNTERS:8,UNIT_HEAD:9},Jr={PUSH:0,PULL:1,HYBRID:2},di={NONE:0,JSONPATH:1,CEL:2,ROUTING_KEY_PREFIX:3},c2=new Set([di.NONE,di.JSONPATH,di.CEL,di.ROUTING_KEY_PREFIX]);function pm(i,o){return i===ke.TOPIC&&(o===Jr.PULL||o===Jr.HYBRID)?"TOPIC mode is push-only (no cursor)":i===ke.TAIL&&(o===Jr.PULL||o===Jr.HYBRID)?"TAIL mode is push-only (subscribe-from-now)":Zg(i)&&o!==Jr.PUSH?"a view mode (OUTCOMES, DEAD_LETTERS, TABLE_HEAD, WINDOW, COUNTERS, UNIT_HEAD) is push-only":null}u(pm,"validateSubscribeModeCompat");function So(i){let o=i.envelope;if(o.mode<0||o.mode>255)throw new RangeError(`mode out of range: ${o.mode}`);if(o.deliveryPreference<0||o.deliveryPreference>255)throw new RangeError(`deliveryPreference out of range: ${o.deliveryPreference}`);let e=pm(o.mode,o.deliveryPreference);if(e)throw new RangeError(`SUBSCRIBE compat: ${e}`);if(o.qosCapabilities<0||o.qosCapabilities>65535)throw new RangeError(`qosCapabilities out of range: ${o.qosCapabilities}`);if(o.partitionFilter<0||o.partitionFilter>4294967295)throw new RangeError(`partitionFilter out of range: ${o.partitionFilter}`);if(o.filters.length>255)throw new RangeError(`too many filters (filterCount is u8): ${o.filters.length}`);let t=0;for(let E of o.filters){if(E.value.byteLength>65535)throw new RangeError(`filter value too large: ${E.value.byteLength}`);t+=3+E.value.byteLength}let r=i.consumerSignature??new Uint8Array(0);if(r.byteLength>65535)throw new RangeError(`consumerSignature too large: ${r.byteLength}`);let n=fr-H+t+r.byteLength,p=new Uint8Array(H+n);p.set(er({frameType:L.SUBSCRIBE,flags:0,headerLen:H,sessionId:i.sessionId,payloadLen:n}),0);let c=new DataView(p.buffer,p.byteOffset,p.byteLength);c.setUint32(16,o.channelId,!1),c.setUint32(20,o.partitionFilter,!1),p[24]=o.mode,p[25]=o.deliveryPreference,c.setUint16(26,o.qosCapabilities,!1),c.setBigUint64(28,o.startCursor,!1),c.setBigUint64(36,o.startHlc,!1),p[44]=o.filters.length;let N=fr;for(let E of o.filters)p[N]=E.type&255,c.setUint16(N+1,E.value.byteLength,!1),p.set(E.value,N+3),N+=3+E.value.byteLength;return p.set(r,N),p}u(So,"encodeSubscribeFrame");function Xp(i){if(i.byteLength<fr)throw new RangeError(`envelope too short for SUBSCRIBE signing input: ${i.byteLength}`);let o=new DataView(i.buffer,i.byteOffset,i.byteLength),e=Math.min(i.byteLength,H+o.getUint32(12,!1)),t=fr;for(let r=0;r<i[44];r+=1){if(t+3>e)throw new RangeError(`SUBSCRIBE filter ${r} header truncated: no signing input`);if(t+=3+o.getUint16(t+1,!1),t>e)throw new RangeError(`SUBSCRIBE filter ${r} value truncated: no signing input`)}return i.slice(8,t)}u(Xp,"canonicalSubscribeSigningInput");var u2=new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0}),cm=new TextEncoder;function Zg(i){return Number.isInteger(i)&&i>=ke.OUTCOMES&&i<=ke.UNIT_HEAD}u(Zg,"isViewMode");var Te={RECORD:0,OUTCOME:1,DEAD_LETTER:2,TABLE_HEAD:3,WINDOW:4,COUNTERS:5,UNIT_HEAD:6},eP="npk_view",rP={[Te.OUTCOME]:"outcome",[Te.DEAD_LETTER]:"dead_letter",[Te.TABLE_HEAD]:"table_head",[Te.WINDOW]:"window",[Te.COUNTERS]:"counters",[Te.UNIT_HEAD]:"unit_head"},l2=cm.encode(eP),w2=[Te.OUTCOME,Te.DEAD_LETTER,Te.TABLE_HEAD,Te.WINDOW,Te.COUNTERS,Te.UNIT_HEAD].map(i=>[i,cm.encode(rP[i])]);var h2={[ke.OUTCOMES]:"kernel:outcomes:",[ke.DEAD_LETTERS]:"kernel:dead_letters:",[ke.TABLE_HEAD]:"kernel:head:",[ke.WINDOW]:"kernel:window:",[ke.COUNTERS]:"kernel:counters:",[ke.UNIT_HEAD]:"kernel:unit_head:"};var oP=22,sP=27,tP=27;function nP(i){let o=be(i);if(o.headerLen>i.byteLength)throw new RangeError(`headerLen ${o.headerLen} beyond the frame's ${i.byteLength} bytes`);let e=[],t=H;for(;t<o.headerLen;){if(t+2>o.headerLen)throw new RangeError("TLV region does not fill 16..headerLen exactly: a type without its length");let s=i[t+1];if(t+2+s>o.headerLen)throw new RangeError(`TLV 0x${i[t].toString(16)} of ${s} bytes runs past headerLen ${o.headerLen}`);e.push({type:i[t],value:i.slice(t+2,t+2+s)}),t+=2+s}for(let s=0;s<e.length;s+=1){let n=e[s].type;if(n>=1&&n<=tP&&n!==oP&&n!==sP&&e.slice(0,s).some(p=>p.type===n))throw new RangeError(`TLV 0x${n.toString(16)} repeated: a registered TLV appears once in a frame`)}if(o.headerLen===H)return{canonical:i,tlvs:e};let r=new Uint8Array(i.byteLength-(o.headerLen-H));return r.set(i.subarray(0,H),0),r.set(i.subarray(o.headerLen),H),new DataView(r.buffer).setUint16(6,H,!1),{canonical:r,tlvs:e}}u(nP,"splitHeaderTlvs");var aP=10,iP=26;function um(i,o,e){if(e.length===0)throw new RangeError("ACK must contain at least one record");let t=e.some(E=>E.deliveryToken!==void 0),r=t?iP:aP,s=4,n=s+e.length*r,p=new Uint8Array(H+n);p.set(er({frameType:L.ACK,flags:t?We.EXTENDED_HEADER:0,headerLen:H,sessionId:i,payloadLen:n}),0);let c=new DataView(p.buffer,p.byteOffset,p.byteLength);c.setUint32(16,o,!1);let N=H+s;for(let E of e){if(E.disposition<0||E.disposition>65535)throw new RangeError(`disposition out of range: ${E.disposition}`);if(c.setBigUint64(N,E.seq,!1),c.setUint16(N+8,E.disposition,!1),t){let S=E.deliveryToken??{hi:0n,lo:0n};c.setBigUint64(N+10,S.hi,!1),c.setBigUint64(N+18,S.lo,!1)}N+=r}return p}u(um,"encodeAck");var dP=16;function pi(i,o){if(!Number.isInteger(o)||o<0||o>4294967295)throw new RangeError(`FLOW_CREDIT ${i} out of u32 range: ${o}`)}u(pi,"assertU32");function lm(i,o){pi("channelId",o.channelId),pi("creditDelta",o.creditDelta),pi("projectedLagMs",o.projectedLagMs),pi("bandwidthBudgetBps",o.bandwidthBudgetBps);let e=dP,t=new Uint8Array(H+e);t.set(er({frameType:L.FLOW_CREDIT,flags:0,headerLen:H,sessionId:i,payloadLen:e}),0);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.setUint32(H+0,o.channelId,!1),r.setUint32(H+4,o.creditDelta,!1),r.setUint32(H+8,o.projectedLagMs,!1),r.setUint32(H+12,o.bandwidthBudgetBps,!1),t}u(lm,"encodeFlowCredit");function wm(i){let o=be(i);if(o.frameType!==L.SYS_EVENT)throw new Error(`expected SYS_EVENT (0x12), got 0x${o.frameType.toString(16)}`);if(o.payloadLen<16)throw new RangeError("SYS_EVENT payload too small");let e=new DataView(i.buffer,i.byteOffset,i.byteLength),t=e.getUint32(16,!1),r=e.getUint32(20,!1),s=e.getBigUint64(24,!1),n=i.slice(H+16,H+o.payloadLen);return{header:o,frame:{channelId:t,eventCode:r,hlcTimestamp:s,payload:n}}}u(wm,"decodeSysEvent");var ci=10;function hm(i){let o=be(i);if(o.frameType!==L.ERROR)throw new Error(`decodeError: expected frameType=ERROR (0x11), got 0x${o.frameType.toString(16).padStart(2,"0")}`);if(o.payloadLen<ci)throw new RangeError(`ERROR payload too small: ${o.payloadLen}`);o.headerLen!==H&&nP(i);let e=o.headerLen;if(i.byteLength<e+o.payloadLen)throw new RangeError("ERROR frame truncated");let t=new DataView(i.buffer,i.byteOffset,i.byteLength),r=e+ci,s=e+o.payloadLen;return{header:o,frame:{seq:t.getBigUint64(e,!1),reasonCode:t.getUint16(e+8,!1),detail:i.slice(r,s)}}}u(hm,"decodeError");var _o={FRAME_MALFORMED:498,PROTOCOL_VIOLATION:499,UPSTREAM_REFUSED:500};function Jp(i){for(let[o,e]of Object.entries(_o))if(e===i)return o}u(Jp,"nppErrorCodeName");function li(i){for(let[o,e]of Object.entries(vr))if(e===i)return o}u(li,"bulkAckStatusName");function Nr(i,o){let e=be(i);if(e.frameType!==L.ERROR)throw new Error(`decodeErrorSideband: expected frameType=ERROR (0x11), got 0x${e.frameType.toString(16).padStart(2,"0")}`);if(e.payloadLen<2)throw new RangeError(`ERROR sideband payload too small: ${e.payloadLen}`);let t=e.headerLen,r=t+e.payloadLen;if(i.byteLength<r)throw new RangeError("ERROR sideband truncated");let s=new DataView(i.buffer,i.byteOffset,i.byteLength),n=new TextDecoder("utf-8",{fatal:!1});if(o!==void 0&&e.payloadLen>=ci&&s.getBigUint64(t,!1)===o){let N=s.getUint16(t+8,!1);return{header:e,layout:"seq-linked",seq:o,code:N,name:Jp(N)??li(N),reason:n.decode(i.subarray(t+ci,r))}}let p=s.getUint16(t,!1),c=n.decode(i.subarray(t+2,r));return{header:e,layout:"sideband",code:p,name:Jp(p),reason:c}}u(Nr,"decodeErrorSideband");function pP(i,o){if(i.byteLength-o<H)return;for(let c=0;c<br.length;c+=1)if(i[o+c]!==br[c])return;let e=new DataView(i.buffer,i.byteOffset+o,i.byteLength-o),t=i[o+4],r=i[o+5],s=e.getUint16(6,!1),n=e.getUint32(12,!1);if(s<H)return;let p=s+n;if((r&We.EXTENDED_HEADER)!==0&&(p+=Zh(r),t===L.HELLO_ACK&&(p+=No)),t===L.HELLO_ACK&&(r&We.SESSION_PARAMS)!==0&&(p+=8+Qp),!(o+p>i.byteLength))return p}u(pP,"frameByteLengthAt");function wi(i){let o=[],e=0;for(;e<i.byteLength;){let t=pP(i,e);if(t===void 0)return o.push(i.subarray(e)),o;o.push(i.subarray(e,e+t)),e+=t}return o.length>0?o:[i]}u(wi,"splitFrames");var m2=is-H;var y2=64*1024;function mm(i,o=15){let e=new Uint16Array(o+1);for(let s of i)e[s]+=1;e[0]=0;let t=new Uint16Array(o+2);for(let s=1;s<=o;s+=1)t[s+1]=t[s]+e[s];let r=new Uint16Array(i.length);for(let s=0;s<i.length;s+=1)i[s]!==0&&(r[t[i[s]]]=s,t[i[s]]+=1);return{counts:e,symbols:r}}u(mm,"buildHuffTable");var R2=(()=>{let i=new Uint8Array(288);for(let o=0;o<=143;o+=1)i[o]=8;for(let o=144;o<=255;o+=1)i[o]=9;for(let o=256;o<=279;o+=1)i[o]=7;for(let o=280;o<=287;o+=1)i[o]=8;return mm(i)})(),g2=(()=>{let i=new Uint8Array(30).fill(5);return mm(i)})();var Xh=2;function ym(i,o){if(o.reasonCode<0||o.reasonCode>65535)throw new RangeError(`GOODBYE reasonCode out of u16 range: ${o.reasonCode}`);let e=new Uint8Array(H+Xh);return e.set(er({frameType:L.GOODBYE,flags:0,headerLen:H,sessionId:i,payloadLen:Xh}),0),new DataView(e.buffer,e.byteOffset,e.byteLength).setUint16(16,o.reasonCode,!1),e}u(ym,"encodeGoodbye");function Rm(i,o=new Uint8Array(0)){let e=new Uint8Array(H+o.byteLength);return e.set(er({frameType:L.PONG,flags:0,headerLen:H,sessionId:i,payloadLen:o.byteLength}),0),o.byteLength>0&&e.set(o,H),e}u(Rm,"encodePong");var P2=1024*1024;var ds=16,cP=144;var uP=new Uint8Array([78,80,80,1]),lP={HELLO:0,HELLO_ACK:1,PUBLISH:2,PUBLISH_BATCH:3,BULK_ACK:4,SUBSCRIBE:5,DELIVER:6,DELIVER_BATCH:7,ACK:8,SEEK:9,FLOW_CREDIT:13,PING:14,PONG:15,GOODBYE:16,ERROR:17,SYS_EVENT:18,REKEY:19},wP={COMPRESSED:1,ENCRYPTED:2,BATCH:4,URGENT:8,RESERVED_V2:16,EXTENDED_HEADER:32,PQ_HYBRID:64};function hP(i){if(i.byteLength<ds)throw new RangeError(`frame too short for common header: ${i.byteLength} < ${ds}`);for(let p=0;p<4;p+=1)if(i[p]!==uP[p])throw new Error("npp: bad magic \u2014 not an NPP frame");let o=new DataView(i.buffer,i.byteOffset,i.byteLength),e=i[4],t=i[5],r=o.getUint16(6,!1),s=o.getUint32(8,!1),n=o.getUint32(12,!1);if(r<ds)throw new RangeError(`headerLen below minimum: ${r} < ${ds}`);return{frameType:e,flags:t,headerLen:r,sessionId:s,payloadLen:n}}u(hP,"decodeCommonHeader");var Er=cP,mP=3309;var yP=32,RP="traceparent",hi={STRING:0,NUMBER:1,BOOL:2,NULL:3};function gP(i,o){let e=new TextDecoder;switch(i){case hi.STRING:return e.decode(o);case hi.NUMBER:return Number(e.decode(o));case hi.BOOL:return o[0]===1;case hi.NULL:return null;default:throw new RangeError(`DELIVER attribute: unknown value tag 0x${i.toString(16)}`)}}u(gP,"decodeAttrValue");function PP(i,o){let e=new DataView(i.buffer,i.byteOffset,i.byteLength),t=new TextDecoder,r=[],s=0;for(let n=0;n<o;n+=1){if(s+4>i.byteLength)throw new RangeError(`DELIVER attribute ${n} header truncated`);let p=e.getUint16(s,!1),c=e.getUint16(s+2,!1);if(s+=4,c<1||s+p+c>i.byteLength)throw new RangeError(`DELIVER attribute ${n} body truncated`);let N=t.decode(i.slice(s,s+p));s+=p;let E=i[s],S=gP(E,i.slice(s+1,s+c));s+=c,r.push({key:N,value:S})}return{attributes:r,byteLength:s}}u(PP,"decodeDeliverAttributes");var _2=new Uint8Array([78,80,80,84]);function bP(i){if(i.byteLength<80)throw new RangeError(`envelope too short for signing input: ${i.byteLength}`);return i.slice(8,80)}u(bP,"canonicalDeliverSigningInput");function fP(i){if(i.byteLength<Er)throw new RangeError(`bytes too short for DELIVER envelope: ${i.byteLength} < ${Er}`);let o=hP(i);if(o.frameType!==lP.DELIVER)throw new Error(`decodeDeliverFrame: expected frameType=DELIVER (0x06), got 0x${o.frameType.toString(16).padStart(2,"0")}`);let e=new DataView(i.buffer,i.byteOffset,i.byteLength),t=e.getUint32(16,!1),r=e.getUint32(20,!1),s=e.getBigUint64(24,!1),n=e.getBigUint64(32,!1),p=e.getUint32(40,!1),c=i[44],N=i[45],E=e.getUint16(46,!1),S=i.slice(48,80),A=i.slice(80,144),I=Er-ds,B=o.payloadLen-I;if(B<0)throw new RangeError(`DELIVER payloadLen header (${o.payloadLen}) smaller than envelope body (${I})`);let G=Er+B;if(i.byteLength<G)throw new RangeError(`DELIVER frame truncated: have ${i.byteLength}, expected >= ${G}`);let z=[],F=Er;if(E>0&&(o.flags&yP)!==0){let Y=PP(i.slice(Er,G),E);z=Y.attributes,F=Er+Y.byteLength}let Q=G,D=i.slice(F,Q),j=z.find(Y=>Y.key===RP),Ie=typeof j?.value=="string"?j.value:void 0,K=null;if(o.flags&wP.PQ_HYBRID){let Y=Q,U=Y+mP;if(i.byteLength<U)throw new RangeError(`DELIVER frame PQ_HYBRID flag set but Dilithium sig truncated: have ${i.byteLength}, expected >= ${U}`);K=i.slice(Y,U)}let W=bP(i.slice(0,Er));return{flags:o.flags,sessionId:o.sessionId,channelId:t,partitionId:r,sequence:s,hlcTimestamp:n,schemaFingerprint:p,qosLevel:c,encryptionMode:N,attributesCount:E,attributes:z,traceparent:Ie,payloadHash:S,detachedSignature:A,payload:D,dilithiumSignature:K,signingInput:W}}u(fP,"decodeDeliverFrame");var Sm=class extends Error{static{u(this,"CellError")}code;statusCode;constructor(i,o="CELL_ERROR",e=500){super(i),this.name="CellError",this.code=o,this.statusCode=e,Object.setPrototypeOf(this,new.target.prototype)}toJSON(){return{name:this.name,code:this.code,message:this.message,statusCode:this.statusCode}}};var vP=class extends Sm{static{u(this,"CellPlanRequiredError")}product;upgradeUrl;constructor(i,o={}){super(i,o.code??"PLAN_REQUIRED",402),this.name="CellPlanRequiredError",this.product=o.product,this.upgradeUrl=o.upgradeUrl}toJSON(){return{...super.toJSON(),...this.product!==void 0?{product:this.product}:{},...this.upgradeUrl!==void 0?{upgradeUrl:this.upgradeUrl}:{}}}},NP=class extends Sm{static{u(this,"CellQuotaExceededError")}upgradeUrl;constructor(i,o={}){super(i,o.code??"QUOTA_EXCEEDED",429),this.name="CellQuotaExceededError",this.upgradeUrl=o.upgradeUrl}toJSON(){return{...super.toJSON(),...this.upgradeUrl!==void 0?{upgradeUrl:this.upgradeUrl}:{}}}};function dc(i){return`${i.thumbprint}\0${i.channelGid}`}u(dc,"nppSequenceKeyId");var ws=class{static{u(this,"InMemoryNppSequenceStore")}states=new Map;tails=new Map;async exclusive(i,o){let e=dc(i),t=this.tails.get(e)??Promise.resolve(),r,s=new Promise(p=>{r=p}),n=t.then(()=>s);this.tails.set(e,n),await t;try{return await o({load:u(async()=>({...this.states.get(e)??{lastAccepted:0n}}),"load"),save:u(async p=>{this.states.set(e,{...p})},"save")})}finally{r(),this.tails.get(e)===n&&this.tails.delete(e)}}},hs=new ws,EP=0,SP=1,_P=2,kP=3,TP=16,CP=17,xP="another process signing with this credential's key already stored this sequence on the channel with an identical payload; this publish was NOT stored as a new message. The producer moved past it \u2014 publish again to store it.",AP="another process signing with this credential's key already used this sequence on the channel (a different HOME, container or host holding the same credential); this publish was NOT stored. The producer moved past it.",IP="the broker's last accepted sequence for this producer on the channel is lower than this producer recorded; the producer rewound, and the next publish restarts the sequence.";async function ms(i,o,e){return i.exclusive(o,async t=>{let r=await t.load();for(let s=!1;;s=!0){let n=r.lastAccepted+1n,p=r.inFlight===n;await t.save({lastAccepted:r.lastAccepted,inFlight:n});let c=await e(n);switch(c.status){case EP:case _P:case kP:return await t.save({lastAccepted:n}),{answer:c,sequence:n,verdict:{kind:"stored"}};case SP:return await t.save({lastAccepted:n}),p||c.retried===!0?{answer:c,sequence:n,verdict:{kind:"stored"}}:{answer:c,sequence:n,verdict:{kind:"conflict",reason:xP}};case CP:if(await t.save({lastAccepted:n}),p&&!s){r={lastAccepted:n};continue}return{answer:c,sequence:n,verdict:{kind:"conflict",reason:AP}};case TP:return await t.save({lastAccepted:0n}),{answer:c,sequence:n,verdict:{kind:"rewound",reason:IP}};default:return{answer:c,sequence:n,verdict:{kind:"unsettled"}}}}})}u(ms,"publishAtNextSequence");var Ao="KERNEL_DOOR_URL",ls=8,oe={ACK_CLASS:1,PRODUCER_EPOCH:2,BYTE_CREDIT:4,SUBSCRIPTION_HANDLE:5,POSITION:6,PARTITION:7,ROUTE_EPOCH:8,ENGINE_INFO:9,ACK_STRIDE:11,RECORD_KEY:16,TENANT_SELECT:17,CURSOR_ID:18,NACK_DELAY_MS:19,INITIAL_CREDIT:20,LINK_ORIGIN:21,MESSAGE_GID:22},GP={2:"ACCEPTED_LOCAL",3:"ACCEPTED_GEO",81:"DEFERRED_UNDER_REPLICATED",82:"REJECTED_ROUTE_EPOCH",83:"REJECTED_CLASS_UNAVAILABLE",84:"REJECTED_WRONG_PARTITION",85:"REJECTED_NOT_PRIMARY",105:"REJECTED_PRODUCER_EPOCH"},gm=85,Pm=255,bm=250,MP=1e3,_m="plan_required",mi="internal_apps",xo="/settings/billing";function km(i){let o=i.indexOf(":");return o<0?i:i.slice(0,o)}u(km,"reasonToken");function yi(i){return km(i)===_m}u(yi,"isKernelPlanRefusal");var Tm="quota_exceeded",sc="/settings/billing";function Cm(i){return km(i)===Tm}u(Cm,"isKernelQuotaRefusal");var xm=class extends vP{static{u(this,"KernelPlanRequiredError")}kernelStatus;kernelStatusName;kernelReason;constructor(i,o){super("PLAN_REQUIRED: this app publishes only on a plan, so the message was not published; choose a plan at "+xo,{code:"PLAN_REQUIRED",product:mi,upgradeUrl:xo}),this.name="KernelPlanRequiredError",this.kernelStatus=i,this.kernelStatusName=or(i)??cs(i),this.kernelReason=o}},Am=class extends NP{static{u(this,"KernelQuotaExceededError")}kernelStatus;kernelStatusName;kernelReason;constructor(i,o){super(`QUOTA_EXCEEDED: this organization's usage is past its allowance and it has no payment method on file, so the message was not published; add a payment method or choose a plan at ${sc}`,{code:"QUOTA_EXCEEDED",upgradeUrl:sc}),this.name="KernelQuotaExceededError",this.kernelStatus=i,this.kernelStatusName=or(i)??cs(i),this.kernelReason=o}},UP=258,Im=3,ps=new Set([0,1,2,3]);function or(i){return li(i)??GP[i]}u(or,"kernelStatusName");var J=16,Zp=22,fm=0xffffffffffffffffn,q=class extends Error{static{u(this,"KernelDoorError")}code;reasonCode;reasonName;constructor(i,o,e){if(super(o),this.name="KernelDoorError",this.code=i,e!==void 0){this.reasonCode=e;let t=or(e)??Gm[e];t!==void 0&&(this.reasonName=t)}}},Gm={1:"REJECTED_VERSION",2:"REJECTED_QOS",498:"FRAME_MALFORMED",499:"PROTOCOL_VIOLATION",500:"UPSTREAM_REFUSED",501:"UNSUPPORTED",502:"SESSION_EXPIRED"};function cs(i){return`0x${i.toString(16).padStart(4,"0")}`}u(cs,"hex16");function HP(){return globalThis.process?.env??{}}u(HP,"processEnv");function vm(i,o){let e=o==="option"?"the door option":Ao,t;try{t=new URL(i)}catch{throw new q("KERNEL_DOOR_CONFIG",`${e} is not a URL: ${JSON.stringify(i)}`)}if(t.protocol==="wss:")return{kind:"kernel",url:t.toString(),source:o};if(o==="option"&&(t.protocol==="https:"||t.protocol==="http:"))return{kind:"edge",url:i,source:o};throw new q("KERNEL_DOOR_CONFIG",`${e} must be a wss:// kernel door (TLS 1.3)${o==="option"?" or the http(s):// edge door":""}; got ${t.protocol}//`)}u(vm,"classifyDoor");function Tr(i={}){if(i.door!==void 0&&i.door.trim()!=="")return vm(i.door.trim(),"option");let e=(i.env??HP())[Ao];return e!==void 0&&e.trim()!==""?vm(e.trim(),"env"):{kind:"edge",url:i.edgeUrl,source:"default"}}u(Tr,"resolveDoor");function kr(i){if(i.byteLength<J)throw new RangeError("frame shorter than the common header");let e=new DataView(i.buffer,i.byteOffset,i.byteLength).getUint16(6,!1);if(e<J||e>i.byteLength)throw new RangeError(`bad headerLen ${e}`);let t=[],r=J;for(;r<e;){if(r+2>e)throw new RangeError("TLV region does not fill headerLen exactly");let n=i[r],p=i[r+1];if(r+2+p>e)throw new RangeError("TLV region does not fill headerLen exactly");t.push({type:n,value:i.slice(r+2,r+2+p)}),r+=2+p}if(e===J)return{canonical:i,tlvs:t};let s=new Uint8Array(i.byteLength-(e-J));return s.set(i.subarray(0,J),0),s.set(i.subarray(e),J),new DataView(s.buffer).setUint16(6,J,!1),{canonical:s,tlvs:t}}u(kr,"stripKernelTlvs");function To(i,o){if(o.length===0)return i;if(new DataView(i.buffer,i.byteOffset,i.byteLength).getUint16(6,!1)!==J)throw new RangeError("insertKernelTlvs expects a canonical frame");let t=0;for(let p of o){if(p.value.byteLength>255)throw new RangeError(`TLV 0x${p.type.toString(16)} value longer than 255 bytes`);t+=2+p.value.byteLength}let r=J+t;if(r>65535)throw new RangeError("TLV region too large");let s=new Uint8Array(i.byteLength+t);s.set(i.subarray(0,J),0);let n=J;for(let p of o)s[n]=p.type,s[n+1]=p.value.byteLength,s.set(p.value,n+2),n+=2+p.value.byteLength;return s.set(i.subarray(J),n),new DataView(s.buffer).setUint16(6,r,!1),s}u(To,"insertKernelTlvs");function BP(i){return Uint8Array.of(i&255)}u(BP,"tlvU8");function ko(i){let o=new Uint8Array(4);return new DataView(o.buffer).setUint32(0,i>>>0,!1),o}u(ko,"tlvU32");function qP(i){let o=new Uint8Array(8);return new DataView(o.buffer).setBigUint64(0,i,!1),o}u(qP,"tlvU64");function us(i,o){return i.find(e=>e.type===o)?.value}u(us,"findTlv");function Nm(i){return new DataView(i.buffer,i.byteOffset,i.byteLength).getUint32(0,!1)}u(Nm,"readU32");function Ri(i,o){let e=us(o,oe.ACK_STRIDE);if(!e||e[0]!==Zp)return dm(i).records.map(n=>({seq:n.seq,status:n.status}));let t=be(i);if(t.payloadLen%Zp!==0||J+t.payloadLen>i.byteLength)throw new RangeError("positioned BULK_ACK records do not fill payloadLen");let r=new DataView(i.buffer,i.byteOffset,i.byteLength),s=[];for(let n=J;n<J+t.payloadLen;n+=Zp)s.push({seq:r.getBigUint64(n,!1),status:r.getUint16(n+8,!1),position:{partition:r.getUint32(n+10,!1),offset:r.getBigUint64(n+14,!1)}});return s}u(Ri,"readKernelBulkAck");function gi(i){let o=us(i,oe.MESSAGE_GID);return o&&o.byteLength>0?cc.decode(o):void 0}u(gi,"readKernelMessageGid");var Mm=3e4,Um=250;function LP(i){let o=u(e=>e!==null&&typeof e=="object"&&!Array.isArray(e),"isDoc");return o(i)?[i,i.channel,i.data].filter(o):[]}u(LP,"channelAnswerDocs");async function pc(i,o={}){let e=o.waitMs??Mm,t=o.pollMs??Um,r=Date.now()+e;for(;;){let s;try{s=await i()}catch(c){return{refused:"read",detail:`the read of its answer was refused (${c instanceof Error?c.message:String(c)})`}}let n=LP(s);if(n.map(c=>c.engine).find(c=>typeof c=="string")==="convex")return{refused:"convex",detail:"its answer names the engine convex, which has no kernel table"};let p=n.map(c=>c.kernelTableId).find(c=>typeof c=="number"&&Number.isInteger(c)&&c>=0&&c<=4294967295);if(p!==void 0)return{table:p};if(Date.now()+t>r)return{refused:"pending",detail:`its answer named no kernelTableId within ${e} ms (the compile still pending)`};await new Promise(c=>setTimeout(c,t))}}u(pc,"resolveKernelTableId");function FP(i,o){try{for(let e of o){let t=Nr(i,e);if(t.layout==="seq-linked")return t}return Nr(i)}catch{return}}u(FP,"decodeLinkedError");async function Hm(i){let o=await nc(i.payload),e={frameType:L.PUBLISH,flags:0,headerLen:J,sessionId:i.sessionId,payloadLen:i.payload.byteLength},t={channelId:i.table,partitionId:i.partition,sequence:i.seq,hlcTimestamp:0n,schemaFingerprint:0,qosLevel:i.qosLevel??1,encryptionMode:0,attributesCount:0,payloadHash:o,detachedSignature:new Uint8Array(64)},r=Yp(e,t),s=await i.sign(ui(r));if(s.byteLength!==64)throw new RangeError(`a PUBLISH signature is 64 bytes, got ${s.byteLength}`);let n=Yp(e,{...t,detachedSignature:s}),p=new Uint8Array(n.byteLength+i.payload.byteLength);return p.set(n,0),p.set(i.payload,n.byteLength),i.tlvs&&i.tlvs.length>0?To(p,i.tlvs):p}u(Hm,"encodeKernelPublishFrame");var ec=64;function Bm(i){let o=new DataView(i.buffer,i.byteOffset,i.byteLength);if(i.byteLength<fr||o.getUint16(6,!1)!==J)throw new RangeError("a SUBSCRIBE signing input is read from the canonical form (headerLen 16, a 32-byte body)");let e=J+o.getUint32(12,!1),t=fr;for(let r=0,s=i[J+28];r<s;r++){if(t+3>e)throw new RangeError("a SUBSCRIBE filter runs past the body");t+=3+(i[t+1]<<8|i[t+2])}if(t>e)throw new RangeError("a SUBSCRIBE filter runs past the body");return i.slice(8,t)}u(Bm,"kernelSubscribeSigningInput");async function qm(i){let o;if(i.sign){o=So({sessionId:i.sessionId,envelope:i.envelope,consumerSignature:new Uint8Array(ec)});let e=await i.sign(Bm(o));if(e.byteLength!==ec)throw new RangeError(`a SUBSCRIBE consumerSignature is 64 bytes, got ${e.byteLength}`);o.set(e,o.byteLength-ec)}else o=So({sessionId:i.sessionId,envelope:i.envelope});return i.tlvs&&i.tlvs.length>0?To(o,i.tlvs):o}u(qm,"encodeKernelSubscribeFrame");var rc=Uint8Array.from([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32]),Sr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function rr(i){let o="",e=0;for(;e+2<i.length;e+=3){let t=i[e]<<16|i[e+1]<<8|i[e+2];o+=Sr[t>>18&63]+Sr[t>>12&63]+Sr[t>>6&63]+Sr[t&63]}if(e<i.length){let t=i[e]<<16|(e+1<i.length?i[e+1]:0)<<8;o+=Sr[t>>18&63]+Sr[t>>12&63],e+1<i.length&&(o+=Sr[t>>6&63])}return o}u(rr,"b64u");function Pi(i){let o=i.replace(/=+$/,""),e=[],t=0,r=0;for(let s of o){let n=Sr.indexOf(s==="+"?"-":s==="/"?"_":s);if(n<0)throw new RangeError("not base64url");t=t<<6|n,r+=6,r>=8&&(r-=8,e.push(t>>r&255))}return Uint8Array.from(e)}u(Pi,"b64uDecode");function DP(i){let o=i.split(".")[1];if(o)try{let e=JSON.parse(cc.decode(Pi(o)));return typeof e.npk_unit=="string"?e.npk_unit:void 0}catch{return}}u(DP,"tokenUnitOf");function zP(i){let o=rr(i).replace(/-/g,"+").replace(/_/g,"/");return o+"=".repeat((4-o.length%4)%4)}u(zP,"b64std");var _r=new TextEncoder,cc=new TextDecoder;function Co(){let i=globalThis.crypto;if(!i?.subtle)throw new q("KERNEL_DOOR_CONFIG","Web Crypto (globalThis.crypto.subtle) is not available");return i.subtle}u(Co,"subtle");function tc(i){let o=new Uint8Array(i);return globalThis.crypto.getRandomValues(o),o}u(tc,"randomBytes");async function nc(i){return new Uint8Array(await Co().digest("SHA-256",i))}u(nc,"sha256");var uc=class ac{static{u(this,"_KernelDoorKey")}jkt;publicKeyRaw;privateKey;constructor(o,e,t){this.privateKey=o,this.publicKeyRaw=e,this.jkt=t}static async fromSeed(o){if(o.byteLength!==32)throw new RangeError("an Ed25519 seed is 32 bytes");let e=new Uint8Array(rc.byteLength+32);e.set(rc,0),e.set(o,rc.byteLength);let t=await Co().importKey("pkcs8",e,{name:"Ed25519"},!0,["sign"]),r=await Co().exportKey("jwk",t);if(typeof r.x!="string")throw new q("KERNEL_DOOR_CONFIG","Ed25519 key export carried no public x");let s=Pi(r.x),n=`{"crv":"Ed25519","kty":"OKP","x":"${rr(s)}"}`,p=rr(await nc(_r.encode(n)));return new ac(t,s,p)}static async generate(){return ac.fromSeed(tc(32))}async sign(o){return new Uint8Array(await Co().sign({name:"Ed25519"},this.privateKey,o))}async dpopProof(o,e,t=Date.now()){let r={typ:"dpop+jwt",alg:"EdDSA",jwk:{kty:"OKP",crv:"Ed25519",x:rr(this.publicKeyRaw)}},s={jti:rr(tc(16)),htm:"POST",htu:`https://${o}/v1/npp`,iat:Math.floor(t/1e3),ath:rr(await nc(_r.encode(e)))},n=`${rr(_r.encode(JSON.stringify(r)))}.${rr(_r.encode(JSON.stringify(s)))}`;return`${n}.${rr(await this.sign(_r.encode(n)))}`}},Lm="pass nodeKeys: the JWKS the kernel serves at GET /.well-known/npp-cell-jwks.json on its control door, its https:// URL, or the raw 32-byte Ed25519 key";function OP(i){if(i==null)throw new q("KERNEL_DOOR_CONFIG",`no node key source to verify the HELLO_ACK with: ${Lm}`);if(i instanceof Uint8Array){if(i.byteLength!==32)throw new q("KERNEL_DOOR_CONFIG",`a raw node key is 32 bytes (Ed25519), got ${i.byteLength}`);return{raws:[i]}}if(typeof i=="string"){let o;try{o=new URL(i)}catch{throw new q("KERNEL_DOOR_CONFIG",`nodeKeys is not a URL: ${JSON.stringify(i)}`)}if(o.protocol!=="https:")throw new q("KERNEL_DOOR_CONFIG",`a node JWKS URL must be https://, got ${o.protocol}//`);return{url:o.toString()}}return{raws:Fm(i)}}u(OP,"classifyNodeKeys");function Fm(i){let o=i?.keys;if(!Array.isArray(o))throw new q("KERNEL_DOOR_CONFIG",`nodeKeys is not a JWKS document (no keys array): ${Lm}`);let e=[];for(let t of o){if(t?.kty!=="OKP"||t.crv!=="Ed25519"||typeof t.x!="string"||t.use!==void 0&&t.use!=="sig")continue;let r;try{r=Pi(t.x)}catch{continue}r.byteLength===32&&e.push(r)}if(e.length===0)throw new q("KERNEL_DOOR_CONFIG","the node key set holds no Ed25519 signing key (kty OKP, crv Ed25519)");return e}u(Fm,"ed25519KeysOf");async function Em(i){let o=[];for(let e of i)try{o.push(await Co().importKey("raw",e,{name:"Ed25519"},!1,["verify"]))}catch{}if(o.length===0)throw new q("KERNEL_DOOR_CONFIG","none of the node keys is a usable Ed25519 public key");return o}u(Em,"importVerifyKeys");async function jP(i,o){let e=OP(i);if("raws"in e)return Em(e.raws);let t=o??globalThis.fetch;if(typeof t!="function")throw new q("KERNEL_DOOR_CONFIG",`no fetch to read the node JWKS at ${e.url}; pass the JWKS document instead`);let r;try{let s=await t(e.url,{headers:{accept:"application/json"}});if(!s.ok)throw new Error(`HTTP ${s.status}`);r=await s.json()}catch(s){throw new q("KERNEL_DOOR_UNAVAILABLE",`could not read the node JWKS at ${e.url}: ${s.message}`)}return Em(Fm(r))}u(jP,"loadNodeVerifyKeys");async function WP(i,o,e){for(let t of i)try{if(await Co().verify({name:"Ed25519"},t,o,e))return!0}catch{}return!1}u(WP,"verifiesUnderAny");function $P(){let i=globalThis.WebSocket;if(typeof i!="function")throw new q("KERNEL_DOOR_UNAVAILABLE","no global WebSocket in this runtime; pass the `webSocket` factory option (Node < 22: the `ws` package)");return o=>new i(o)}u($P,"defaultWebSocketFactory");async function KP(i){if(i instanceof Uint8Array)return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);if(typeof i=="string"){try{let e=JSON.parse(i);if(e.type==="npp_frame"&&e.encoding==="base64"&&typeof e.data=="string")return Pi(e.data)}catch{return null}return null}let o=i;return typeof o?.arrayBuffer=="function"?new Uint8Array(await o.arrayBuffer()):null}u(KP,"messageBytes");function Dm(i){let o=i.find(e=>e.key==="npp_delivery_token")?.value;if(!(typeof o!="string"||!/^[0-9a-fA-F]{32}$/.test(o)))return{hi:BigInt(`0x${o.slice(0,16)}`),lo:BigInt(`0x${o.slice(16)}`)}}u(Dm,"deliveryTokenOf");function VP(i){if(i===void 0)return{answered:!1,accepted:!1};let o=or(i.status)??(i.error?Gm[i.status]:void 0);return{answered:!0,accepted:!i.error&&ps.has(i.status),statusCode:i.status,...o!==void 0?{statusName:o}:{},...i.reason?{reason:i.reason}:{}}}u(VP,"ackResultOf");function JP(i){if(i===void 0||i==="beginning")return 0n;if(i==="end")return fm;let o=typeof i=="bigint"?i:i.offset;if(o<0n||o>=fm-1n)throw new RangeError(`start offset out of range: ${o} (0 \u2264 offset < 2^64 \u2212 2)`);return o}u(JP,"startCursorOf");function oc(i,o){return`${i}/${o}`}u(oc,"partitionKey");function QP(){let i={parkedAt:void 0,moved:Promise.resolve(),wake:u(()=>{},"wake")};return i.moved=new Promise(o=>{i.wake=o}),i}u(QP,"newFlight");function YP(i,o){i.parkedAt=o;let e=i.wake;i.moved=new Promise(t=>{i.wake=t}),e()}u(YP,"park");function XP(i,o){return{resolve:u(e=>{o.parkedAt=void 0,i.resolve(e)},"resolve"),reject:u(e=>{o.parkedAt=void 0,i.reject(e)},"reject")}}u(XP,"unparking");var ZP=/^(?:\[[0-9A-Fa-f:.]+\]|[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?):(\d{1,5})$/;function eb(i,o){let e=ZP.exec(o);if(!e)return;let t=Number(e[1]);if(t<1||t>65535)return;let r=new URL(i);return r.host=o,r.toString()}u(eb,"redirectDoor");var bi=class{static{u(this,"KernelSubscription")}constructor(i,o,e,t,r,s){this.session=i,this.table=o,this.handle=e,this.partition=t,this.creditFrames=r,this.creditBytes=s}queue=[];waiters=[];ended;push(i){let o=this.waiters.shift();o?o.resolve(i):this.queue.push(i)}end(i){if(this.ended===void 0){this.ended=i;for(let o of this.waiters.splice(0))i?o.reject(i):o.resolve(null)}}async next(i=3e4){let o=this.queue.shift();if(o)return this.handOut(o);if(this.ended!==void 0){if(this.ended)throw this.ended;return null}let e=await new Promise((t,r)=>{let s=setTimeout(()=>{let p=this.waiters.indexOf(n);p>=0&&this.waiters.splice(p,1),r(new q("KERNEL_DOOR_TIMEOUT",`no delivery within ${i} ms`))},i),n={resolve:u(p=>{clearTimeout(s),t(p)},"resolve"),reject:u(p=>{clearTimeout(s),r(p)},"reject")};this.waiters.push(n)});return e?this.handOut(e):null}handOut(i){return this.session.sendCredit(this.table,this.handle,1,0),i}ack(i){return this.session.sendAck(this.table,this.handle,i.partition,i.offset,i.deliveryToken)}credit(i,o=0){this.session.sendCredit(this.table,this.handle,i,o)}open(){this.session.sendCredit(this.table,this.handle,this.creditFrames,this.creditBytes)}async*[Symbol.asyncIterator](){for(;;){let i=await this.next(2147483647);if(i===null)return;yield i}}},Io=class ic{static{u(this,"_KernelDoorSession")}sessionId;negotiatedCapabilities;door;ws;key;timeoutMs;options;followRedirects;sequenceStore;publishes=new Map;publishPartitions=new Map;awaitingReason=new Map;primaryHints=new Map;links=new Map;routes=new Map;lanes=new Map;owed=[];reasonDueBy;ackDeadline;subscriptions=[];closedWith;goodbyeWaiter;constructor(o){this.ws=o.ws,this.key=o.key,this.door=o.door,this.sessionId=o.sessionId,this.negotiatedCapabilities=o.negotiatedCapabilities,this.timeoutMs=o.timeoutMs,this.options=o.options,this.followRedirects=o.options.followRedirects===!0,this.sequenceStore=o.options.sequenceStore??hs}get engineExt(){return(this.negotiatedCapabilities&ls)!==0}static async connect(o){let e=Tr({door:o.door,env:o.env});if(e.kind!=="kernel"||e.url===void 0)throw new q("KERNEL_DOOR_UNAVAILABLE",`no kernel door configured: pass the door option (wss://host:port/v1/npp) or set ${Ao}`);let t=e.url;if(!o.dpop&&!o.key)throw new q("KERNEL_DOOR_CONFIG","a kernel session needs `key` or `dpop` to sign its HELLO's DPoP proof");let r=await jP(o.nodeKeys,o.fetch),s=o.timeoutMs??15e3,n=o.webSocket??$P(),p=new URL(t).host,c;try{c=n(t)}catch(K){throw new q("KERNEL_DOOR_UNAVAILABLE",`could not open ${t}: ${K.message}`)}c.binaryType="arraybuffer";let N=[],E,S,A,I=Promise.resolve();c.addEventListener("message",K=>{I=I.then(async()=>{let W=await KP(K.data);W&&(E?E.onFrame(W):S?S.resolve(W):N.push(W))})}),c.addEventListener("close",K=>{I=I.then(()=>{let W=new q("KERNEL_DOOR_UNAVAILABLE",`the kernel door closed the connection (code ${K?.code??"?"}${K?.reason?`: ${K.reason}`:""})`);E?E.onClosed(W):(A=W,S?.reject(W))})}),await new Promise((K,W)=>{let Y=setTimeout(()=>W(new q("KERNEL_DOOR_TIMEOUT",`${t} did not open within ${s} ms`)),s);c.addEventListener("open",()=>{clearTimeout(Y),K()}),c.addEventListener("error",U=>{clearTimeout(Y),W(new q("KERNEL_DOOR_UNAVAILABLE",`could not connect to ${t}${U?.error?.message??U?.message?`: ${U?.error?.message??U?.message}`:""}`))})});let B=tc(32),G=o.dpop,z=o.key,F=_r.encode(JSON.stringify({access_token:o.accessToken,dpop:G?await G.proof(`https://${p}/v1/npp`,o.accessToken):await z.dpopProof(p,o.accessToken),jkt:G?G.jkt:z.jkt,nonce:zP(B),...o.unit!==void 0?{unit:o.unit}:{},...o.sessionTtlSec!==void 0?{sessionTtlSec:o.sessionTtlSec}:{},...o.followRedirects===!0?{redirectOk:!0}:{}})),Q=nm({sessionId:0,nppVersionMajor:rm,nppVersionMinor:om,capabilityFlags:ls|em.HLC,qosCapabilities:1,authBody:F}),D=o.producerEpoch===void 0?[]:[{type:oe.PRODUCER_EPOCH,value:ko(o.producerEpoch)}];c.send(To(Q,D));let j=Date.now()+s,Ie=u(()=>{if(A)return Promise.reject(A);let K=N.shift();return K?Promise.resolve(K):new Promise((W,Y)=>{let U=setTimeout(()=>{S=void 0,Y(new q("KERNEL_DOOR_TIMEOUT",`no HELLO_ACK within ${s} ms`))},Math.max(1,j-Date.now()));S={resolve:u(ie=>{clearTimeout(U),S=void 0,W(ie)},"resolve"),reject:u(ie=>{clearTimeout(U),S=void 0,Y(ie)},"reject")}})},"nextEarly");try{for(;;){let K=await Ie(),{canonical:W}=kr(K),Y=be(W);if(Y.frameType===L.ERROR){let se=hm(W).frame;throw new q("KERNEL_DOOR_REFUSED",`HELLO refused: ${cs(se.reasonCode)}`,se.reasonCode)}if(Y.frameType===L.GOODBYE)throw new q("KERNEL_DOOR_REFUSED","the kernel said GOODBYE before HELLO_ACK");if(Y.frameType!==L.HELLO_ACK)continue;let U=im(W);if(!U.nonceEcho||!U.serverSignature)throw new q("KERNEL_DOOR_PROTOCOL","HELLO_ACK carries no node signature trailer (nonceEcho + signature)");let ie=!1;for(let se of am(W))if(await WP(r,U.serverSignature,se)){ie=!0;break}if(!ie)throw new q("KERNEL_DOOR_PROTOCOL","HELLO_ACK node signature does not verify against the node's published keys");if(!rb(U.nonceEcho,B))throw new q("KERNEL_DOOR_PROTOCOL","HELLO_ACK nonceEcho is not this connection's nonce");if(U.sessionId===0)throw new q("KERNEL_DOOR_PROTOCOL","HELLO_ACK sessionId MUST be non-zero");E=new ic({ws:c,key:o.key,door:t,sessionId:U.sessionId,negotiatedCapabilities:U.negotiatedCapabilities,timeoutMs:s,options:{...o,door:t,env:{}}});for(let se of N.splice(0))E.onFrame(se);return E}}catch(K){try{c.close()}catch{}throw K instanceof q?K:new q("KERNEL_DOOR_PROTOCOL",`bad HELLO answer: ${K.message}`)}}send(o){if(this.closedWith!==void 0)throw this.closedWith??new q("KERNEL_DOOR_UNAVAILABLE","the session is closed");this.ws.send(o)}wait(o,e,t){return new Promise((r,s)=>{let n=setTimeout(()=>{e(),s(new q("KERNEL_DOOR_TIMEOUT",`no ${t} within ${this.timeoutMs} ms`))},this.timeoutMs);o({resolve:u(p=>{clearTimeout(n),r(p)},"resolve"),reject:u(p=>{clearTimeout(n),s(p)},"reject")})})}async publish(o){if(o.seq!==void 0)return this.publishAt({...o,seq:o.seq});if(this.closedWith!==void 0)throw this.closedWith??new q("KERNEL_DOOR_UNAVAILABLE","the session is closed");let{answer:e,sequence:t,verdict:r}=await ms(this.sequenceStore,this.producerScope(o),n=>this.publishAt({...o,seq:n}).then(p=>({result:p,status:p.statusCode}))),{result:s}=e;return r.kind==="stored"?{...s,accepted:!0}:r.kind==="unsettled"?s:{accepted:!1,statusCode:s.statusCode,statusName:s.statusName,sequence:s.sequence,...s.position?{position:s.position}:{},sequenceConflict:{sequence:t,reason:r.reason}}}producerScope(o){let e=this.options,t=e.producerEpoch!==void 0?`epoch ${e.producerEpoch}`:`session ${this.sessionId}`;return{thumbprint:e.dpop?.jkt??this.key?.jkt??"",channelGid:`kernel:${e.unit??DP(e.accessToken)??""}/${o.table}/${o.partition}@${t}`}}async publishAt(o){if(o.seq<1n)throw new RangeError("seq must be \u2265 1 (seq 0 is the SUBSCRIBE acceptance record)");if(this.closedWith!==void 0)throw this.closedWith??new q("KERNEL_DOOR_UNAVAILABLE","the session is closed");let e=oc(o.table,o.partition),t=this.joinLane(e);try{if(!this.followRedirects)return(await this.publishOnce(o,t)).result;let r=await this.routeFor(e);for(let s=0;;s+=1){let{result:n,primary:p}=await r.publishOnce(o,t);if(n.statusCode!==gm||p===void 0||s>=Im)return n;let c=eb(r.door,p.authority);if(c===void 0)return n;r=await this.linkTo(c),r===this?this.routes.delete(e):this.routes.set(e,c)}}finally{this.leaveLane(t)}}joinLane(o){let e=QP(),t=this.lanes.get(o);return t?t.push(e):this.lanes.set(o,[e]),{origin:this,key:o,flight:e}}leaveLane(o){let e=this.lanes.get(o.key),t=e?e.indexOf(o.flight):-1;e&&t>=0&&(e.splice(t,1),e.length===0&&this.lanes.delete(o.key)),o.flight.wake()}async turnAt(o,e){for(;;){let t=this.lanes.get(o.key)??[],r=t.indexOf(o.flight),s=r<0?void 0:t.slice(0,r).find(n=>n.parkedAt!==e);if(s===void 0)return;await s.moved}}async routeFor(o){let e=this.routes.get(o);if(e===void 0)return this;let t=await this.links.get(e)?.catch(()=>{});return t!==void 0&&t.closedWith===void 0?t:(this.routes.delete(o),this.primaryHints.delete(o),this)}async linkTo(o){if(o===this.door)return this;let e=this.links.get(o);if(e!==void 0){let r=await e.catch(()=>{});if(r!==void 0&&r.closedWith===void 0)return r;if(this.links.get(o)!==e)return this.linkTo(o);this.links.delete(o)}let t=ic.connect({...this.options,door:o,env:{}});this.links.set(o,t);try{return await t}catch(r){throw this.links.get(o)===t&&this.links.delete(o),r}}async publishOnce(o,e){if(o.seq<1n)throw new RangeError("seq must be \u2265 1 (seq 0 is the SUBSCRIBE acceptance record)");if(this.publishes.has(o.seq))throw new RangeError(`a PUBLISH with seq ${o.seq} is already waiting for its ack`);let t=[];o.ackClass!==void 0&&t.push({type:oe.ACK_CLASS,value:BP(o.ackClass)}),o.key&&t.push({type:oe.RECORD_KEY,value:o.key}),o.tenant!==void 0&&t.push({type:oe.TENANT_SELECT,value:_r.encode(o.tenant)});let r=this.key;if(!r)throw new q("KERNEL_DOOR_CONFIG","a PUBLISH is signed with the session key: connect with `key` to publish");let s=await Hm({sessionId:this.sessionId,table:o.table,partition:o.partition,seq:o.seq,payload:o.payload,sign:u(p=>r.sign(p),"sign"),...this.engineExt?{tlvs:t}:{}});if(await e.origin.turnAt(e,this.door),this.closedWith!==void 0)throw this.closedWith??new q("KERNEL_DOOR_UNAVAILABLE","the session is closed");if(this.publishes.has(o.seq))throw new RangeError(`a PUBLISH with seq ${o.seq} is already waiting for its ack`);let n=this.wait(p=>{this.publishes.set(o.seq,XP(p,e.flight)),this.publishPartitions.set(o.seq,oc(o.table,o.partition))},()=>{this.publishes.delete(o.seq),this.publishPartitions.delete(o.seq),e.flight.parkedAt=void 0},`BULK_ACK for seq ${o.seq}`);return this.send(s),YP(e.flight,this.door),n}async subscribe(o){if(this.owed.some(E=>E.kind==="subscribe"))throw new RangeError("a SUBSCRIBE is already waiting for its acceptance");let e=o.mode==="queue";if(e&&(o.cursorId===void 0||!this.engineExt))throw new q("KERNEL_DOOR_CONFIG",o.cursorId===void 0?"a queue SUBSCRIBE names its durable cursor (cursorId, TLV CURSOR_ID)":"a queue SUBSCRIBE names its cursor in a TLV, which needs a session that negotiated ENGINE_EXT");let t=[];o.partition!==void 0&&t.push({type:oe.PARTITION,value:ko(o.partition)}),o.cursorId!==void 0&&t.push({type:oe.CURSOR_ID,value:qP(o.cursorId)}),o.tenant!==void 0&&t.push({type:oe.TENANT_SELECT,value:_r.encode(o.tenant)});let r=this.key,s=await qm({sessionId:this.sessionId,...r?{sign:u(E=>r.sign(E),"sign")}:{},tlvs:t,envelope:{channelId:o.table,mode:e?1:0,deliveryPreference:e?2:0,qosCapabilities:1,partitionFilter:0,startCursor:o.cursorId!==void 0?0n:JP(o.from),startHlc:0n,filters:[]}});this.send(s);let n,p=await this.wait(E=>{n={kind:"subscribe",waiter:E},this.owed.push(n)},()=>this.forgetOwed(n),"SUBSCRIBE acceptance");if(p.error||!ps.has(p.status)){let E=p.error?cs(p.status):or(p.status)??cs(p.status);throw new q("KERNEL_DOOR_REFUSED",`SUBSCRIBE refused: ${E}`,p.status)}let c=us(p.tlvs,oe.SUBSCRIPTION_HANDLE),N=new bi(this,o.table,c?Nm(c):void 0,o.partition,o.credit??64,o.creditBytes??4*1024*1024);return this.subscriptions.push(N),this.closedWith!==void 0?N.end(this.closedWith):N.open(),N}sendCredit(o,e,t,r){if(this.closedWith!==void 0)return;let s=lm(this.sessionId,{channelId:o,creditDelta:t,projectedLagMs:0,bandwidthBudgetBps:0}),n=[];r>0&&n.push({type:oe.BYTE_CREDIT,value:ko(r)}),e!==void 0&&n.push({type:oe.SUBSCRIPTION_HANDLE,value:ko(e)}),this.send(this.engineExt?To(s,n):s)}sendAck(o,e,t,r,s){let n=um(this.sessionId,o,[{seq:r,disposition:0,...s?{deliveryToken:s}:{}}]),p=[{type:oe.PARTITION,value:ko(t)}];return e!==void 0&&p.push({type:oe.SUBSCRIPTION_HANDLE,value:ko(e)}),this.send(this.engineExt?To(n,p):n),new Promise(c=>{this.owed.push({kind:"ack",settle:u(N=>c(VP(N)),"settle"),at:Date.now()}),this.armAckDeadline()})}answerOwed(o){let e;!o.error&&!ps.has(o.status)?e="subscribe":!o.error&&this.engineExt&&(e=us(o.tlvs,oe.SUBSCRIPTION_HANDLE)?"subscribe":"ack");let t=e===void 0?this.owed.length>0?0:-1:this.owed.findIndex(s=>s.kind===e);if(t<0)return;let[r]=this.owed.splice(t,1);if(r.kind==="ack"){r.settle(o);return}for(let s of this.owed.splice(0,t))s.kind==="ack"&&s.settle(void 0);r.waiter.resolve(o)}controlError(o,e){let t=this.reasonDueBy;this.reasonDueBy=void 0,!(t!==void 0&&Date.now()<=t)&&this.answerOwed({status:o,tlvs:[],error:!0,reason:e})}forgetOwed(o){let e=o===void 0?-1:this.owed.indexOf(o);e>=0&&this.owed.splice(e,1)}armAckDeadline(){if(this.ackDeadline!==void 0)return;let o=this.owed.find(t=>t.kind==="ack");if(o===void 0)return;let e=Math.max(Math.min(MP,this.timeoutMs),o.at+this.timeoutMs-Date.now());this.ackDeadline=setTimeout(()=>{this.ackDeadline=void 0;let t=Date.now(),r=[],s=[],n=!0;for(let p of this.owed){if(p.kind==="ack"&&n){if(t-p.at>=this.timeoutMs){r.push(p);continue}n=!1}s.push(p)}if(r.length>0){this.owed.length=0;for(let p of s)this.owed.push(p)}for(let p of r)p.settle(void 0);this.armAckDeadline()},e)}async close(o=5e3){if(this.closedWith!==void 0)return;let e=[...this.links.values()];this.links.clear(),await Promise.all(e.map(r=>r.then(s=>s.close(o)).catch(()=>{})));let t=new Promise(r=>{let s=setTimeout(r,o);this.goodbyeWaiter=()=>{clearTimeout(s),r()}});try{this.ws.send(ym(this.sessionId,{reasonCode:0}))}catch{}await t,this.onClosed(null);try{this.ws.close()}catch{}}onClosed(o){if(this.closedWith!==void 0)return;this.closedWith=o;let e=o??new q("KERNEL_DOOR_UNAVAILABLE","the session is closed");for(let t of this.publishes.values())t.reject(e);this.publishes.clear(),this.publishPartitions.clear();for(let t of this.awaitingReason.values())clearTimeout(t.timer),t.waiter.resolve(t.answer);this.awaitingReason.clear();for(let t of this.links.values())t.then(r=>r.close()).catch(()=>{});this.links.clear(),this.routes.clear();for(let t of this.owed.splice(0))t.kind==="subscribe"?t.waiter.reject(e):t.settle(void 0);this.ackDeadline!==void 0&&clearTimeout(this.ackDeadline),this.ackDeadline=void 0,this.reasonDueBy=void 0;for(let t of this.subscriptions)t.end(o);this.goodbyeWaiter?.()}onFrame(o){let e,t;try{({canonical:e,tlvs:t}=kr(o))}catch{return}let r=be(e);switch(r.frameType){case L.PING:this.ws.send(Rm(this.sessionId,e.slice(J,J+r.payloadLen)));return;case L.BULK_ACK:{let s=Ri(e,t),n=s.length===1?gi(t):void 0;for(let p of s){if(p.seq===0n){this.reasonDueBy=p.status===Pm?Date.now()+bm:void 0,this.answerOwed({status:p.status,tlvs:t,error:!1});continue}let c=this.publishes.get(p.seq);if(!c)continue;this.publishes.delete(p.seq);let N=this.publishPartitions.get(p.seq);this.publishPartitions.delete(p.seq);let E=p.status===gm&&N!==void 0?this.primaryHints.get(N):void 0,S={result:{accepted:ps.has(p.status),statusCode:p.status,statusName:or(p.status),sequence:p.seq,...p.position?{position:p.position}:{},...n!==void 0&&ps.has(p.status)?{messageGid:n}:{}},...E?{primary:E}:{}};if(p.status===Pm){let A=p.seq,I=setTimeout(()=>{let B=this.awaitingReason.get(A);B&&(this.awaitingReason.delete(A),B.waiter.resolve(B.answer))},bm);this.awaitingReason.set(A,{waiter:c,answer:S,timer:I});continue}c.resolve(S)}return}case L.DELIVER:this.route(this.readDeliver(e),void 0);return;case L.DELIVER_BATCH:{let s=us(t,oe.SUBSCRIPTION_HANDLE),n=s?Nm(s):void 0,p=new DataView(e.buffer,e.byteOffset,e.byteLength),c=p.getUint16(J,!1),N=J+2;for(let E=0;E<c;E+=1){let S=p.getUint32(N,!1);N+=4,this.route(this.readDeliver(kr(e.slice(N,N+S)).canonical),n),N+=S}return}case L.ERROR:{let s=this.owed.length>0||this.reasonDueBy!==void 0,n=[...this.awaitingReason.keys(),...s?[0n]:[]],p=FP(e,n);if(!p||p.layout!=="seq-linked"||p.seq===void 0)return;if(p.seq===0n){this.controlError(p.code,p.reason);return}let c=this.awaitingReason.get(p.seq);if(c){this.awaitingReason.delete(p.seq),clearTimeout(c.timer);let N=p.reason;yi(N)?c.waiter.reject(new xm(c.answer.result.statusCode,N)):Cm(N)?c.waiter.reject(new Am(c.answer.result.statusCode,N)):c.waiter.resolve(c.answer)}return}case L.GOODBYE:this.onClosed(null);return;case L.SYS_EVENT:this.onSysEvent(e);return;default:return}}onSysEvent(o){if(!this.followRedirects)return;let e;try{let t=wm(o).frame;if(t.eventCode!==UP)return;e=JSON.parse(cc.decode(t.payload))}catch{return}typeof e?.table!="number"||typeof e.partition!="number"||typeof e.authority!="string"||this.primaryHints.set(oc(e.table,e.partition),{authority:e.authority})}readDeliver(o){let e=fP(o),t=Dm(e.attributes);return{table:e.channelId,partition:e.partitionId,offset:e.sequence,hlc:e.hlcTimestamp,position:{partition:e.partitionId,offset:e.sequence},attributes:e.attributes,payload:e.payload,...t?{deliveryToken:t}:{}}}route(o,e){((e!==void 0?this.subscriptions.find(r=>r.handle===e):void 0)??this.subscriptions.find(r=>r.table===o.table&&(r.partition===void 0||r.partition===o.partition))??this.subscriptions.find(r=>r.table===o.table))?.push(o)}};function rb(i,o){if(i.byteLength!==o.byteLength)return!1;let e=0;for(let t=0;t<i.byteLength;t+=1)e|=i[t]^o[t];return e===0}u(rb,"bytesEqual");var ob=L.PUBLISH,K2=L.BULK_ACK,sb=48;function lc(i){let o=new Uint8Array(i.byteLength);return o.set(i),o}u(lc,"copyToArrayBuffer");async function zm(i){let o=globalThis.crypto.subtle,e=new TextEncoder().encode(JSON.stringify(i.payload)),t=await o.digest("SHA-256",lc(e)),r=new Uint8Array(t);if(r.byteLength!==Eo)throw new Error(`payloadHash must be ${Eo} bytes, got ${r.byteLength}`);let s=new Uint8Array(is);s.set(er({frameType:ob,flags:0,headerLen:H,sessionId:i.sessionId,payloadLen:e.byteLength}),0);let n=new DataView(s.buffer,s.byteOffset,s.byteLength);n.setUint32(16,i.channelId??1,!1),n.setUint32(20,i.partitionId??0,!1),n.setBigUint64(24,i.sequence,!1),n.setBigUint64(32,0n,!1),n.setUint32(40,0,!1),s[44]=i.qosLevel??1,s[45]=0,n.setUint16(46,0,!1),s.set(r,48);let p=ui(s),c=await o.sign("Ed25519",i.ed25519PrivateKey,lc(p)),N=new Uint8Array(c);if(N.byteLength!==Ce)throw new Error(`ed25519 signature must be ${Ce} bytes, got ${N.byteLength}`);s.set(N,80);let E=new Uint8Array(is+e.byteLength);return E.set(s,0),E.set(e,is),E}u(zm,"buildSignedPublishFrame");async function Om(i){let o=So({sessionId:i.sessionId,envelope:{channelId:1,mode:i.mode,deliveryPreference:i.deliveryPreference,qosCapabilities:0,partitionFilter:0,startCursor:i.startCursor??0n,startHlc:i.startHlc??0n,filters:[]},consumerSignature:new Uint8Array(Ce)}),e=await globalThis.crypto.subtle.sign("Ed25519",i.ed25519PrivateKey,lc(Xp(o))),t=new Uint8Array(e);if(t.byteLength!==Ce)throw new Error(`ed25519 sig must be ${Ce} bytes`);return o.set(t,sb),o}u(Om,"buildSignedSubscribeFrame");function jm(i){if(i.byteLength<H+10)throw new Error(`BULK_ACK too short: ${i.byteLength}`);let{canonical:o,tlvs:e}=kr(i),t=Ri(o,e),r=t[0];if(!r)throw new RangeError("BULK_ACK carries no record");let s=t.length===1?gi(e):void 0;return{sessionId:be(o).sessionId,seq:r.seq,status:r.status,...r.position?{position:r.position}:{},...s!==void 0?{messageGid:s}:{}}}u(jm,"decodeBulkAck");function $(i){return typeof i=="string"&&i.length>0?i:void 0}u($,"str");function $e(i){let o=i.split(".");if(o.length<2)return{};try{let e=o[1].replace(/-/g,"+").replace(/_/g,"/"),t=e.length%4===0?"":"=".repeat(4-e.length%4),r=typeof Buffer<"u"?Buffer.from(e+t,"base64").toString("utf8"):atob(e+t);return JSON.parse(r)}catch{return{}}}u($e,"decodeJwtClaims");function wc(i){return $(i["npayload/orgId"])??$(i.orgId)??$(i.org)??$(i.org_id)??$(i.sub)}u(wc,"orgOfClaims");async function Wm(i){if(i!==void 0)return wc($e(typeof i=="function"?await i():i))}u(Wm,"orgOfCredential");var tb=/^[a-z0-9][a-z0-9._-]{0,127}$/;function nb(i){let o=2166136261;for(let e=0;e<i.length;e++)o^=i.charCodeAt(e),o=Math.imul(o,16777619)>>>0;return o.toString(16).padStart(8,"0")}u(nb,"fnv1aHex");function ab(i){return tb.test(i)?i:`${i.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^[^a-z0-9]+/,"").slice(0,110)||"x"}-h${nb(i)}`}u(ab,"kernelSafeName");function $m(i,o){return ab(`${i}.${o}`)}u($m,"kernelUnitFor");function Km(i){let o=u(e=>e!==null&&typeof e=="object"&&!Array.isArray(e),"isDoc");return o(i)?[i,i.channel,i.data].filter(o):[]}u(Km,"answerDocs");function hc(i){let o=Km(i);return o.some(e=>e.engine==="convex")?!1:o.some(e=>e.engine==="kernel"||typeof e.kernelTable=="string"&&e.kernelTable!==""||typeof e.kernelTableId=="number"&&Number.isInteger(e.kernelTableId))}u(hc,"channelAnswerNamesKernelTable");function Vm(i){for(let o of Km(i)){let e=$(o.appId),t=$(o.envId);if(e!==void 0&&t!==void 0)return $m(e,t)}}u(Vm,"channelAnswerUnit");function Jm(i){let o=$e(i),e=$(o["npayload/appId"])??$(o.app),t=$(o["npayload/envId"]);return e!==void 0&&t!==void 0?$m(e,t):void 0}u(Jm,"tokenUnit");var ib={1:"REJECTED_VERSION",2:"REJECTED_QOS",[_o.FRAME_MALFORMED]:"FRAME_MALFORMED",[_o.PROTOCOL_VIOLATION]:"PROTOCOL_VIOLATION",[_o.UPSTREAM_REFUSED]:"UPSTREAM_REFUSED",501:"UNSUPPORTED",502:"SESSION_EXPIRED"};function fi(i){return or(i)??(i===tm.REJECTED_HW_ATTESTATION?"REJECTED_HW_ATTESTATION":void 0)}u(fi,"nppStatusName");function vi(i){return ib[i]??fi(i)}u(vi,"nppErrorName");var Cr="https://api.npayload.com",db="https://auth.npayload.com",Ni="https://npp.npayload.com",Qm="npayload.com",pb=new Map([[new URL(Cr).hostname,"API"],[new URL(db).hostname,"auth host"],[new URL(Ni).hostname,"edge"]]);function cb(i){return i===Qm||i.endsWith(`.${Qm}`)}u(cb,"isProductionHost");function ub(i){let o;try{o=new URL(i).hostname}catch{return}try{o=decodeURIComponent(o)}catch{}return o.toLowerCase().replace(/\.+$/,"")}u(ub,"hostOf");function Go(i){let o=i?.trim();return o||void 0}u(Go,"named");function sr(i){let o=Go(i);if(o===void 0)return;let e=ub(o);if(!(e===void 0||!cb(e)))return pb.get(e)??"host"}u(sr,"productionRole");function Ke(i){let o=[];for(let[t,r]of i){let s=Go(r);s!==void 0&&o.push({source:t,url:s})}let e=o.find(t=>sr(t.url)===void 0);return e===void 0?{named:o}:{named:o,other:e}}u(Ke,"estateOf");var lb=["NPAYLOAD_API_URL","NPAYLOAD_AUTH_URL","NPAYLOAD_EDGE_URL","NPAYLOAD_PRIMUS_API_URL","NPAYLOAD_ACCOUNT_API_URL","NPAYLOAD_ADMIN_API_URL","KERNEL_DOOR_URL"];function xr(i,o=e=>e){return lb.map(e=>[o(e),i[e]])}u(xr,"environmentSources");function Ym(i){try{let o=new URL(i).origin;return o&&o!=="null"?o:i}catch{return i}}u(Ym,"shown");function Ei(i,o){if(i.other===void 0)return;let e=sr(o);if(e!==void 0)return`this run names another estate (${i.other.source} ${i.other.url}), so it sends no request to npayload's production ${e} (${Ym(o)}): npayload's production hosts serve its production estate alone`}u(Ei,"dialRefusal");function Xm(i,o){if(i.other===void 0)return;let e=sr(o);if(e!==void 0)return`this run names another estate (${i.other.source} ${i.other.url}), so it opens no page on npayload's production ${e} (${Ym(o)}): npayload's production hosts serve its production estate alone`}u(Xm,"pageRefusal");function Zm(i){if(i.other!==void 0)return`this run names another estate (${i.other.source} ${i.other.url}) and no edge of it: npayload's production edge ${Ni} is the default of its production estate alone`}u(Zm,"noEdgeRefusal");var wb=new Set([301,302,303,307,308]),ey=20,hb=["authorization","proxy-authorization","cookie","dpop"],mb=["content-type","content-length","content-encoding","content-language","content-location"];function ry(i,o){if(i===void 0)return;let e=u(t=>o.includes(t.toLowerCase()),"dropped");if(i instanceof Headers){let t=new Headers(i);for(let r of o)t.delete(r);return t}return Array.isArray(i)?i.filter(([t])=>!e(t)):Object.fromEntries(Object.entries(i).filter(([t])=>!e(t)))}u(ry,"withoutHeaders");function yb(i){return typeof i=="string"?i:i instanceof URL?i.href:i.url}u(yb,"urlOf");function Si(i){try{let o=new URL(i).origin;return o&&o!=="null"?o:i}catch{return i}}u(Si,"originOf");async function mc(i){try{await i.body?.cancel()}catch{}}u(mc,"discard");function Mo(i,o,e){return async(t,r)=>{let s=yb(t),n=i(s);if(n!==void 0)throw o(n,s);let p=e??globalThis.fetch,c={...r??{},redirect:"manual"},N=s;for(let E=0;;E+=1){let S=await p(E===0?t:N,c),A=wb.has(S.status)?S.headers.get("location"):null;if(A===null)return S;let I=new URL(A,N).href,B=i(I);if(B!==void 0)throw await mc(S),o(`the redirect from ${Si(N)} to ${Si(I)} is not followed: ${B}`,I);if(E===ey)throw await mc(S),new TypeError(`fetch failed: more than ${ey} redirects from ${s}`);let G=(c.method??"GET").toUpperCase(),z=S.status===303&&G!=="HEAD"||(S.status===301||S.status===302)&&G==="POST",F=c.headers;z&&(F=ry(F,mb)),Si(I)!==Si(N)&&(F=ry(F,hb)),c={...c,...z?{method:"GET",body:null}:{},...F!==void 0?{headers:F}:{}},await mc(S),N=I}}}u(Mo,"dialFetch");var oy=Symbol.for("npayload.error.nppTransport"),xe=class i extends Error{static{u(this,"NppTransportError")}code;status;upstreamCode;details;constructor(o,e,t){super(o),this.name="NppTransportError",this.code=e,this.details=t,this.status=t.status,this.upstreamCode=t.upstreamCode,Object.defineProperty(this,oy,{value:!0})}static[Symbol.hasInstance](o){return this!==i?Function.prototype[Symbol.hasInstance].call(this,o):typeof o=="object"&&o!==null&&o[oy]===!0}},sy=Symbol.for("npayload.error.transportUnavailable"),V=class i extends xe{static{u(this,"TransportUnavailableError")}constructor(o,e="npp",t={}){super(o,"TRANSPORT_UNAVAILABLE",{failedTransport:e,...t}),this.name="TransportUnavailableError",Object.defineProperty(this,sy,{value:!0})}static[Symbol.hasInstance](o){return this!==i?Function.prototype[Symbol.hasInstance].call(this,o):typeof o=="object"&&o!==null&&o[sy]===!0}},ys=class extends xe{static{u(this,"TransportRefusedError")}constructor(o,e){super(o,"TRANSPORT_REFUSED",{failedTransport:"npp",...e}),this.name="TransportRefusedError"}},Le=class extends xe{static{u(this,"NppKernelDoorError")}constructor(o,e,t={}){super(`${o}: ${e}`,o,{failedTransport:"npp",...t}),this.name="NppKernelDoorError"}},Rs=class extends xe{static{u(this,"NppRefusedError")}refusal;constructor(o,e,t){super(o,"NPP_REFUSED",{failedTransport:"npp",...t,upstreamCode:e.name??yc(e.code),...e.reason?{upstreamMessage:e.reason}:{}}),this.name="NppRefusedError",this.refusal=e}},gs=class extends xe{static{u(this,"NppProtocolError")}frameType;constructor(o,e,t){super(o,"NPP_PROTOCOL",{failedTransport:"npp",...t}),this.name="NppProtocolError",this.frameType=e}},iy=new Set([429,500,502,503,504]),Rb=`0x${ls.toString(16).padStart(4,"0")}`,gb=2147483647;function Pb(i){let o=i.producerEpoch;if(typeof o!="number"||!Number.isInteger(o)||o<0||o>gb)throw new Le("KERNEL_CONFIG",`producerEpoch must be an integer from 0 to 0x7FFF_FFFF (the node's implicit epochs start at 0x8000_0000), got ${String(o)}; nothing was sent.`);if(typeof i.readChannel!="function")throw new Le("KERNEL_CONFIG","the kernel door needs `readChannel`, the client's read of a channel's answer; nothing was sent.");let e=i.credential;if(e!==void 0&&(typeof e.accessToken!="function"||typeof e.proof!="function"))throw new Le("KERNEL_CONFIG","the kernel door's `credential` needs `accessToken` and `proof`; nothing was sent.")}u(Pb,"assertKernelDoorOptions");var bb=6e4,fb=50,vb=5e3,Nb="NPAYLOAD_TEST_RESTART_WINDOW_MS";function Eb(){let i=globalThis.process?.env;if(!i||i.VITEST!=="true")return;let o=i[Nb];if(o===void 0||o==="")return;let e=Number(o);return Number.isFinite(e)&&e>=0?e:void 0}u(Eb,"harnessRestartWindowMs");function Sb(i){return i!==void 0&&Number.isFinite(i)&&i>=0?i:Eb()??bb}u(Sb,"restartWindowFor");function _b(i){let o=i.get("Retry-After");if(o===null||o.trim()==="")return;let e=Number(o.trim());if(Number.isFinite(e)&&e>=0)return Math.round(e*1e3);let t=Date.parse(o);return Number.isNaN(t)?void 0:Math.max(0,t-Date.now())}u(_b,"retryAfterMs");function ty(i,o,e,t){if(i>=o)return;let r=e-Date.now();if(r<=0||t!==void 0&&t>r)return;let s=Math.min(vb,fb*2**Math.min(i-1,16))*(.8+Math.random()*.4);return Math.min(Math.max(t??0,Math.round(s)),r)}u(ty,"nextRepostWaitMs");function dy(i){let o=yc(i.statusCode),e=i.statusName??fi(i.statusCode)??"UNREGISTERED_STATUS";if(i.sequenceConflict)return`NPP publish not stored: the broker answered ${e} (BULK_ACK ${o}, HTTP ${i.httpStatus}) for producer sequence ${i.sequenceConflict.sequence} \u2014 ${i.sequenceConflict.reason}`;let t=`NPP publish rejected by the edge: ${e} (BULK_ACK ${o}, HTTP ${i.httpStatus})`;if(i.error){let r=`0x${i.error.code.toString(16).padStart(4,"0")}`,s=i.error.name??r;t+=` \u2014 ${s}${i.error.name?` (${r})`:""}${i.error.reason?`: ${i.error.reason}`:""}`}return i.upstream&&(i.upstream.component||i.upstream.status!==void 0)&&(t+=` [upstream ${i.upstream.component??"unknown"}${i.upstream.status!==void 0?` ${i.upstream.status}`:""}]`),t}u(dy,"describeNppRejection");function kb(i,o){for(let e of i.slice(1)){if(e.byteLength<H||e[4]!==L.ERROR)continue;let t=Nr(e,o);return{code:t.code,name:vi(t.code),reason:t.reason}}}u(kb,"linkedErrorSideband");function Tb(i){let o=i.get("X-NPayload-Upstream-Component")??void 0,e=i.get("X-NPayload-Upstream-Status"),t=e!==null&&/^\d+$/.test(e.trim())?Number(e.trim()):void 0;if(!(o===void 0&&t===void 0))return{...o!==void 0?{component:o}:{},...t!==void 0?{status:t}:{}}}u(Tb,"upstreamFromHeaders");var Cb=8*1024;function xb(i){if(i.byteLength<H)return!1;for(let o=0;o<br.length;o+=1)if(i[o]!==br[o])return!1;return!0}u(xb,"isNppFrame");function Ab(i){let o;try{o=JSON.parse(new TextDecoder().decode(i.subarray(0,Cb)))}catch{return{}}if(!o||typeof o!="object")return{};let e=o,t=e.error&&typeof e.error=="object"?e.error:void 0,r=ir(o)??t?.code??e.code??(typeof e.error=="string"?e.error:void 0),s=t?.message??e.message;return{...typeof r=="string"&&r?{upstreamCode:r}:{},...typeof s=="string"&&s?{upstreamMessage:s}:{}}}u(Ab,"readUpstream");function Ib(i,o,e,t){let r=i.headers.get("content-type")??void 0,{upstreamCode:s,upstreamMessage:n}=Ab(o),p={status:i.status,url:e,...r?{contentType:r}:{},...s?{upstreamCode:s}:{},...n?{upstreamMessage:n}:{}},c=`answered HTTP ${i.status}`+(r?` (${r})`:"")+(s?` with code ${s}`:"")+(n?`: ${n}`:"")+", which is not an NPP frame";return iy.has(i.status)?new V(`npp: the frame door ${e} ${c}, on every one of ${t} attempt(s) across the restart window; the NPP transport is unavailable and the operation was not downgraded to HTTP/JSON.`,"npp",p):new ys(`npp: the frame door ${e} ${c}; the operation was refused, not retried, and not downgraded to HTTP/JSON.`,p)}u(Ib,"nonFrameAnswer");function yc(i){return`0x${i.toString(16).padStart(4,"0")}`}u(yc,"hex16");function Gb(i){for(let[o,e]of Object.entries(L))if(e===i)return o;return`0x${i.toString(16).padStart(2,"0")}`}u(Gb,"frameTypeWord");function Mb(i,o){return`${i.name??"UNREGISTERED_CODE"} (ERROR ${yc(i.code)}, HTTP ${o})${i.reason?`: ${i.reason}`:""}`}u(Mb,"describeNppRefusal");function Ub(i,o){try{let{canonical:e}=kr(i),t=o!==void 0&&o!==0n?[o,0n]:[0n];for(let s of t){let n=Nr(e,s);if(n.layout==="seq-linked")return{code:n.code,name:vi(n.code),reason:n.reason}}let r=Nr(e);return{code:r.code,name:vi(r.code),reason:r.reason}}catch{return}}u(Ub,"readFrameDoorError");function Hb(i,o,e,t,r){let s=i.headers.get("content-type")??void 0,n={status:i.status,url:e,...s?{contentType:s}:{}},p=t>1?` on every one of ${t} attempts across the restart window`:"",c=o[4];if(c===L.ERROR){let E=Ub(o,r);if(E)return new Rs(`npp: the frame door ${e} refused the frame${p}: ${Mb(E,i.status)}`,E,n)}let N=c===L.ERROR?"an ERROR frame too short or too malformed to carry its code":`a ${Gb(c)} frame (type 0x${c.toString(16).padStart(2,"0")})`;return new gs(`npp: the frame door ${e} answered HTTP ${i.status} with ${N}${p}, where the answer to a frame is a BULK_ACK or an ERROR; the answer breaks the NPP protocol, so the operation failed and was not downgraded to HTTP/JSON.`,c,n)}u(Hb,"frameDoorRefusal");var py=Symbol.for("npayload.transport.npp"),cy=Symbol.for("npayload.transport.npp.edge"),uy=Symbol.for("npayload.transport.npp.frameGuard");function ly(i){return typeof i=="object"&&i!==null&&i[py]===!0}u(ly,"isNppTransport");function Rc(i){return i[cy]}u(Rc,"nppTransportEdge");function wy(i,o){Object.defineProperty(i,uy,{value:o,configurable:!0})}u(wy,"guardFrames");function ny(i,o){let e=i[uy];if(e!==void 0)return e(o);let t=typeof process<"u"?process.env:{},r=Ke([["the transport's edgeUrl",Rc(i)],...xr(t)]),s=Ei(r,o);return s===void 0?void 0:`${s}. Build the transport with the edge of that estate, or name no other estate in the environment.`}u(ny,"frameRefusal");var Qr=class{static{u(this,"NppTransport")}kind="npp";cfg;fetchImpl;sessionId;credentialOrg;sequenceStore;kernelTableIds=new Map;kernelAnswers=new Map;kernelUnits=new Map;constructor(o,e){if(!o||typeof o.edgeUrl!="string"||o.edgeUrl.length===0)throw new Error("NppTransport requires edgeUrl");o.kernel&&Pb(o.kernel),this.cfg=o,Object.defineProperty(this,py,{value:!0}),Object.defineProperty(this,cy,{value:o.edgeUrl}),this.sequenceStore=o.sequenceStore??hs,this.fetchImpl=o.fetchImpl??globalThis.fetch.bind(globalThis),this.sessionId=e!==void 0?e>>>0:globalThis.crypto.getRandomValues(new Uint32Array(1))[0]>>>0}async subscribe(o,e){let t=await Om({sessionId:this.sessionId,ed25519PrivateKey:this.cfg.ed25519PrivateKey,mode:e.mode??0,deliveryPreference:e.deliveryPreference??0,...e.startCursor!==void 0?{startCursor:e.startCursor}:{}}),r=await this.postFrame(t,{"X-NPP-Channel-Gid":o,"X-NPP-Consumer-Id":e.consumerId});return{accepted:r.accepted,statusCode:r.statusCode,transport:"npp"}}async postFrame(o,e,t={},r){let s=`${this.cfg.edgeUrl.replace(/\/+$/,"")}/v1/npp/frame`,n=ny(this,s);if(n!==void 0)throw new V(`npp: ${n}`,"npp",{url:s});this.credentialOrg??=await Wm(this.cfg.accessToken);let p=this.credentialOrg,c={"Content-Type":"application/octet-stream",...p?{"X-NPP-Org-Id":p}:{},"X-NPP-App-Id":this.cfg.appId,"X-NPP-Jkt":this.cfg.jwkThumbprint,"X-NPP-Client-Id":this.cfg.clientId,...e},N=t.maxRetries!==void 0?Math.max(1,t.maxRetries):Number.POSITIVE_INFINITY,E=Date.now()+Sb(t.restartWindowMs??this.cfg.restartWindowMs),S=this.cfg.kernel?.credential,A=Mo(I=>ny(this,I),(I,B)=>new V(`npp: ${I}`,"npp",{url:B}),this.fetchImpl);for(let I=1;;I+=1){let B=c;if(S){let U=await S.accessToken();B={...c,Authorization:`DPoP ${U}`,DPoP:await S.proof(s,U)}}let G,z;try{G=await A(s,{method:"POST",headers:B,body:o}),z=new Uint8Array(await G.arrayBuffer())}catch(U){if(U instanceof V)throw U;let ie=ty(I,N,E,void 0);if(ie!==void 0){await ay(ie);continue}let se=U instanceof Error?U.message:String(U),Ts=new V(`npp: the frame door ${s} gave no answer (${se}) on every one of ${I} attempt(s) across the restart window; the NPP transport is unavailable and the operation was not downgraded to HTTP/JSON.`,"npp",{url:s});throw Ts.cause=U,Ts}let Q=xb(z)?wi(z):[],D=Q[0],j=D!==void 0&&D[4]===L.BULK_ACK?jm(D):void 0;if(iy.has(G.status)||j?.status===vr.DEFERRED_RETRY){let U=ty(I,N,E,_b(G.headers));if(U!==void 0){await ay(U);continue}}if(D===void 0)throw Ib(G,z,s,I);if(!j)throw Hb(G,D,s,I,r);let K=j.messageGid??G.headers.get("X-NPP-Message-Gid")??void 0,W=kb(Q,j.seq),Y=Tb(G.headers);return{accepted:j.status===vr.ACCEPTED||j.status===vr.ACCEPTED_DUPLICATE,statusCode:j.status,statusName:fi(j.status),httpStatus:G.status,sequence:j.seq.toString(),...K?{gid:K}:{},...j.position?{position:j.position}:{},...W?{error:W}:{},...Y?{upstream:Y}:{},attempts:I}}}async publish(o,e,t){let r=this.cfg.kernel,s=r?await this.kernelTableIdOf(o,r):void 0,n=r?.credential?await this.kernelUnitOf(o,r):void 0,p={"X-NPP-Channel-Gid":o,...t?.routingKey?{"X-NPP-Routing-Key":t.routingKey}:{},...r?{"X-NPP-Capabilities":Rb,"X-NPP-Producer-Epoch":String(r.producerEpoch)}:{},...n!==void 0?{"X-NPP-Unit":n}:{}},{answer:c,sequence:N,verdict:E}=await ms(this.sequenceStore,{thumbprint:this.cfg.jwkThumbprint,channelGid:o},async A=>{let I=await zm({sessionId:this.sessionId,sequence:A,payload:e,ed25519PrivateKey:this.cfg.ed25519PrivateKey,...t?.qosLevel!==void 0?{qosLevel:t.qosLevel}:{},...s!==void 0?{channelId:s}:{}}),B=await this.postFrame(I,p,{...t?.maxRetries!==void 0?{maxRetries:t.maxRetries}:{},...t?.restartWindowMs!==void 0?{restartWindowMs:t.restartWindowMs}:{}},A);return{...B,status:B.statusCode,retried:B.attempts>1}}),S=E.kind==="stored";return{accepted:S,statusCode:c.statusCode,statusName:c.statusName,httpStatus:c.httpStatus,sequence:c.sequence,transport:"npp",...c.gid&&S?{gid:c.gid}:{},...c.position?{position:c.position}:{},...c.error?{error:c.error}:{},...c.upstream?{upstream:c.upstream}:{},...E.kind==="conflict"||E.kind==="rewound"?{sequenceConflict:{sequence:N.toString(),reason:E.reason}}:{}}}async kernelTableIdOf(o,e){let t=this.kernelTableIds.get(o);if(t!==void 0)return t;let r=await pc(async()=>{let s=await e.readChannel(o);return this.kernelAnswers.set(o,s),s},{...e.tableIdWaitMs!==void 0?{waitMs:e.tableIdWaitMs}:{},...e.tableIdPollMs!==void 0?{pollMs:e.tableIdPollMs}:{}});if("refused"in r)throw new Le("KERNEL_TABLE_ID_UNRESOLVED",`channel ${o}: ${r.detail}. A PUBLISH to the kernel's door carries the kernelTableId its channel's answer names; no frame was sent.`,{channel:o});return this.kernelTableIds.set(o,r.table),r.table}async kernelUnitOf(o,e){let t=this.kernelUnits.get(o);if(t!==void 0)return t;let r=(e.unit!==void 0&&e.unit!==""?e.unit:void 0)??Vm(this.kernelAnswers.get(o))??await e.credential?.unit?.();if(r===void 0||r==="")throw new Le("KERNEL_UNIT_UNRESOLVED",`channel ${o}: no unit was given, its answer names no appId and envId, and the credential names no app and environment, so the unit its frames name cannot be read; no frame was sent.`,{channel:o});return this.kernelUnits.set(o,r),r}};function ay(i){return new Promise(o=>setTimeout(o,i))}u(ay,"sleep");var Yr={specVersions:{cell:"5.0.5",feed:"1.0.0",primus:"3.0.0"},apiVersions:["v1"],shapes:[{a:{p:["circuitBreaker","circuitState","config","createdAt","credentialsVaultKey","description","gid","healthy","lastHealthCheck","name","orgAdapterRegistryId","status","tags","type","updatedAt","usage","version"],c:{circuitBreaker:{p:["failureCount","halfOpenAt","lastFailureAt","openedAt","state","successCount"]},lastHealthCheck:{p:["healthy","latencyMs","message","timestamp"]},usage:{p:["lastUsedAt","totalFailed","totalMessages","totalSuccessful"]}}}},{p:["gid"]},{p:["circuitBreaker","circuitState","config","createdAt","credentialsVaultKey","description","gid","healthy","lastHealthCheck","name","orgAdapterRegistryId","status","tags","type","updatedAt","usage","version"],c:{circuitBreaker:{p:["failureCount","halfOpenAt","lastFailureAt","openedAt","state","successCount"]},lastHealthCheck:{p:["healthy","latencyMs","message","timestamp"]},usage:{p:["lastUsedAt","totalFailed","totalMessages","totalSuccessful"]}}},{p:["success"]},{p:["deleted","gid"]},{a:{p:["connectGrantGid","effectiveRetentionMs","feedListingGid","gid","kernelTable","kernelTableId","name","origin","routedSchemaRef","slug","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},threatScan:{p:["level","required"]}}}},{p:["effectiveRetentionMs","gid","kernelTable","kernelTableId","name","routedSchemaRef","slug","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},threatScan:{p:["level","required"]}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["effectiveRetentionMs","gid","kernelTable","kernelTableId","name","routedSchemaRef","slug","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},threatScan:{p:["level","required"]}}}}}},{a:{p:["effectiveRetentionMs","gid","kernelTable","kernelTableId","name","routedSchemaRef","slug","stats","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},stats:{p:["bindingCount","dlqDepth","groupCount","messageCount","subCount"]},threatScan:{p:["level","required"]}}}},{a:{p:["attemptCount","attemptHistory","createdAt","deliveredAt","expiresAt","gid","lastAttemptAt","lastError","maxAttempts","messageGid","metadata","nextAttemptAt","partitionKey","response","scheduledAt","status","subscriptionGid","tombstonedAt","updatedAt"],c:{attemptHistory:{a:{p:["attemptNumber","attemptedAt","error","latencyMs","statusCode"]}},lastError:{p:["code","message","retryable"]},response:{p:["latencyMs","statusCode"]}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["adapterDlqSlug","adapterType","attemptCount","createdAt","expiresAt","failedAt","failureAttempts","failureCount","failureReason","frameHash","frameSeq","gid","hlcTimestamp","lastError","lastErrorMessage","lastFailureReason","lastFailureTimestamp","lastHttpStatus","messageGid","orgId","originalMetadata","originalPayload","producerThumbprint","rejectionReason","reprocessHistory","reprocessResult","reprocessedAt","reprocessedBy","status","subscriptionGid","suppressedFailureEmits","updatedAt"],c:{reprocessHistory:{a:{p:["actor","at","note","result"]}},suppressedFailureEmits:{a:{p:["eventType","failureSourceChannelSlug","failureSourceSubscriptionGid","reason","redirectedTo","targetChannelSlug"]}}}}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["algorithm","createdAt","gid","jwkThumbprint","revokedAt","status"]}}}},{p:["gid","jwkThumbprint"]},{p:["gid","status"]},{a:{p:["action","channels","createdAt","currentVersion","deprecated","deprecatedFields","deprecationMessage","description","displayName","domain","entity","gid","name","ownership","publisherDeclaration","schema","status","sunsetDate","tags","updatedAt"],c:{ownership:{p:["contact","slackChannel","team"]},publisherDeclaration:{p:["eventTypeName","signedAt","signedBy","statement"]},schema:{p:["definition","format"]}}}},{a:{p:["action","channels","createdAt","currentVersion","deprecated","deprecatedFields","deprecationMessage","description","displayName","domain","entity","gid","name","ownership","publisherDeclaration","status","sunsetDate","tags","updatedAt"],c:{ownership:{p:["contact","slackChannel","team"]},publisherDeclaration:{p:["eventTypeName","signedAt","signedBy","statement"]}}}},{a:{p:["attributes","channelGid","connectTier","createdAt","deliveryStats","entityRef","expiresAt","federationEntityId","gid","grantId","groupId","groupSequence","groupSize","idempotencyKey","isGroupComplete","metadata","originalMessageGid","originalPublishedAt","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status","storageTier","tenantId","tombstonedAt","updatedAt"],c:{deliveryStats:{p:["delivered","failed","pending","total"]},entityRef:{p:["id","sourceId","type","uet","untranslated"]},metadata:{p:["causationId","contentType","correlationId","entityRefs","source","traceId"]}}}},{a:{p:["channelGid","deliveryConfig","filterGap","gid","hasWebhookSecret","kernelCursorId","name","status","type"],c:{deliveryConfig:{p:["maxPerMinute"]},filterGap:{a:{p:["operator","path"]}}}}},{p:["channelGid","fromTime","metadataOnly","recordCount","records","tier","toTime"],c:{records:{a:{p:["checksum","gid","size","timestamp"]}}}},{a:{p:["channelGid","createdAt","description","gid","kernelCursorId","maxConcurrency","metadata","name","rebalanceOnMemberChange","status","strategy","updatedAt"]}},{a:{p:["cancelReason","cancelledAt","channelGid","createdAt","deliverAt","deliveredMessageGid","failureReason","gid","idempotencyKey","metadata","partitionKey","payload","priority","routingKey","status"]}},{p:["redeliveryCount"]},{p:["added","addedCount","channelGid","fromTime","toTime"],c:{added:{a:{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]}}}},{p:["asOf","channelGid","messageCount","messages"],c:{messages:{a:{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]}}}},{p:["asOf","grantId","messageCount","messages","reason","skipped"],c:{messages:{a:{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]}}}},{p:["connectGrantGid","effectiveRetentionMs","feedListingGid","gid","kernelTable","kernelTableId","name","origin","routedSchemaRef","slug","status","threatScan","type"],c:{routedSchemaRef:{a:{p:["eventType","version"]}},threatScan:{p:["level","required"]}}},{p:["gid","name","slug","status","type"]},{p:["archived","success","suspendedSubscriptions"]},{p:["channelGid","isArchived","messageCount","newestMessageAt","oldestMessageAt","status","totalPayloadSize"]},{p:["channelGid","channelName","last24h","subscriptions"],c:{last24h:{p:["avgDeliveryTimeMs","deliveriesFailed","deliveriesSuccessful","deliveriesTotal","messagesPublished"]},subscriptions:{a:{p:["gid","health","name","pendingDeliveries"]}}}},{p:["channel","recentMessages","stats","subscribers"],c:{channel:{p:["gid","name","slug","status","type"]},recentMessages:{a:{p:["channelGid","createdAt","gid","partitionKey","payload","publishedAt","status"]}},stats:{p:["dlqDepth","messageCount","subscriberCount"]},subscribers:{a:{p:["channelGid","gid","hasWebhookSecret","name","status","type"]}}}},{p:["alreadyArchived","success"]},{p:["messageIds","published"]},{p:["accepted","deferred","recordCount","responseFrameB64"]},{p:["groupId","messageIds"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["acknowledgment","channelGid","createdAt","deliveryGid","expiresAt","gid","messageGid","metadata","proof","status","subscriptionGid","updatedAt"],c:{acknowledgment:{p:["acknowledgedAt","metadata","processedAt","receivedAt"]},proof:{p:["deliveredAt","endpoint","latencyMs","receiptId","responseHash","signatureVerified","statusCode"]}}}}}},{p:["channelGid","checks","safe","sample","scanned","threshold","worstRiskScore","worstSeverity"],c:{checks:{p:["pii","schema","threat"],c:{pii:{p:["findingsCount","highestSeverity","safe"]},schema:{p:["findingsCount","highestSeverity","safe"]},threat:{p:["findingsCount","highestSeverity","safe"]}}},sample:{a:{p:["findings","findingsCount","highestSeverity","messageGid","riskScore","safe","unscannable"],c:{findings:{a:{p:["category","check","path","severity"]}}}}}}},{p:["appliedOffset","appliedTimestamp","mode","ok","reason","watermark"]},{p:["eventTypes","grantId"]},{a:{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]}},{a:{p:["committedAt","consumerId","lag","latestSequence","offset"]}},{p:["cursor","subscriptionGid"]},{p:["channelGid","deliveryConfig","filterGap","gid","hasWebhookSecret","kernelCursorId","name","status","type","webhookSecret"],c:{deliveryConfig:{p:["maxPerMinute"]},filterGap:{a:{p:["operator","path"]}}}},{a:{p:["avgLatencyMs","endpoint","health","issues","last24h","name","subscriptionGid","successRate","type"],c:{issues:{a:{p:["message","severity","since","type"]}},last24h:{p:["delivered","failed","pending","total"]}}}},{p:["copiedCount","failedCount","firstCopyTime","lastCopyTime","messageGids","replayed"]},{p:["messageGids","reason","replayed","skipped"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["confirmedBySource","confirmedByTarget","entityTypeSlug","gid","sandbox","sourceOrg","sourceOrgId","status","syncedAt","targetOrg","targetOrgId"],c:{sourceOrg:{p:["displayName","handle"]},targetOrg:{p:["displayName","handle"]}}}}}},{p:["confirmedBySource","confirmedByTarget","entityTypeSlug","gid","sandbox","sourceOrg","sourceOrgId","status","syncedAt","targetOrg","targetOrgId"],c:{sourceOrg:{p:["displayName","handle"]},targetOrg:{p:["displayName","handle"]}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["approvalGid","createdAt","grantGid","platformSlug","receipt","status","storeName","tenantId","updatedAt"],c:{receipt:{p:["approvedAt","approvedBy","humanSummary","receiptId","scope","signature","signingKeyId"],c:{approvedBy:{p:["actorType","email"]},scope:{p:["allowedFields","channelIds","denyFields","eventTypeSlugs"]}}}}}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["appId","appName","appType","connectDescription","connectVisibility","connectedAppCount","description","orgName","platformSlug","publishedEventTypes"]}}}},{p:["appId","appName","appType","connectDescription","connectVisibility","connectedAppCount","description","orgName","platformSlug","publishedEventTypes"]},{p:["connectedApps","deliverySuccessRate30d","piiViolations30d","publishToDeliverLatencyMs","publisherOrgId","redFlag","trustScore"],c:{publishToDeliverLatencyMs:{p:["p50","p99"]}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["approvedBy","callerRole","connectReceivingChannelGid","createdAt","eventTypes","expiresAt","gid","limit","platformSlug","publisherAppId","publisherAppName","publisherDeclaration","publisherEnvKind","publisherOrg","publisherOrgId","publisherOrgName","publisherRegion","rates","requestedBy","residencyConsent","scope","scopeDetail","status","subscriberAppId","subscriberAppName","subscriberEnvKind","subscriberOrg","subscriberOrgId","subscriberOrgName","subscriberRegion","tenantApprovedCount","tenantTotalCount","trustScore","trustScoreAtRequest","updatedAt"],c:{limit:{p:["perDay","perSecond"]},publisherDeclaration:{p:["signature","signedAt","statement"]},publisherOrg:{p:["displayName","handle"]},rates:{p:["asOf","droppedToday","eventsPerSecondNow","peakBucketStart","peakEventsPerSecond","todayCount"]},scope:{p:["allowedFields","denyFields","eventTypeSlugs"]},scopeDetail:{p:["allowedFields","channels","eventTypes","removedFields"],c:{channels:{a:{p:["id","name"]}}}},subscriberOrg:{p:["displayName","handle"]}}}}}},{p:["approvedBy","callerRole","connectReceivingChannelGid","createdAt","eventTypes","expiresAt","gid","limit","platformSlug","publisherAppId","publisherAppName","publisherDeclaration","publisherEnvKind","publisherOrg","publisherOrgId","publisherOrgName","publisherRegion","rates","requestedBy","residencyConsent","scope","scopeDetail","status","subscriberAppId","subscriberAppName","subscriberEnvKind","subscriberOrg","subscriberOrgId","subscriberOrgName","subscriberRegion","supportContact","trustScore","trustScoreAtRequest","updatedAt"],c:{limit:{p:["perDay","perSecond"]},publisherDeclaration:{p:["signature","signedAt","statement"]},publisherOrg:{p:["displayName","handle"]},rates:{p:["asOf","droppedToday","eventsPerSecondNow","peakBucketStart","peakEventsPerSecond","todayCount"]},scope:{p:["allowedFields","denyFields","eventTypeSlugs"]},scopeDetail:{p:["allowedFields","channels","eventTypes","removedFields"],c:{channels:{a:{p:["id","name"]}}}},subscriberOrg:{p:["displayName","handle"]},supportContact:{p:["publisherContact","subscriberContact"],c:{publisherContact:{p:["email","escalationUrl","hoursTimezone"]},subscriberContact:{p:["email","escalationUrl","hoursTimezone"]}}}}},{p:["gid","publisherAppId","publisherOrgId","status","subscriberAppId","subscriberOrgId","updatedAt"]},{p:["asOf","callerRole","droppedByReason","droppedToday","eventsPerSecondNow","grantGid","limitPerDay","limitPerSecond","peakBucketStart","peakEventsPerSecond","todayCount"],c:{droppedByReason:{p:["other","outOfScope","overLimit","paused"]}}},{p:["dryRun","remaining","replayed","skipped","wouldReplay"]},{p:["coldStart","deliveryCount","grantAgeDays","grantGid","redFlag","trustScore","unverified"]},{p:["callerRole","daily","delivered","failed","failuresByReason","grantGid","lastDeliveredAt","latencyP50","latencyP95","latencyP99","perTenantBreakdown","period","publishLatencyP50","publishLatencyP95","publishLatencyP99","published","windowEndMs","windowStartMs"],c:{daily:{a:{p:["day","delivered","failed","published"]}},perTenantBreakdown:{a:{p:["delivered","failed","tenantId"]}}}},{p:["resumedCount","resumedGids"]},{p:["pauseAllId","reason","suspendedCount","suspendedGids"]},{p:["asOf","edges","graph","layoutKey","nodes"],c:{edges:{a:{p:["count","direction","eventsPerSecondNow","from","grantGid","kind","peakBucketStart","peakEventsPerSecond","status","to"]}},nodes:{a:{p:["count","displayName","handle","id","kind","name","org","self","sold"]}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["action","actorId","actorType","after","before","context","createdAt","diff","gid","orgId","resourceId","resourceType","timestamp"],c:{context:{p:["ip","requestId","traceId","userAgent"]}}}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["createdAt","expiresAt","gid","grantGid","ownerEmail","platformSlug","status","subscriberAppId","subscriberOrgId","tenantId","updatedAt"]}}}},{p:["appId","appName","appType","complianceBadges","connectDescription","connectVisibility","connectedAppCount","description","orgName","platformSlug","publishedEventTypes","slaStatement","subtype","supportContact"],c:{supportContact:{p:["email","escalationUrl","hoursTimezone"]}}},{p:["createdAt","expiresAt","gid","grantGid","ownerEmail","platformSlug","status","subscriberAppId","subscriberOrgId","tenantId","updatedAt"]},{p:["channelGid","createdAt","description","gid","kernelCursorId","maxConcurrency","members","metadata","name","rebalanceOnMemberChange","status","strategy","updatedAt"],c:{members:{a:{p:["committedAt","committedOffset","consumerId","joinedAt","kernelCursorId","lastHeartbeatAt","messagesProcessed","offset","status","subscriptionGid"]}}}},{p:["deleted","events","gid"],c:{events:{a:{p:["groupGid","reason","type"]}}}},{p:["groupGid","kernelCursorId","status","subscriptionGid"]},{p:["delivered","messages","ok","reason"],c:{messages:{a:{p:["body","messageId","receiptHandle","sequence"]}}}},{p:["attemptCount","attemptHistory","createdAt","deliveredAt","expiresAt","gid","lastAttemptAt","lastError","maxAttempts","messageGid","metadata","nextAttemptAt","partitionKey","response","scheduledAt","status","subscriptionGid","tombstonedAt","updatedAt"],c:{attemptHistory:{a:{p:["attemptNumber","attemptedAt","error","latencyMs","statusCode"]}},lastError:{p:["code","message","retryable"]},response:{p:["latencyMs","statusCode"]}}},{p:["canceled","success"]},{p:["newDeliveryGid","success"]},{p:["acknowledgment","channelGid","createdAt","deliveryGid","expiresAt","gid","messageGid","metadata","proof","status","subscriptionGid","updatedAt"],c:{acknowledgment:{p:["acknowledgedAt","metadata","processedAt","receivedAt"]},proof:{p:["deliveredAt","endpoint","latencyMs","receiptId","responseHash","signatureVerified","statusCode"]}}},{p:["currentStatus","deliveryGid","messageGid","subscriptionGid","timeline"],c:{timeline:{a:{p:["details","event","timestamp"],c:{details:{p:["attemptNumber","error","latencyMs","reason","status","statusCode"]}}}}}},{p:["createdAt","deferUntil","deliveryGid","gid","processingTimeMs","reason","responseCode","status"]},{p:["deliveryGid","receiptGid","status"]},{p:["adapterDlqSlug","adapterType","attemptCount","createdAt","expiresAt","failedAt","failureAttempts","failureCount","failureReason","frameHash","frameSeq","gid","hlcTimestamp","lastError","lastErrorMessage","lastFailureReason","lastFailureTimestamp","lastHttpStatus","messageGid","orgId","originalMetadata","originalPayload","producerThumbprint","rejectionReason","reprocessHistory","reprocessResult","reprocessedAt","reprocessedBy","status","subscriptionGid","suppressedFailureEmits","updatedAt"],c:{reprocessHistory:{a:{p:["actor","at","note","result"]}},suppressedFailureEmits:{a:{p:["eventType","failureSourceChannelSlug","failureSourceSubscriptionGid","reason","redirectedTo","targetChannelSlug"]}}}},{p:["message","success"]},{p:["discarded","errors","skipped","success"],c:{errors:{a:{p:["error","id"]}}}},{p:["candidateBound","dryRun","matchCount","reprocessed","truncated"]},{p:["errors","processed","skipped","skippedCircuitOpen","success"],c:{errors:{a:{p:["error","id"]}}}},{p:["uet"]},{p:["entityTypeSlug","localEntityId"]},{p:["messagesPublished","totalChannels","totalSubscriptions"]},{p:["action","channels","createdAt","currentVersion","deprecated","deprecatedFields","deprecationMessage","description","displayName","domain","entity","gid","name","ownership","publisherDeclaration","status","sunsetDate","tags","updatedAt"],c:{ownership:{p:["contact","slackChannel","team"]},publisherDeclaration:{p:["eventTypeName","signedAt","signedBy","statement"]}}},{p:["breakingChanges","compatible","warnings"]},{a:{p:["appId","gid","lastReceivedAt","registeredAt","subscriptionGid"]}},{p:["channelCount","consumerCount","consumers","eventType","latestVersion","versions"],c:{consumers:{a:{p:["appId","gid","lastReceivedAt","registeredAt","subscriptionGid"]}},eventType:{p:["action","channels","createdAt","currentVersion","deprecated","deprecatedFields","deprecationMessage","description","displayName","domain","entity","gid","name","ownership","publisherDeclaration","status","sunsetDate","tags","updatedAt"],c:{ownership:{p:["contact","slackChannel","team"]},publisherDeclaration:{p:["eventTypeName","signedAt","signedBy","statement"]}}},versions:{a:{p:["changelog","compatibility","envId","example","gid","publishedAt","publishedBy","schema","status","version"],c:{compatibility:{p:["breakingChanges","checkedAgainst","mode","result"]},schema:{p:["definition","format"]}}}}}},{a:{p:["changelog","compatibility","envId","example","gid","publishedAt","publishedBy","schema","status","version"],c:{compatibility:{p:["breakingChanges","checkedAgainst","mode","result"]},schema:{p:["definition","format"]}}}},{p:["confirmedAt","delivered","status","token"]},{p:["alreadyExists","status","token"]},{p:["alreadyConfirmed","success"]},{a:{p:["config","createdAt","gid","name","status","type","updatedAt"],c:{config:{p:["headersMatchMode"]}}}},{p:["config","createdAt","gid","name","status","type","updatedAt"],c:{config:{p:["headersMatchMode"]}}},{p:["bindingsDeleted"]},{a:{p:["channelGid","channelName","createdAt","exchangeGid","gid","headerRules","routingKey"]}},{p:["channelGid","channelName","createdAt","exchangeGid","gid","headerRules","routingKey"]},{a:{p:["bindingGid","channelGid"]}},{p:["count","deliveries","exchangeGid","exchangeType"],c:{deliveries:{a:{p:["bindingGid","channelGid","messageGid"]}}}},{a:{p:["bindingsCount","config","createdAt","gid","name","status","type","updatedAt"],c:{config:{p:["headersMatchMode"]}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["arrivingPerSecond","billingCycle","bindingCount","currentPeriodEnd","displayName","listingGid","messagesThisPeriod","status","subscribedAt","subscriberOrg","subscriberOrgId","subscriptionGid","supportEmail","tierName","totalBytes"],c:{subscriberOrg:{p:["displayName","handle"]}}}}}},{p:["arrivals","arrivingPerSecond","billingCycle","bindingCount","currentPeriodEnd","displayName","listingGid","messagesThisPeriod","status","subscribedAt","subscriberOrg","subscriberOrgId","subscriptionGid","supportEmail","tierName","totalBytes"],c:{arrivals:{p:["buckets","today"],c:{buckets:{a:{p:["count","start"]}}}},subscriberOrg:{p:["displayName","handle"]}}},{a:{p:["arrivingPerSecond","byStatus","customers","listingGid"],c:{byStatus:{p:["active","cancelled","expired","paused","pending"]}}}},{a:{p:["activeBindingCount","bindingCount","messageCount","messagesThisPeriod","subscriptionGid","totalBytes"]}},{p:["afterRevoke","listingGid","region","resaleAllowed","retentionDays","signature","signedAt","signer"],c:{signer:{p:["displayName","handle"]}}},{p:["listingGid","signedAt"]},{a:{p:["body","createdAt","gid","helpfulVotes","publisherResponse","publisherResponseAt","rating","reviewerOrgId","status","title","unhelpfulVotes","updatedAt"]}},{p:["basePrice","categories","category","description","freeTierLimit","gid","name","namespace","pricePerMessage","pricingModel","publishedAt","publisher","publisherGid","publisherSlug","shortDescription","slug","status","syncedFromAdminAt","syncedFromAdminVersion","tags","trialDays"],c:{publisher:{p:["averageRating","description","logoUrl","name","publisherGid","slug","status","supportEmail","supportUrl","websiteUrl"]}}},{p:["averageRating","description","logoUrl","name","payoutsEnabled","publisherGid","slug","status","stripeAccountStatus","supportEmail","supportUrl","suspendedAt","suspendedReason","syncedFromAdminAt","syncedFromAdminVersion","verifiedAt","websiteUrl"]},{p:["deliverySuccessRate","lastActivity","score","suspensionCount","trend"]},{p:["body","createdAt","gid","helpfulVotes","publisherResponse","publisherResponseAt","rating","reviewerOrgId","status","title","unhelpfulVotes","updatedAt"]},{a:{p:["createdAt","deliverySubscriptionGid","feedSubscriptionGid","gid","lastDeliveredAt","messagesDelivered","receivingChannel","receivingChannelGid","status","targetAppGid","targetAppSlug","targetEnvId","updatedAt"],c:{receivingChannel:{p:["arrivingPerSecond","envId","gid","name"]}}}},{p:["deliveryState","isTrial","paused","quota","quotaRemaining","subscriptionGid","testMessagesDelivered","trialDaysRemaining"]},{p:["deleted","revision","value"]},{p:["messageGid","revision"]},{a:{p:["channelGid","createdAt","gid","partitionKey","payload","publishedAt","status"]}},{p:["attributes","channelGid","createdAt","gid","metadata","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status"]},{p:["attributes","channelGid","connectTier","createdAt","deliveryStats","entityRef","expiresAt","federationEntityId","gid","grantId","groupId","groupSequence","groupSize","idempotencyKey","isGroupComplete","metadata","originalMessageGid","originalPublishedAt","partitionKey","payload","priority","publishedAt","routingKey","sequenceNumber","status","storageTier","tenantId","tombstonedAt","updatedAt"],c:{deliveryStats:{p:["delivered","failed","pending","total"]},entityRef:{p:["id","sourceId","type","uet","untranslated"]},metadata:{p:["causationId","contentType","correlationId","entityRefs","pipeDepth","source","traceId"]}}},{p:["channelGid","createdAt","deliveries","messageGid","routingKey","status","subscriptionDeliveries"],c:{deliveries:{p:["delivered","failed","pending","total"]},subscriptionDeliveries:{a:{p:["attemptCount","deliveredAt","httpStatusCode","lastAttemptAt","lastError","maxAttempts","nextRetryAt","status","subscriptionGid","subscriptionName"]}}}},{a:{p:["acknowledgment","createdAt","deliveryGid","expiresAt","gid","messageGid","metadata","proof","status","subscriptionGid","updatedAt"],c:{acknowledgment:{p:["acknowledgedAt","metadata","processedAt","receivedAt"]},proof:{p:["deliveredAt","endpoint","latencyMs","receiptId","responseHash","signatureVerified","statusCode"]}}}},{p:["messages","total"],c:{messages:{a:{p:["createdAt","deliveryStats","messageGid","routingKey","status"],c:{deliveryStats:{p:["delivered","failed","pending","total"]}}}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["agentId","endedAt","errorCode","errorMessage","executionGid","finalReasoning","gid","goal","iterationsUsed","maxIterations","maxTokens","startedAt","status","tokensUsed","trace","workflowGid"],c:{trace:{a:{p:["error","input","iteration","output","timestamp","toolName"]}}}}}}},{p:["agentId","endedAt","errorCode","errorMessage","executionGid","finalReasoning","gid","goal","iterationsUsed","maxIterations","maxTokens","startedAt","status","tokensUsed","trace","workflowGid"],c:{trace:{a:{p:["error","input","iteration","output","timestamp","toolName"]}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["confidence","createdAt","errorCode","errorMessage","evidence","executionGid","findingType","gid","inputRecordIds","latencyMs","nodeId","proposedDecision","retryCount","status","tokensUsed","workflowGid"]}}}},{p:["confidence","createdAt","errorCode","errorMessage","evidence","executionGid","findingType","gid","inputRecordIds","latencyMs","nodeId","proposedDecision","retryCount","status","tokensUsed","workflowGid"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["actions","auth","category","createdAt","description","docsUrl","gid","icon","id","isSystem","name","status","supportedRegions","tier","triggers","updatedAt"],c:{actions:{a:{p:["description","id","inputSchema","name","outputSchema"]}},auth:{p:["config","provider","scopes","type"]},triggers:{a:{p:["description","eventType","id","name","outputSchema"]}}}}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["auth","connectorId","createdAt","gid","lastUsedAt","name","status","updatedAt","usageCount"],c:{auth:{p:["expiresAt","nangoConnectionId","type","vaultSecretId"]}}}}}},{p:["auth","connectorId","createdAt","gid","lastUsedAt","name","status","updatedAt","usageCount"],c:{auth:{p:["expiresAt","nangoConnectionId","type","vaultSecretId"]}}},{p:["credentialGid","updated"]},{p:["credentialGid","deleted"]},{p:["credentialGid","status"]},{p:["credentialGid","rotated"]},{p:["error","success"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["actNodeId","actedAt","analysisGid","analysisInput","committedAt","committedDecision","createdAt","envId","executionGid","expiresAt","gateState","gid","humanActedAt","humanActor","humanRationale","nodeId","policy","proposedDecision","workflowGid"],c:{policy:{p:["config","kind"]}}}}}},{p:["actNodeId","actedAt","analysisGid","analysisInput","committedAt","committedDecision","createdAt","envId","executionGid","expiresAt","gateState","gid","humanActedAt","humanActor","humanRationale","nodeId","policy","proposedDecision","workflowGid"],c:{policy:{p:["config","kind"]}}},{p:["decisionGid","firstActorPreserved","gateState"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["createdAt","dlqEntryId","error","failedAt","gid","lastRetryAt","maxRetries","nextRetryAt","nodeId","resolutionNotes","resolvedAt","resolvedBy","retryCount","status","updatedAt"],c:{error:{p:["code","message","stack"]}}}}}},{p:["createdAt","dlqEntryId","error","failedAt","gid","lastRetryAt","maxRetries","nextRetryAt","nodeId","resolutionNotes","resolvedAt","resolvedBy","retryCount","status","updatedAt"],c:{error:{p:["code","message","stack"]}}},{p:["discardedAt","discardedBy","dlqEntryId","status"]},{p:["discarded","exhausted","pending","resolved","retrying","total"]},{p:["createdAt","endedAt","envId","error","gid","nodeRuns","status","timing","triggeredBy","updatedAt"],c:{error:{p:["code","message","nodeId","stack"]},nodeRuns:{a:{p:["completedAt","error","nodeId","nodeType","startedAt","status"]}},timing:{p:["completedAt","durationMs","startedAt"]}}},{p:["allowedCategories","allowedConnectors","allowedTiers","auditConfig","autoApproveInternalConnectors","blockedConnectors","createdAt","maxCredentialsPerConnector","mode","organizationId","requireFirstUseApproval","updatedAt","updatedBy"],c:{auditConfig:{p:["logAllActions","logCredentialAccess","retentionDays"]}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["connectorId","gid","requestReason","requestedAt","requestedBy","reviewNotes","reviewedAt","reviewedBy","revokeReason","revokedAt","revokedBy","status"]}}}},{p:["requestGid"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["actorId","actorType","eventType","gid","reason","targetId","targetType","timestamp"]}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["createdAt","discardReason","discardedAt","discardedBy","errorCode","errorMessage","executionGid","gid","lastReplayedAt","nodeId","recordId","recordKey","replayedBy","retryCount","status","workflowGid"]}}}},{p:["createdAt","discardReason","discardedAt","discardedBy","errorCode","errorMessage","executionGid","gid","lastReplayedAt","nodeId","recordId","recordKey","replayedBy","retryCount","status","workflowGid"]},{p:["entryGid","firstActorPreserved","status"]},{p:["entryGid","status"]},{p:["byStatus","total"],c:{byStatus:{p:["discarded","pending","replayed","resolved"]}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["description","inputSchema","name","outputSchema","requiresApproval","stage","supportsIdempotency"]}}}},{p:["description","inputSchema","name","outputSchema","requiresApproval","stage","supportsIdempotency"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["advancedAt","createdAt","envId","gid","priorValue","resetAt","resetBy","resetReason","sourceId","value","workflowGid"]}}}},{p:["advancedAt","createdAt","envId","gid","priorValue","resetAt","resetBy","resetReason","sourceId","value","workflowGid"]},{p:["newValue","priorValue","resetAt","resetBy","watermarkGid"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["gid","name","status","triggerUrl"]}}}},{p:["allowedIps","hasSecret","methods","requiredHeaders","responseMode","url"]},{p:["newSecret"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["createdAt","definition","description","envId","gid","name","stats","status","triggerConfig","updatedAt","version"],c:{definition:{p:["edges","nodes","viewport"],c:{viewport:{p:["x","y","zoom"]}}},stats:{p:["avgDurationMs","failedRuns","lastRunAt","successfulRuns","totalRuns"]},triggerConfig:{p:["config","type"]}}}}}},{p:["createdAt","definition","description","envId","gid","name","stats","status","triggerConfig","updatedAt","version"],c:{definition:{p:["edges","nodes","viewport"],c:{viewport:{p:["x","y","zoom"]}}},stats:{p:["avgDurationMs","failedRuns","lastRunAt","successfulRuns","totalRuns"]},triggerConfig:{p:["config","type"]}}},{p:["version"]},{p:["deleted","workflowGid"]},{p:["status","workflowGid"]},{p:["cursor","data","hasMore"],c:{data:{a:{p:["createdAt","endedAt","envId","error","gid","nodeRuns","status","timing","triggeredBy","updatedAt"],c:{error:{p:["code","message","nodeId","stack"]},nodeRuns:{a:{p:["completedAt","error","nodeId","nodeType","startedAt","status"]}},timing:{p:["completedAt","durationMs","startedAt"]}}}}}},{p:["nodeId","scheduled"]},{p:["gid","idempotent"]},{p:["triggerConfig","workflowGid"],c:{triggerConfig:{p:["config","type"]}}},{p:["cancelReason","cancelledAt","channelGid","createdAt","deliverAt","deliveredMessageGid","failureReason","gid","idempotencyKey","metadata","partitionKey","payload","priority","routingKey","status"]},{a:{p:["channelId","gid","metrics","name","status","url"]}},{p:["channelId","gid","metrics","name","status","url"]},{p:["gid","removed"]},{a:{p:["acknowledgedUpTo","createdAt","createdBy","gid","metadata","name","offset","pendingCount","subscriptionGid"]}},{p:["channelGid","deliveryConfig","filterGap","gid","hasWebhookSecret","kernelCursorId","name","status","type"],c:{deliveryConfig:{p:["maxPerMinute"]},filterGap:{a:{p:["operator","path"]}}}},{p:["channelGid","deliveryConfig","filterGap","gid","hasWebhookSecret","name","status","type"],c:{deliveryConfig:{p:["maxPerMinute"]},filterGap:{a:{p:["operator","path"]}}}},{p:["archived","canceledDeliveries","success"]},{p:["acked","deadLettered","duplicateTokens","extended","notFound","ok","processed","reason","rejected","rejectedDuplicateSeqs","tokensRedeemed"]},{a:{p:["createdAt","deferUntil","deliveryGid","gid","processingTimeMs","reason","responseCode","status","subscriptionGid"]}},{a:{p:["adapterDlqSlug","adapterType","attemptCount","createdAt","expiresAt","failedAt","failureAttempts","failureCount","failureReason","frameHash","frameSeq","gid","hlcTimestamp","lastError","lastErrorMessage","lastFailureReason","lastFailureTimestamp","lastHttpStatus","messageGid","orgId","originalMetadata","originalPayload","producerThumbprint","rejectionReason","reprocessHistory","reprocessResult","reprocessedAt","reprocessedBy","status","subscriptionGid","suppressedFailureEmits","updatedAt"],c:{reprocessHistory:{a:{p:["actor","at","note","result"]}},suppressedFailureEmits:{a:{p:["eventType","failureSourceChannelSlug","failureSourceSubscriptionGid","reason","redirectedTo","targetChannelSlug"]}}}}},{p:["errors","processed","success","total"],c:{errors:{a:{p:["error","id"]}}}},{p:["discarded","newestPendingAt","oldestPendingAt","pending","reprocessed","reprocessing","total"]},{p:["buckets","summary"],c:{buckets:{a:{p:["count","hour","timestamp"]}},summary:{p:["bucketSizeMs","currentPending","totalInWindow","windowEndMs","windowStartMs"]}}},{p:["credit","delivered","lag","longPollWaitMs","messages","ok","outstandingCredit","reason"],c:{messages:{a:{p:["body","messageId","partitionKey","partitionSlot","receiptHandle","sequence"]}}}},{p:["failed","successful"],c:{failed:{a:{p:["error","receiptHandle"]}}}},{p:["messages"],c:{messages:{a:{p:["attributes","body","messageId","receiptHandle"],c:{attributes:{p:["approximateFirstReceiveTimestamp","approximateReceiveCount","sentTimestamp"]}}}}}},{p:["queue","stats"],c:{queue:{p:["config","createdAt","gid","stats","status","updatedAt"],c:{config:{p:["delaySeconds","dlq","maxReceiveMessages","receiveWaitTimeSeconds","retentionDays","visibilityTimeoutSeconds"],c:{dlq:{p:["enabled","maxReceiveCount"]}}},stats:{p:["approximateMessageCount","approximateNotVisibleCount","oldestMessageTimestamp"]}}},stats:{p:["available","inflight"]}}},{a:{p:["availableAt","createdAt","deduplicationId","expiresAt","firstReceivedAt","gid","hasReceiptHandle","lastReceivedAt","partitionKey","priority","receiveCount","sentTimestamp","status","updatedAt","visibilityDeadline"]}},{p:["purgedCount"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["acknowledgment","createdAt","deliveryGid","expiresAt","gid","messageGid","metadata","proof","status","subscriptionGid","updatedAt"],c:{acknowledgment:{p:["acknowledgedAt","metadata","processedAt","receivedAt"]},proof:{p:["deliveredAt","endpoint","latencyMs","receiptId","responseHash","signatureVerified","statusCode"]}}}}}},{p:["byStatus","latency","total"],c:{byStatus:{p:["acknowledged","delivered","expired","processed","rejected"]},latency:{p:["avg","max","min","p50","p95","p99"]}}},{p:["previousExpiresAt","webhookSecret"]},{p:["webhookSecret"]},{p:["ok","released","subscriptionRetained"]},{p:["availabilityPercent","avgLatencyMs","consecutiveFailures","consecutiveSuccesses","degradedThreshold","lastFailureAt","lastSuccessAt","recoveryThreshold","state","stateChangedAt","subscriptionGid","totalDeliveries","totalFailures","totalSuccesses","unhealthyThreshold","updatedAt"]},{a:{p:["description","lastDelivery","projectionVersion","recentFailureCount","samplePayload","slug","subscription","title"],c:{lastDelivery:{p:["at","ok","statusCode"]},subscription:{p:["channelGid","gid","hasWebhookSecret","name","status","type"]}}}},{p:["channelGid","gid","hasWebhookSecret","name","status","type","webhookSecret"]},{p:["ok"]},{a:{p:["at","errorCode","ok","statusCode"]}},{a:{p:["availabilityPercent","avgLatencyMs","consecutiveFailures","consecutiveSuccesses","degradedThreshold","lastFailureAt","lastSuccessAt","recoveryThreshold","state","stateChangedAt","subscriptionGid","totalDeliveries","totalFailures","totalSuccesses","unhealthyThreshold","updatedAt"]}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["allowedIps","channelGid","createdAt","description","gid","hasSigningSecret","metadata","name","payload","previousSigningSecretExpiresAt","rateLimit","responseMode","revokedAt","revokedBy","revokedReason","signingSecretRotatedAt","status","updatedAt"],c:{payload:{p:["contentTypes","maxSize","transformScript"]},rateLimit:{p:["burstLimit","requestsPerMinute","requestsPerSecond"]}}}}}},{p:["allowedIps","channelGid","createdAt","description","gid","hasSigningSecret","metadata","name","payload","previousSigningSecretExpiresAt","rateLimit","responseMode","revokedAt","revokedBy","revokedReason","signingSecret","signingSecretRotatedAt","status","updatedAt"],c:{payload:{p:["contentTypes","maxSize","transformScript"]},rateLimit:{p:["burstLimit","requestsPerMinute","requestsPerSecond"]}}},{p:["allowedIps","channelGid","createdAt","description","gid","hasSigningSecret","metadata","name","payload","previousSigningSecretExpiresAt","rateLimit","responseMode","revokedAt","revokedBy","revokedReason","signingSecretRotatedAt","status","updatedAt"],c:{payload:{p:["contentTypes","maxSize","transformScript"]},rateLimit:{p:["burstLimit","requestsPerMinute","requestsPerSecond"]}}},{p:["gid","revokedAt","status"]},{p:["previousExpiresAt","signingSecret"]},{p:["environments"],c:{environments:{a:{p:["createdAt","envId","gid","kind","name","pool","slug","status"]}}}},{p:["environment"],c:{environment:{p:["createdAt","envId","gid","kind","name","pool","slug","status"]}}},{p:["bound","cellId","created","environment","pool"],c:{environment:{p:["createdAt","envId","gid","kind","name","pool","slug","status"]}}},{p:["jobGid","targetEnvironment"],c:{targetEnvironment:{p:["createdAt","envId","gid","kind","name","pool","slug","status"]}}},{p:["events","fromTs","limit","toTs"],c:{events:{a:{p:["env","eventName","gid","occurredAt"]}}}},{p:["continueCursor","granularityUsed","isDone","page"],c:{page:{a:{p:["appId","bucketStart","count","deploymentId","env","errorCount","eventName","firstEventAt","gid","lastEventAt","orgId","source","sumBytes","sumDuration","updatedAt"]}}}},{p:["quantile","totalCount","value"]},{p:["entries","totalCount"],c:{entries:{a:{p:["count","error","key"]}}}},{p:["granularityUsed","scannedRows","series","totals","truncated"]},{p:["asOfTs","sources"],c:{sources:{a:{p:["latestAnchor","sourceDeploymentId","status"],c:{latestAnchor:{p:["asOfTs","latestHash","receivedAt","rowCount","signingKeyKid"]}}}}}},{p:["action","actor","appId","env","envId","gid","hash","hashPrev","payload","tenantId","ts"],c:{actor:{p:["id","kind","name"]}}},{p:["cursor","entries","hasMore"],c:{entries:{a:{p:["action","actor","appId","env","envId","gid","hash","hashPrev","payload","target","tenantId","ts"],c:{actor:{p:["id","kind","name"]},target:{p:["gid","kind"]}}}}}},{p:["actors","events","lastVerifiedAt","sensitiveActions","truncated"],c:{actors:{p:["humans","systems"]}}},{p:["converted","inTrial","status","subscriptionStatus","suspendedReason","tier","trialDaysLeft","trialEndsAt","trialExpired","upgradeUrl"]},{p:["chargesEnabled","created","detailsSubmitted","ok","payoutsEnabled","requirementsCurrentlyDue","stripeAccountId"]},{p:["accountId","clientSecret","expiresAt","ok"]},{p:["count","credits"],c:{credits:{a:{p:["amountCents","appliedAt","appliedToInvoiceGid","currency","evidence","generatedAt","gid","incidentId","orgId","period","status"],c:{evidence:{p:["incidentId","measuredUptime","notes","tierCreditAmountCents"]}}}}}},{p:["created","stripeCustomerId","testClockId"]},{p:["cursor","disputes","hasMore"],c:{disputes:{a:{p:["amountCents","chargeId","closedAt","createdAt","currency","id","reason","status"]}}}},{p:["amountCents","chargeId","closedAt","createdAt","currency","id","reason","status"]},{p:["cursor","delinquencies","hasMore"],c:{delinquencies:{a:{p:["attempts","firstFailedAt","graceUntil","id","lastAttemptAt","orgId","resolvedAt","state","stripeCustomerId","stripeInvoiceId"]}}}},{p:["attempts","graceUntil","invoiceId","isDelinquent","nextRetryAt","state"]},{p:["byPeriod","currency","failedCents","paidOutCents","payoutCount","pendingCents","totalEarnedCents","totalGrossCents","totalPlatformFeeCents"],c:{byPeriod:{a:{p:["earnedCents","grossCents","payoutCount","period","platformFeeCents"]}}}},{p:["message","ok","reason"]},{p:["brand","expMonth","expYear","last4"]},{p:["clientSecret","customerId","isTrial","ok","requiresAction","subscriptionId"]},{p:["clientSecret","customerId","latestInvoicePaymentIntentStatus","message","ok","reason","requiresAction","subscriptionId","subscriptionStatus"]},{p:["admin","billingSvc","ok","ts"],c:{admin:{p:["apiVersion","reachable"]},billingSvc:{p:["outageGid","reachable","stripeOutageActive"]}}},{p:["hasMore","invoices"],c:{invoices:{a:{p:["amountDue","amountPaid","created","currency","hostedInvoiceUrl","id","invoicePdf","number","periodEnd","periodStart","status","totalCents"]}}}},{p:["amountDue","amountPaid","created","currency","hostedInvoiceUrl","id","invoicePdf","number","periodEnd","periodStart","status","totalCents"]},{p:["url"]},{a:{p:["brand","expMonth","expYear","id","isDefault","last4"]}},{p:["deduped","paymentMethodId","success"]},{p:["clientSecret","setupIntentId"]},{p:["count","payouts"],c:{payouts:{a:{p:["currency","failureReason","generatedAt","gid","period","platformFeeBps","platformFeeCents","publisherAmountCents","sentAt","status","stripeTransferId","subscriberPaidCents"]}}}},{a:{p:["baseCents","baseCentsYearly","inclusions","planName","tier"]}},{a:{p:["actor","actorRef","effectiveAt","fromTier","gid","id","isTrial","reason","stripeInvoiceId","stripeSubscriptionId","toTier"]}},{p:["currency","grossCents","netCents","paymentCount","platformFeeCents","refundedCount","refundedNetCents"]},{p:["cursor","hasMore","subscriptions"],c:{subscriptions:{a:{p:["cancelAtPeriodEnd","currentPeriodEnd","currentPeriodStart","id","interval","status","tier","trialEnd"]}}}},{p:["clientSecret","status","subscriptionId"]},{p:["cancelAtPeriodEnd","currentPeriodEnd","currentPeriodStart","id","interval","status","tier","trialEnd"]},{p:["cancelAtPeriodEnd","status"]},{p:["clientSecret","requiresAction","status"]},{p:["currency","immediateChargeCents","nextInvoiceCents","nextInvoiceDate"]},{p:["status","subscriptionId"]},{a:{p:["country","id","type","value"]}},{p:["country","id","type","value"]},{p:["available","breakdown","calculationId","currency","reverseCharge","subtotalCents","taxCents","totalCents"],c:{breakdown:{a:{p:["amountCents","jurisdiction","rate"]}}}},{p:["frozenTime","status","testClockId"]},{p:["quotas","tier"],c:{quotas:{p:["active_federations","active_pipes","channels_active","publisher_listings","subscriptions_active","webhooks_active"],c:{active_federations:{p:["current","limit","remaining"]},active_pipes:{p:["current","limit","remaining"]},channels_active:{p:["current","limit","remaining"]},publisher_listings:{p:["current","limit","remaining"]},subscriptions_active:{p:["current","limit","remaining"]},webhooks_active:{p:["current","limit","remaining"]}}}}},{p:["baseCents","grandTotalCents","meters","period","tier","totalUsageCents"],c:{meters:{p:["agent_runs","ai_usage_cents","audit_retention_gb","connector_invocations","data_storage_gb","deliveries","egress_bytes","entity_resolutions","identity_bridge_lookups","llm_input_tokens","llm_output_tokens","memory_storage_gb","messages_published","pipe_steps","scheduled_messages","skill_executions","stream_replay_reads","tool_invocations"],c:{agent_runs:{p:["included","overage","overageCents","used"]},ai_usage_cents:{p:["included","overage","overageCents","used"]},audit_retention_gb:{p:["included","overage","overageCents","used"]},connector_invocations:{p:["included","overage","overageCents","used"]},data_storage_gb:{p:["included","overage","overageCents","used"]},deliveries:{p:["included","overage","overageCents","used"]},egress_bytes:{p:["included","overage","overageCents","used"]},entity_resolutions:{p:["included","overage","overageCents","used"]},identity_bridge_lookups:{p:["included","overage","overageCents","used"]},llm_input_tokens:{p:["included","overage","overageCents","used"]},llm_output_tokens:{p:["included","overage","overageCents","used"]},memory_storage_gb:{p:["included","overage","overageCents","used"]},messages_published:{p:["included","overage","overageCents","used"]},pipe_steps:{p:["included","overage","overageCents","used"]},scheduled_messages:{p:["included","overage","overageCents","used"]},skill_executions:{p:["included","overage","overageCents","used"]},stream_replay_reads:{p:["included","overage","overageCents","used"]},tool_invocations:{p:["included","overage","overageCents","used"]}}},period:{p:["end","start"]}}},{p:["status"]},{p:["items"],c:{items:{a:{p:["action","actor","grantId","ipAddress","logHash","newStatus","prevStatus","previousLogHash","reasonText","source","tenantApprovalId","timestamp","userAgent"],c:{actor:{p:["email","id","kind","name","via"]}}}}}},{p:["revokedApprovals","success"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["appId","appType","approvalCounts","connectVisibility","createdAt","description","governanceStatus","name","orgId","platformSlug","slug","status","updatedAt"],c:{approvalCounts:{p:["active","delisted","expired","frozen","revoked","total"]}}}}}},{p:["affectedCount","partnerOrgId","targetAppId"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["createdAt","evidence","expiresAt","frozenAt","frozenReason","gid","grantGid","status","subscriberAppId","subscriberOrgId","tenantId","updatedAt"],c:{evidence:{p:["consentMethod","consentedAt"]}}}}}},{p:["newStatus","partnerOrgId","tenantApprovalGid"]},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["activatedAt","channelId","createdAt","environmentKind","eventTypes","expiresAt","granteeAppId","granteeOrgId","grantorAppId","grantorOrgId","id","revokedBy","status","updatedAt"]}}}},{p:["id","status"]},{p:["activatedAt","channelId","createdAt","environmentKind","eventTypes","expiresAt","granteeAppId","granteeOrgId","grantorAppId","grantorOrgId","id","revokedBy","status","updatedAt"]},{p:["challengeId","consentUrl","expiresAt"]},{p:["eligibleAppGids","items"],c:{items:{a:{p:["gid","status"]}}}},{p:["hasMore","items","nextCursor"],c:{items:{a:{p:["bannerUrl","category","cellId","channelGid","createdAt","description","documentationUrl","domain","environment","gid","iconUrl","name","pricing","publishedAt","publisherGid","publisherSlug","samplePayload","shortDescription","slug","stats","status","tags","updatedAt","visibility"],c:{pricing:{p:["model","revenueSplit"]},stats:{p:["rating","reviewCount","subscriptions","views"]}}}}}},{p:["bannerUrl","category","cellId","channelGid","createdAt","description","documentationUrl","environment","gid","iconUrl","name","pricing","publishedAt","publisherGid","publisherSlug","samplePayload","shortDescription","slug","stats","status","tags","updatedAt","visibility"],c:{pricing:{p:["model","revenueSplit"]},stats:{p:["rating","reviewCount","subscriptions","views"]}}},{p:["uploadUrl"]},{p:["balance","hasMore","items","nextCursor"],c:{balance:{p:["availableCents","heldBackCents","nextRelease","openDebtsCents","pendingCents"],c:{nextRelease:{p:["amountCents","releaseOn"]}}},items:{a:{p:["amountCents","currency","releasedOn","status"]}}}},{p:["allowed","message","reason"]},{a:{p:["billing","createdAt","defaultRevenueSplit","description","gid","logoUrl","name","notificationPreferences","payoutDestination","slug","stats","status","supportEmail","supportUrl","taxProfile","updatedAt","verifiedAt","websiteUrl"],c:{billing:{p:["chargesEnabled","onboardingComplete","payoutsEnabled","stripeAccountStatus"]},notificationPreferences:{p:["payoutEmails"]},stats:{p:["totalListings","totalRevenueCents","totalSubscribers"]},taxProfile:{p:["country","taxId"]}}}},{p:["billing","createdAt","defaultRevenueSplit","description","gid","logoUrl","name","notificationPreferences","payoutDestination","slug","stats","status","supportEmail","supportUrl","taxProfile","updatedAt","verifiedAt","websiteUrl"],c:{billing:{p:["chargesEnabled","onboardingComplete","payoutsEnabled","stripeAccountStatus"]},notificationPreferences:{p:["payoutEmails"]},stats:{p:["totalListings","totalRevenueCents","totalSubscribers"]},taxProfile:{p:["country","taxId"]}}},{p:["continueCursor","isDone","page"],c:{page:{a:{p:["bannerUrl","category","cellId","channelGid","createdAt","description","documentationUrl","domain","environment","gid","iconUrl","name","pricing","publishedAt","publisherGid","publisherSlug","rejectionReason","reviewFeedback","reviewedAt","samplePayload","shortDescription","slug","stats","status","submittedAt","tags","updatedAt","visibility"],c:{pricing:{p:["model","revenueSplit"]},stats:{p:["rating","reviewCount","subscriptions","views"]}}}}}},{p:["active","total"]},{p:["billing","createdAt","defaultRevenueSplit","description","gid","logoUrl","name","notificationPreferences","payoutDestination","slug","stats","status","supportEmail","supportUrl","taxProfile","updatedAt","verifiedAt","websiteUrl"],c:{billing:{p:["chargesEnabled","detailsSubmitted","email","onboardingComplete","payoutsEnabled","requirementsCurrentlyDue","stripeAccountId","stripeAccountStatus","updatedAt"]},notificationPreferences:{p:["payoutEmails"]},stats:{p:["totalListings","totalRevenueCents","totalSubscribers"]},taxProfile:{p:["country","taxId"]}}},{p:["buyable","category","description","documentationUrl","environment","gid","iconUrl","licence","name","pricing","publisherGid","publisherSlug","ref","salesState","samplePayload","shortDescription","slug","status","subscriberAgreementVersion","tags","visibility"],c:{licence:{p:["type","url","version"]},pricing:{p:["model","revenueSplit"]}}},{p:["currency","grossCents","listingGid","netCents","paymentCount","platformFeeCents","refundedCount","subscriptionGid","window"],c:{window:{p:["sinceMs","untilMs"]}}},{p:["currency","listings","window"],c:{listings:{a:{p:["grossCents","listingGid","netCents","paymentCount","platformFeeCents","refundedCount"]}},window:{p:["sinceMs","untilMs"]}}},{p:["decisionId","status"]},{a:{p:["activatedAt","billingCycle","cancelledAt","createdAt","currentPeriodEnd","currentPeriodStart","environment","expiresAt","gid","listingGid","mode","paymentStatus","publisherGid","status","targetAppGids","tierName","updatedAt"]}},{p:["activatedAt","billingCycle","cancelledAt","createdAt","currentPeriodEnd","currentPeriodStart","environment","expiresAt","gid","listingGid","mode","paymentStatus","publisherGid","status","targetAppGids","tierName","updatedAt"]},{p:["alreadyPaid","gid","mode"]},{a:{p:["basePrice","listingIconUrl","listingName","listingSlug","pricingModel","publisherName","publisherSlug","subscription"],c:{subscription:{p:["activatedAt","billingCycle","cancelledAt","createdAt","currentPeriodEnd","currentPeriodStart","environment","expiresAt","gid","listingGid","mode","paymentStatus","publisherGid","status","targetAppGids","tierName","updatedAt"]}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["appId","attemptCount","channel","completedAt","enqueuedAt","gid","lastAttemptAt","orgId","recipientId","status","statusHistory","typeSlug"]}}}},{p:["cursor","data","hasMore"],c:{data:{a:{p:["appId","archivedAt","body","channel","createdAt","dataJson","deepLink","expiresAt","gid","orgId","readAt","recipientId","shell","snoozedUntil","status","title","typeSlug"]}}}},{p:["archived"]},{p:["updated"]},{p:["data"],c:{data:{a:{p:["appId","channel","createdAt","digestCadence","globalMute","optIn","orgId","quietHoursEnd","quietHoursStart","recipientId","typeSlug","updatedAt"]}}}},{p:["cleared"]},{p:["unreadCount"]},{a:{p:["bodyTemplate","channel","createdAt","gid","locale","requiredVars","retired","subjectTemplate","typeSlug","updatedAt","version"]}},{p:["bodyTemplate","channel","createdAt","gid","locale","requiredVars","retired","subjectTemplate","typeSlug","updatedAt","version"]},{p:["retired"]},{p:["dispatchGid","emailQueued","inboxGid"]},{p:["body","subject","version"]},{p:["data"],c:{data:{a:{p:["appId","appliesIn","createdAt","defaultChannels","defaultLocale","gid","orgId","payloadSchemaJson","requiredVars","retired","severity","typeSlug","updatedAt","version"]}}}},{p:["appliesIn","createdAt","defaultChannels","defaultLocale","gid","payloadSchemaJson","requiredVars","retired","severity","typeSlug","updatedAt","version"]},{a:{p:["agentGid","boundaries","completedAt","constraints","createdAt","description","gid","lastActivityAt","milestones","name","priority","progress","schedule","status","type","updatedAt"],c:{constraints:{p:["allowedTimeWindows","maxCostPerAction","maxDailyActions","requiresApproval"]},milestones:{a:{p:["completed","completedAt","name"]}}}}},{p:["agentGid","boundaries","completedAt","constraints","createdAt","description","gid","lastActivityAt","milestones","name","priority","progress","schedule","status","type","updatedAt"],c:{constraints:{p:["allowedTimeWindows","maxCostPerAction","maxDailyActions","requiresApproval"]},milestones:{a:{p:["completed","completedAt","name"]}}}},{p:["progress"]},{p:["status","success","terminal"]},{a:{p:["archivedAt","avatar","connectionGids","createdAt","defaultModel","description","gid","isDiscoverable","language","leadAgentGid","maxTurns","name","personality","role","skillGids","slug","status","systemPrompt","tenantId","trustLevel","updatedAt"]}},{p:["archivedAt","avatar","connectionGids","createdAt","defaultModel","description","gid","isDiscoverable","language","leadAgentGid","maxTurns","name","personality","role","skillGids","slug","status","systemPrompt","tenantId","trustLevel","updatedAt"]},{p:["archivedAt","brain","gid","recoveryDeadlineMs","status"]},{p:["archivedAt","brain","gid"]},{p:["conversationId","executionId","output","status"]},{p:["conversationId","executionId","output"]},{p:["alreadyAssigned","success"]},{a:{p:["actionDescription","actionPayload","actionType","agentGid","approvedBy","conversationGid","createdAt","expiresAt","gid","reason","rejectedBy","requiredApprover","resolvedAt","riskFactors","riskTier","status","updatedAt"]}},{p:["actionDescription","actionPayload","actionType","agentGid","approvedBy","conversationGid","createdAt","expiresAt","gid","reason","rejectedBy","requiredApprover","resolvedAt","riskFactors","riskTier","status","updatedAt"]},{p:["approverBreakdown","count","oldestAgeMs"],c:{approverBreakdown:{a:{p:["count","requiredApprover"]}}}},{p:["createdAt","defaultModel","defaultProvider","gid","mode","providers","routing","tokenBudget","updatedAt"],c:{providers:{a:{p:["baseUrl","enabled","keyRef","models","name"]}},tokenBudget:{p:["perMonth","perRun"]}}},{p:["configId","gid"]},{p:["config","providers","stats"],c:{config:{p:["defaultModel","defaultProvider","mode","providers","routing","tokenBudget"],c:{providers:{a:{p:["baseUrl","enabled","keyRef","models","name"]}},tokenBudget:{p:["perMonth","perRun"]}}},providers:{a:{p:["apiKeyMasked","configured","defaultModel","displayName","enabled","modelsCount","name","status","usage24h","usageSharePct"]}},stats:{p:["attribution","cost24h","latencyP50","latencyP99","requests24h","tokens24h","windowCapHit"]}}},{p:["models","providers"],c:{models:{a:{p:["cachedPer1M","capabilities","contextWindow","deprecatedAt","gid","inputPer1M","label","latencyClass","modelId","outputPer1M","privacyClass","provider","source","syncedAt"]}},providers:{a:{p:["lastError","lastSyncedAt","provider","source","stale","syncState"]}}}},{p:["queued","skipped"],c:{queued:{a:{p:["provider"]}},skipped:{a:{p:["provider","reason"]}}}},{p:["keyRef"]},{p:["error","models"],c:{models:{a:{p:["id","label"]}}}},{p:["notes","range","stats","topAgents"],c:{notes:{p:["costSource","providerAttribution","readCap"]},stats:{p:["budgetConsumedPct","costInRange","requestsInRange","tokensInRange","windowCapHit"]},topAgents:{a:{p:["agentGid","costInRange","latencyP95","name","providerDots","rank","requestsInRange","tokensInRange","tokensSharePct","trend7d"]}}}},{p:["counts","ok","results"],c:{results:{a:{p:["action","family","gid","name"]}}}},{p:["agentGoals","agents","brainConfig","mcpServers","runnerEnvs","schemaVersion","skills","tools","triggers"]},{a:{p:["agentGid","appId","createdAt","envId","externalId","gid","lastMessageAt","source","status","summary","tenantId","title","updatedAt"]}},{p:["agentGid","appId","createdAt","envId","externalId","gid","lastMessageAt","source","status","summary","tenantId","title","updatedAt"]},{p:["agentGid","appId","createdAt","envId","externalId","gid","lastMessageAt","messages","source","status","summary","tenantId","title","updatedAt"],c:{messages:{a:{p:["agentGid","appId","compacted","content","conversationGid","createdAt","envId","expiresAt","externalMessageId","externalSenderId","gid","modelUsed","role","source","tokenCount","toolCallId","toolCalls","toolName","updatedAt"],c:{toolCalls:{a:{p:["arguments","id","name"]}}}}}}},{a:{p:["agentGid","agentName","appId","createdAt","envId","gid","lastMessageAt","lastMessagePreview","lastMessageRole","messageCount","status","summary","title","updatedAt"]}},{a:{p:["createdAt","delegateId","delegatorId","gid","parentSessionId","sessionId","status","taskCapabilities","taskDeadline","taskDescription","taskPriority","updatedAt","workflowId"]}},{a:{p:["createdAt","delegateId","delegateName","delegatorId","gid","parentSessionId","sessionId","status","taskCapabilities","taskDeadline","taskDescription","taskPriority","updatedAt","workflowId"]}},{p:["capabilities","limits","tier","upgradeTo"],c:{limits:{p:["usedAgents"]}}},{a:{p:["agentGid","approvalGid","arguments","attempts","batchGid","batchIndex","completedAt","conversationGid","createdAt","durationMs","error","gid","maxAttempts","metrics","output","parentExecutionGid","priority","skillGid","startedAt","status","toolName","triggerSource","triggerType","type"],c:{metrics:{p:["completedAt","durationMs","queuedAt","retries","startedAt","tokensUsed","turnsUsed"],c:{tokensUsed:{p:["input","output","total"]}}}}}},{p:["agentGid","approvalGid","arguments","attempts","batchGid","batchIndex","completedAt","conversationGid","createdAt","durationMs","error","gid","maxAttempts","metrics","output","parentExecutionGid","priority","skillGid","startedAt","status","toolName","triggerSource","triggerType","type"],c:{metrics:{p:["completedAt","durationMs","queuedAt","retries","startedAt","tokensUsed","turnsUsed"],c:{tokensUsed:{p:["input","output","total"]}}}}},{p:["alreadyTerminal","status"]},{p:["actor","agent","conversation","execution"],c:{actor:{p:["displayName","sourceId","type"]},agent:{p:["gid","name"]},conversation:{p:["gid","title"]},execution:{p:["agentGid","approvalGid","arguments","attempts","batchGid","batchIndex","completedAt","conversationGid","createdAt","durationMs","error","gid","maxAttempts","metrics","output","parentExecutionGid","priority","skillGid","startedAt","status","toolName","triggerSource","triggerType","type"],c:{metrics:{p:["completedAt","durationMs","queuedAt","retries","startedAt","tokensUsed","turnsUsed"],c:{tokensUsed:{p:["input","output","total"]}}}}}}},{a:{p:["conversationGid","data","executionGid","expiresAt","gid","sequence","timestamp","type"]}},{a:{p:["durationMs","endTime","error","gid","logs","operation","parentSpanId","service","spanId","startTime","status","tags","traceId"],c:{logs:{a:{p:["level","message","timestamp"]}}}}},{p:["executionGids","gid"]},{p:["avgDurationMs","cancelled","completed","failed","pending","running","toolUsage","total"]},{a:{p:["agentGid","conversationGid","executionGid","gid","guardrail","occurredAt","outcome","reason","subject","toolName"]}},{p:["agentGid","conversationGid","executionGid","gid","guardrail","occurredAt","outcome","reason","subject","toolName"]},{a:{p:["accountEmail","accountId","createdAt","gid","lastUsedAt","name","provider","scopes","status","tokenExpiresAt","updatedAt"]}},{p:["accountEmail","accountId","createdAt","gid","lastUsedAt","name","provider","scopes","status","tokenExpiresAt","updatedAt"]},{p:["disconnected"]},{p:["scheduled"]},{a:{p:["activatedAt","appId","autoResumeAt","createdAt","deactivatedAt","envId","gid","isActive","level","reason","resolutionNotes","resolvedAt","resolvedBy","targetAgentGid","threatLevel","turnedOnBy","updatedAt"],c:{turnedOnBy:{p:["clientId","kind","memberId"]}}}},{p:["activatedAt","appId","autoResumeAt","createdAt","deactivatedAt","envId","gid","isActive","level","reason","resolutionNotes","resolvedAt","resolvedBy","targetAgentGid","threatLevel","turnedOnBy","updatedAt"],c:{turnedOnBy:{p:["clientId","kind","memberId"]}}},{p:["active","agentBlocked","blockingLevel","states"],c:{states:{a:{p:["activatedAt","appId","autoResumeAt","createdAt","deactivatedAt","envId","gid","isActive","level","reason","resolutionNotes","resolvedAt","resolvedBy","targetAgentGid","threatLevel","turnedOnBy","updatedAt"],c:{turnedOnBy:{p:["clientId","kind","memberId"]}}}}}},{a:{p:["agentGid","appId","comment","conversationGid","correction","createdAt","envId","executionGid","gid","messageGid","metadata","ownerId","ownerType","processedAt","processedInto","rating","sentiment","type"],c:{processedInto:{p:["patternId"]}}}},{p:["feedbackGid"]},{a:{p:["agentGid","appId","confidence","consolidatedAt","createdAt","derivedFrom","envId","frequency","gid","isActive","lastAppliedAt","ownerId","ownerType","pattern","type","updatedAt"],c:{derivedFrom:{p:["executionIds","feedbackIds"]},pattern:{p:["contextSignals","description","expectedOutcome"]}}}},{p:["isActive","success"]},{a:{p:["agentGid","appId","confidence","createdAt","description","envId","expiresAt","gid","outcome","ownerId","ownerType","proposedAction","resolvedAt","signals","status","title","type"],c:{outcome:{p:["actualValue","success","userFeedback"]},proposedAction:{p:["description","parameters","skillGid","type"]},signals:{a:{p:["source","type","weight"]}}}}},{a:{p:["agentGid","appId","approvalGid","completedAt","createdAt","description","envId","error","executedAt","executionId","gid","goalGid","ownerId","ownerType","parameters","predictionGid","result","skillGid","status","title","type","userDecision","userDecisionAt","userModification"]}},{p:["decision","status"]},{p:["feedback","patterns","timeRange"],c:{feedback:{p:["avgRating","corrections","negative","positive","total"]},patterns:{p:["active","avgConfidence","byType","total"]}}},{a:{p:["gid","lastError","mcpServerGid","status","tokenExpiresAt","updatedAt"]}},{a:{p:["authMethod","createdAt","description","gid","hasSecret","lastError","lastSyncedAt","mcpProtocolVersion","name","serverInfo","serverUrl","status","toolCount","updatedAt"]}},{p:["discoveredTools","gid","lastError","status"],c:{discoveredTools:{a:{p:["description","name"]}}}},{p:["authMethod","createdAt","description","gid","hasSecret","lastError","lastSyncedAt","mcpProtocolVersion","name","serverInfo","serverUrl","status","toolCount","updatedAt"]},{p:["authorizeUrl","expiresAt"]},{p:["disabledTools"]},{p:["confidential","gid"]},{p:["error","status","toolCount"]},{p:["gid","rotatedAt"]},{p:["error","ok","toolCount","tools"],c:{tools:{a:{p:["description","name"]}}}},{p:["content","contentType","gid","importance","key","tags","type"]},{p:["algorithm","authTagPreviewHash","ciphertextPreviewHash","encryptedAt","keyVersion","memoryGid","nonce","nonceB64Masked","nonceMasked","sizeBytes","sizeBytesOverhead","sizeBytesPlaintext","updatedAt","vaultSecretId"]},{p:["keyVersionAfter","keyVersionBefore","memoryGid","success"]},{a:{p:["accessCount","agentGid","contentType","conversationGid","createdAt","expiresAt","gid","importance","isQuarantined","key","lastAccessedAt","quarantineReason","quarantinedAt","scope","sizeBytes","source","sourceId","tags","type","updatedAt"]}},{p:["accessCount","agentGid","contentType","conversationGid","createdAt","expiresAt","gid","importance","isQuarantined","key","lastAccessedAt","quarantineReason","quarantinedAt","scope","sizeBytes","source","sourceId","tags","type","updatedAt"]},{p:["memories","nextCursor"],c:{memories:{a:{p:["accessCount","agentGid","contentType","conversationGid","createdAt","expiresAt","gid","importance","isQuarantined","key","lastAccessedAt","quarantineReason","quarantinedAt","scope","sizeBytes","source","sourceId","tags","type","updatedAt"]}}}},{p:["executionTimeMs","keywordLeg","memories","rerank","totalFound"],c:{keywordLeg:{p:["bound","candidates","ran","skippedReason"]},memories:{a:{p:["matchType","memory","score"],c:{memory:{p:["accessCount","agentGid","contentType","conversationGid","createdAt","expiresAt","gid","importance","isQuarantined","key","lastAccessedAt","quarantineReason","quarantinedAt","scope","sizeBytes","source","sourceId","tags","type","updatedAt"]}}}}}},{p:["executionTimeMs","memories","query","totalFound"],c:{memories:{a:{p:["decayFactor","finalScore","importanceFactor","keywordScore","matchType","memoryGid","rank","rrfScore","vectorScore"]}}}},{p:["compactedAt","compactedFromMessages","conversation","downstreamMemories","memory"],c:{compactedFromMessages:{a:{p:["content","conversationGid","createdAt","gid","role"]}},conversation:{p:["gid","title"]},downstreamMemories:{a:{p:["gid","type"]}},memory:{p:["accessCount","agentGid","createdAt","gid","importance","lastAccessedAt","scope","tags","type","updatedAt"]}}},{p:["avgRank","days","memoryGid","neverFellOutOfTopK","series","totalRetrievals"],c:{series:{a:{p:["count","day"]}}}},{p:["inputsCount","memoriesCount","total"]},{p:["hasMore","items"],c:{items:{a:{p:["agentGid","contentType","createdAt","gid","quarantineReason","type","updatedAt"]}}}},{a:{p:["gid","labels","name","timestamp","type","value"]}},{p:["count","value"]},{p:["agents","conversations","executions","memories","timestamp"],c:{agents:{p:["active","total"]},conversations:{p:["activeToday","total"]},executions:{p:["lastDay","lastHour","successRate","total"]},memories:{p:["total"]}}},{a:{p:["gid","lastTriggeredAt","message","metadata","name","severity","source","status","triggerCount","triggeredAt"]}},{a:{p:["count","fingerprint","firstOccurrence","gid","lastOccurrence","message","metadata","resolvedAt","source","stack","status","type"]}},{p:["buckets","byField","endTime","startTime","totalErrors","uniqueGroups"],c:{buckets:{a:{p:["count","firstSeen","key","lastSeen"]}}}},{a:{p:["agentGid","endTime","error","gid","logs","operation","parentSpanId","service","spanId","startTime","status","tags","traceId"],c:{logs:{a:{p:["level","message","timestamp"]}}}}},{p:["enabledCount","items","total"],c:{items:{a:{p:["enabled","fires24h","gid","lastTriggeredAt","name","triggerCount","type"]}}}},{p:["algorithm","lastWrite","quarantined","scopes","total"],c:{scopes:{p:["private","team","tenant"]}}},{p:["errorCount24h","errorRate24h","latencyP50Ms","latencyP95Ms","latencyP99Ms","rate24h","ratePerHour","sparkline"]},{p:["agents","conversations","executions","memories","skills","triggers"],c:{agents:{p:["active","total"]},conversations:{p:["total"]},executions:{p:["last24h","total"]},memories:{p:["active","total"]},skills:{p:["active","total"]},triggers:{p:["active","total"]}}},{p:["items"],c:{items:{a:{p:["approach","gid","name","runs7d","sparkline","status","successRate"]}}}},{a:{p:["appId","category","confidence","createdAt","description","discoveredAt","envId","evidence","gid","isActive","key","lastValidated","ownerId","ownerType","source","updatedAt","value"]}},{p:["appId","category","confidence","createdAt","description","discoveredAt","envId","evidence","gid","isActive","key","lastValidated","ownerId","ownerType","source","updatedAt","value"]},{p:["lastValidated","success"]},{a:{p:["agentGid","appId","category","createdAt","definition","description","envId","gid","name","ownerId","ownerType","promotedAt","sourcePatternGid","status","successRate","updatedAt","usageCount","validationResults"],c:{definition:{p:["parameters","toolSequence","triggerConditions"]}}}},{p:["agentGid","appId","category","createdAt","definition","description","envId","gid","name","ownerId","ownerType","promotedAt","sourcePatternGid","status","successRate","updatedAt","usageCount","validationResults"],c:{definition:{p:["parameters","toolSequence","triggerConditions"]}}},{a:{p:["category","description","name","parameters","skillGid"],c:{parameters:{a:{p:["description","name","required","type"]}}}}},{p:["draftsCreated","errors","message","promoted","stagesRun","synthesized"]},{a:{p:["appId","category","createdAt","definition","description","enabled","envId","executor","gid","icon","isBuiltIn","limits","name","ownerId","ownerType","sandboxId","slug","tenantId","updatedAt"],c:{definition:{p:["containerImage","endpoint","examples","systemPrompt","tools"],c:{examples:{a:{p:["input","output"]}}}},limits:{p:["maxCost","maxExecutionTime","maxMemory"]}}}},{p:["appId","category","createdAt","definition","description","enabled","envId","executor","gid","icon","isBuiltIn","limits","name","ownerId","ownerType","sandboxId","slug","tenantId","updatedAt"],c:{definition:{p:["containerImage","endpoint","examples","systemPrompt","tools"],c:{examples:{a:{p:["input","output"]}}}},limits:{p:["maxCost","maxExecutionTime","maxMemory"]}}},{p:["appId","category","createdAt","definition","description","enabled","envId","executions","executor","gid","icon","isBuiltIn","limits","name","ownerId","ownerType","sandboxId","slug","tenantId","updatedAt"],c:{definition:{p:["containerImage","endpoint","examples","systemPrompt","tools"],c:{examples:{a:{p:["input","output"]}}}},executions:{a:{p:["agentGid","appId","completedAt","conversationGid","cost","durationMs","envId","error","executorType","expiresAt","gid","input","output","ownerId","ownerType","skillGid","startedAt","status","tokensUsed","updatedAt"]}},limits:{p:["maxCost","maxExecutionTime","maxMemory"]}}},{p:["avgDurationMs","invocations","p95DurationMs","recent","skillGid","successCount","successRatePct"],c:{recent:{a:{p:["completedAt","cost","durationMs","error","gid","startedAt","status","tokensUsed"]}}}},{p:["capCents","periodStart","resetsAt","spentCents"]},{p:["capCents"]},{p:["lead","specialists"],c:{lead:{p:["agentGid","createdAt","description","gid","name","status"]},specialists:{a:{p:["agentGid","createdAt","description","gid","name","role","skillGids","status"]}}}},{p:["alreadyExists","gid","teamId"]},{p:["activeCount","lead","specialistCount","specialists"],c:{lead:{p:["agentGid","createdAt","description","gid","name","status","systemPrompt","updatedAt"]},specialists:{a:{p:["agentGid","createdAt","description","gid","name","role","skillGids","status"]}}}},{p:["archivedAt","archivedCount","status","success","teamGid"]},{p:["agentGid","leadAgentGid","success"]},{p:["capabilityMatchReason","result","specialistAgentId","specialistName"],c:{result:{p:["error","metrics","response","status"],c:{metrics:{p:["durationMs","tokensUsed","turnsUsed"],c:{tokensUsed:{p:["input","output","total"]}}}}}}},{p:["agentId","memberRole"]},{p:["agentGid","success"]},{p:["alreadyExists","gid","specialistAgentIds","teamId"]},{a:{p:["createdAt","externalId","gid","metadata","name","status","updatedAt"]}},{p:["createdAt","externalId","gid","metadata","name","status","updatedAt"]},{a:{p:["authType","category","createdAt","description","enabled","endpoint","executor","gid","hasSecret","headers","lastUsedAt","name","outputSchema","ownerId","ownerType","parameters","requiresApproval","riskLevel","scopes","slug","source","sourceId","timeout","updatedAt","uri","usageCount"]}},{p:["gid","hmacSecret"]},{p:["authType","category","createdAt","description","enabled","endpoint","executor","gid","hasSecret","headers","lastUsedAt","name","outputSchema","ownerId","ownerType","parameters","requiresApproval","riskLevel","scopes","slug","source","sourceId","timeout","updatedAt","uri","usageCount"]},{p:["error","latencyMs","ok","request","response","signed","sizeBytes","status","statusText"],c:{request:{p:["body","headers","method","url"]},response:{p:["body","headers"]}}},{p:["count","tools"]},{p:["buckets","endTime","startTime","totalInvocations","uniqueTools"],c:{buckets:{a:{p:["avgDurationMs","invocations","p95DurationMs","successCount","successRatePct","toolName"]}}}},{a:{p:["action","agentGid","appId","conditions","config","createdAt","description","enabled","envId","gid","lastTriggeredAt","name","ownerId","ownerType","sandboxId","slug","tenantId","triggerCount","type","updatedAt"],c:{action:{p:["goal","maxTurns","skillGids"]},conditions:{a:{p:["field","operator","value"]}},config:{p:["channel","cronExpression","eventType","webhookId","webhookSecret"]}}}},{p:["gid","webhookSecret"]},{p:["action","agentGid","appId","conditions","config","createdAt","description","enabled","envId","gid","lastTriggeredAt","name","ownerId","ownerType","sandboxId","slug","tenantId","triggerCount","type","updatedAt"],c:{action:{p:["goal","maxTurns","skillGids"]},conditions:{a:{p:["field","operator","value"]}},config:{p:["channel","cronExpression","eventType","webhookId","webhookSecret"]}}},{p:["action","agentGid","appId","conditions","config","createdAt","description","enabled","envId","executions","gid","lastTriggeredAt","name","ownerId","ownerType","sandboxId","slug","tenantId","triggerCount","type","updatedAt"],c:{action:{p:["goal","maxTurns","skillGids"]},conditions:{a:{p:["field","operator","value"]}},config:{p:["channel","cronExpression","eventType","webhookId","webhookSecret"]},executions:{a:{p:["agentGid","appId","completedAt","envId","error","expiresAt","gid","ownerId","ownerType","result","startedAt","status","triggerGid","updatedAt"]}}}},{p:["executionGid"]},{p:["appId","dayUtcMs","envId","invocations","orgId","tenantId"]},{p:["history","total"],c:{history:{a:{p:["executions","timestamp","tokens"]}}}},{p:["executions","tokens"],c:{executions:{p:["limit","remaining","used"]},tokens:{p:["limit","remaining","used"]}}},{p:["agentRuns","chatMessages","memoriesStored","skillExecutions","tokensUsed"]},{a:{p:["createdAt","enabled","events","gid","status","url"]}},{p:["gid","secret"]}],ops:[["GET","/v1/account/environments",204],["POST","/v1/account/environments",205],["GET","/v1/account/environments/{slug}",205],["POST","/v1/account/environments/{slug}/clone",207],["GET","/v1/adapters",0],["POST","/v1/adapters",1],["DELETE","/v1/adapters/{adapterGid}",4],["GET","/v1/adapters/{adapterGid}",2],["PATCH","/v1/adapters/{adapterGid}",3],["GET","/v1/analytics/events/tail",208],["GET","/v1/analytics/rollups",209],["GET","/v1/analytics/sketches/percentile",210],["GET","/v1/analytics/sketches/topk",211],["GET","/v1/analytics/summary",212],["GET","/v1/apps/channels",5],["POST","/v1/apps/channels",6],["GET","/v1/apps/channels/by-slug/{slug}",6],["GET","/v1/apps/channels/paginated",7],["GET","/v1/apps/channels/stats",8],["GET","/v1/apps/deliveries",9],["GET","/v1/apps/dlq",10],["GET","/v1/apps/dpop-keys",11],["POST","/v1/apps/dpop-keys",12],["DELETE","/v1/apps/dpop-keys/{thumbprint}",13],["GET","/v1/apps/events/types",14],["GET","/v1/apps/events/types/deprecated",15],["GET","/v1/apps/messages",16],["GET","/v1/apps/subscriptions",17],["GET","/v1/audit/chain/status",213],["GET","/v1/audit/events/get",214],["GET","/v1/audit/events/list",215],["GET","/v1/audit/events/stats",216],["GET","/v1/billing/account-status",217],["PATCH","/v1/billing/account/address",3],["PATCH","/v1/billing/account/email",3],["POST","/v1/billing/connect-accounts/ensure",218],["POST","/v1/billing/connect-accounts/session",219],["GET","/v1/billing/credits",220],["GET","/v1/billing/disputes",222],["GET","/v1/billing/disputes/{disputeId}",223],["GET","/v1/billing/dunning",224],["GET","/v1/billing/dunning/recovery-status",225],["GET","/v1/billing/earnings/summary",226],["GET","/v1/billing/feed-listings/can-subscribe",227],["GET","/v1/billing/feed-listings/default-payment-method-preview",228],["POST","/v1/billing/feed-listings/subscribe",229],["POST","/v1/billing/feed-listings/subscribe-with-saved-card",230],["GET","/v1/billing/invoices",232],["GET","/v1/billing/invoices/{invoiceId}",233],["GET","/v1/billing/invoices/{invoiceId}/pdf",234],["GET","/v1/billing/payment-methods",235],["POST","/v1/billing/payment-methods/attach",236],["POST","/v1/billing/payment-methods/detach",3],["POST","/v1/billing/payment-methods/set-default",3],["POST","/v1/billing/payment-methods/setup-intent",237],["GET","/v1/billing/payouts",238],["GET","/v1/billing/plans/catalogue",239],["GET","/v1/billing/plans/tier-changes",240],["GET","/v1/billing/revenue/summary",241],["GET","/v1/billing/subscriptions",242],["POST","/v1/billing/subscriptions",243],["POST","/v1/billing/subscriptions/cancel",245],["POST","/v1/billing/subscriptions/confirm-payment",246],["POST","/v1/billing/subscriptions/preview",247],["POST","/v1/billing/subscriptions/reactivate",245],["POST","/v1/billing/subscriptions/tier-change",248],["GET","/v1/billing/subscriptions/{subscriptionId}",244],["GET","/v1/billing/tax-ids",249],["POST","/v1/billing/tax-ids",250],["DELETE","/v1/billing/tax-ids/{taxIdId}",3],["POST","/v1/billing/tax/preview",251],["POST","/v1/billing/test-clock/advance",252],["GET","/v1/billing/usage/quotas",253],["GET","/v1/billing/usage/summary",254],["POST","/v1/channels/{channelGid}/cold-tier/replay",18],["GET","/v1/channels/{channelGid}/consumer-groups",19],["GET","/v1/channels/{channelGid}/scheduled-messages",20],["POST","/v1/channels/{channelGid}/seek-to-timestamp",21],["POST","/v1/channels/{channelGid}/time-travel/diff",22],["POST","/v1/channels/{channelGid}/time-travel/snapshot",23],["POST","/v1/channels/{channelGid}/time-travel/snapshot/grant",24],["DELETE","/v1/channels/{channelId}",27],["GET","/v1/channels/{channelId}",25],["PATCH","/v1/channels/{channelId}",26],["POST","/v1/channels/{channelId}/archive",3],["GET","/v1/channels/{channelId}/archive-status",28],["GET","/v1/channels/{channelId}/delivery-overview",29],["GET","/v1/channels/{channelId}/detail",30],["GET","/v1/channels/{channelId}/messages",16],["POST","/v1/channels/{channelId}/messages",1],["POST","/v1/channels/{channelId}/messages/archive",31],["POST","/v1/channels/{channelId}/messages/batch",32],["POST","/v1/channels/{channelId}/messages/batch-npp",33],["POST","/v1/channels/{channelId}/messages/group",34],["GET","/v1/channels/{channelId}/messages/partition/{partitionKey}",16],["POST","/v1/channels/{channelId}/pause",3],["GET","/v1/channels/{channelId}/receipts",35],["POST","/v1/channels/{channelId}/restore",3],["POST","/v1/channels/{channelId}/resume",3],["GET","/v1/channels/{channelId}/security/scan-sample",36],["POST","/v1/channels/{channelId}/seek",37],["GET","/v1/channels/{channelId}/streams/cross-org",38],["POST","/v1/channels/{channelId}/streams/cross-org/read",39],["POST","/v1/channels/{channelId}/streams/offset",3],["GET","/v1/channels/{channelId}/streams/offsets",40],["GET","/v1/channels/{channelId}/streams/read",39],["POST","/v1/channels/{channelId}/streams/seek",3],["POST","/v1/channels/{channelId}/subscribe",41],["GET","/v1/channels/{channelId}/subscriptions",17],["POST","/v1/channels/{channelId}/subscriptions",42],["GET","/v1/channels/{channelId}/subscriptions/health",43],["POST","/v1/channels/{targetChannelGid}/replay",44],["POST","/v1/channels/{targetChannelGid}/replay-with-grant",45],["GET","/v1/connect/bridges",46],["POST","/v1/connect/bridges",1],["GET","/v1/connect/bridges/{bridgeGid}",47],["POST","/v1/connect/bridges/{bridgeGid}/archive",13],["POST","/v1/connect/bridges/{bridgeGid}/confirm",255],["POST","/v1/connect/bridges/{bridgeGid}/suspend",13],["GET","/v1/connect/consents",48],["GET","/v1/connect/explore",49],["GET","/v1/connect/explore/search",49],["GET","/v1/connect/explore/{appId}",50],["GET","/v1/connect/explore/{appId}/compliance",51],["GET","/v1/connect/grants",52],["POST","/v1/connect/grants",13],["POST","/v1/connect/grants/resume-all",59],["POST","/v1/connect/grants/suspend-all",60],["GET","/v1/connect/grants/{grantId}",53],["POST","/v1/connect/grants/{grantId}/approve",3],["GET","/v1/connect/grants/{grantId}/audit",256],["GET","/v1/connect/grants/{grantId}/consents",48],["POST","/v1/connect/grants/{grantId}/pause",54],["GET","/v1/connect/grants/{grantId}/rates",55],["POST","/v1/connect/grants/{grantId}/reject",3],["POST","/v1/connect/grants/{grantId}/replay-dropped",56],["POST","/v1/connect/grants/{grantId}/resume",54],["POST","/v1/connect/grants/{grantId}/revoke",257],["GET","/v1/connect/grants/{grantId}/trust-score",57],["GET","/v1/connect/grants/{grantId}/usage",58],["GET","/v1/connect/graph",61],["GET","/v1/connect/partner/apps",258],["POST","/v1/connect/partner/apps/{appId}/delist",259],["POST","/v1/connect/partner/apps/{appId}/freeze",259],["POST","/v1/connect/partner/apps/{appId}/reinstate",259],["GET","/v1/connect/partner/apps/{appId}/tenant-approvals",260],["GET","/v1/connect/partner/audit",62],["GET","/v1/connect/partner/tenant-approvals",63],["POST","/v1/connect/partner/tenant-approvals/{approvalGid}/override",261],["GET","/v1/connect/platform-connects/{connectGid}/approvals",63],["GET","/v1/connect/profile",64],["PATCH","/v1/connect/profile/{appId}",3],["GET","/v1/connect/publish-grants",262],["POST","/v1/connect/publish-grants",263],["GET","/v1/connect/publish-grants/{id}",264],["POST","/v1/connect/publish-grants/{id}/pause",263],["POST","/v1/connect/publish-grants/{id}/resume",263],["POST","/v1/connect/publish-grants/{id}/revoke",263],["GET","/v1/connect/tenant-approvals",63],["POST","/v1/connect/tenant-approvals",265],["GET","/v1/connect/tenant-approvals/{approvalGid}",65],["POST","/v1/connect/tenant-approvals/{approvalGid}/revoke",3],["DELETE","/v1/consumer-groups/{consumerGroupGid}",67],["GET","/v1/consumer-groups/{consumerGroupGid}",66],["POST","/v1/consumer-groups/{consumerGroupGid}/members",68],["DELETE","/v1/consumer-groups/{consumerGroupGid}/members/{subscriptionGid}",3],["POST","/v1/consumer-groups/{consumerGroupGid}/members/{subscriptionGid}/receive",69],["POST","/v1/consumer-groups/{consumerGroupGid}/pause",13],["POST","/v1/consumer-groups/{consumerGroupGid}/resume",13],["GET","/v1/deliveries/{deliveryGid}",70],["POST","/v1/deliveries/{deliveryGid}/cancel",71],["POST","/v1/deliveries/{deliveryGid}/retry",72],["GET","/v1/deliveries/{deliveryId}/receipt",73],["GET","/v1/deliveries/{deliveryId}/timeline",74],["GET","/v1/delivery-receipts/{deliveryId}",75],["POST","/v1/delivery-receipts/{deliveryId}/confirm",76],["POST","/v1/dlq/discard",79],["POST","/v1/dlq/reprocess",80],["POST","/v1/dlq/retry",81],["GET","/v1/dlq/{dlqEntryId}",77],["POST","/v1/dlq/{dlqEntryId}/discard",78],["POST","/v1/dlq/{dlqEntryId}/reprocess",78],["GET","/v1/entity-nat/resolve",82],["GET","/v1/entity-nat/reverse-resolve",83],["GET","/v1/events/stats",84],["GET","/v1/events/types/by-name/{name}",85],["GET","/v1/events/types/{eventTypeGid}",85],["POST","/v1/events/types/{eventTypeGid}/compatibility",86],["GET","/v1/events/types/{eventTypeGid}/consumers",87],["GET","/v1/events/types/{eventTypeGid}/impact",88],["GET","/v1/events/types/{eventTypeGid}/versions",89],["GET","/v1/exactly-once/delivered",90],["POST","/v1/exactly-once/tokens",91],["POST","/v1/exactly-once/tokens/{token}/confirm",92],["DELETE","/v1/exchange-bindings/{binding_gid}",3],["GET","/v1/exchanges",93],["POST","/v1/exchanges",94],["GET","/v1/exchanges/stats",100],["DELETE","/v1/exchanges/{exchange_gid}",95],["GET","/v1/exchanges/{exchange_gid}",94],["PATCH","/v1/exchanges/{exchange_gid}",94],["GET","/v1/exchanges/{exchange_gid}/bindings",96],["POST","/v1/exchanges/{exchange_gid}/bindings",97],["POST","/v1/exchanges/{exchange_gid}/disable",3],["POST","/v1/exchanges/{exchange_gid}/dry-run",98],["POST","/v1/exchanges/{exchange_gid}/enable",3],["POST","/v1/exchanges/{exchange_gid}/publish",99],["GET","/v1/exchanges/{exchange_gid}/raw",94],["GET","/v1/feeds/customers",101],["GET","/v1/feeds/customers/{subscriptionId}",102],["GET","/v1/feeds/enrichment/listings",103],["GET","/v1/feeds/enrichment/subscriptions",104],["GET","/v1/feeds/listing-eligible-apps",266],["GET","/v1/feeds/listings",267],["POST","/v1/feeds/listings",1],["POST","/v1/feeds/listings/upload-url",269],["DELETE","/v1/feeds/listings/{listingId}",196],["GET","/v1/feeds/listings/{listingId}",268],["POST","/v1/feeds/listings/{listingId}",196],["POST","/v1/feeds/listings/{listingId}/pricing",196],["GET","/v1/feeds/listings/{listingId}/promise",105],["PUT","/v1/feeds/listings/{listingId}/promise",106],["POST","/v1/feeds/listings/{listingId}/publish",196],["GET","/v1/feeds/listings/{listingId}/reviews",107],["POST","/v1/feeds/listings/{listingId}/submit",196],["POST","/v1/feeds/listings/{listingId}/subscribe",13],["POST","/v1/feeds/listings/{listingId}/unpublish",196],["POST","/v1/feeds/listings/{listingId}/withdraw",196],["GET","/v1/feeds/mirror/listings/{listingId}",108],["GET","/v1/feeds/mirror/publishers/{publisherId}",109],["GET","/v1/feeds/payouts",270],["GET","/v1/feeds/publisher-eligibility",271],["GET","/v1/feeds/publishers",272],["POST","/v1/feeds/publishers",13],["GET","/v1/feeds/publishers/by-slug/{slug}",273],["GET","/v1/feeds/publishers/me",276],["GET","/v1/feeds/publishers/{publisherId}",273],["POST","/v1/feeds/publishers/{publisherId}",196],["GET","/v1/feeds/publishers/{publisherId}/listings",274],["POST","/v1/feeds/publishers/{publisherId}/revoke",196],["GET","/v1/feeds/publishers/{publisherId}/subscriber-count",275],["GET","/v1/feeds/publishers/{publisherSlug}/listings/{listingSlug}",268],["GET","/v1/feeds/reputation/me",110],["GET","/v1/feeds/resolve/{publisherSlug}/{listingSlug}",277],["GET","/v1/feeds/revenue/customers/{subscriptionId}",278],["GET","/v1/feeds/revenue/listings",279],["GET","/v1/feeds/reviews/{reviewId}",111],["POST","/v1/feeds/reviews/{reviewId}/flag",1],["POST","/v1/feeds/reviews/{reviewId}/respond",1],["GET","/v1/feeds/subscriptions",281],["GET","/v1/feeds/subscriptions/enriched",284],["DELETE","/v1/feeds/subscriptions/{subscriptionId}",196],["GET","/v1/feeds/subscriptions/{subscriptionId}",282],["GET","/v1/feeds/subscriptions/{subscriptionId}/bindings",112],["POST","/v1/feeds/subscriptions/{subscriptionId}/convert-to-paid",283],["POST","/v1/feeds/subscriptions/{subscriptionId}/pause",196],["POST","/v1/feeds/subscriptions/{subscriptionId}/resume",196],["POST","/v1/feeds/subscriptions/{subscriptionId}/reviews",1],["GET","/v1/feeds/subscriptions/{subscriptionId}/trial",113],["GET","/v1/groups/{groupId}/grants/{grantId}/deliveries",9],["DELETE","/v1/kv/{channelGid}/{key}",3],["GET","/v1/kv/{channelGid}/{key}",114],["PUT","/v1/kv/{channelGid}/{key}",115],["GET","/v1/kv/{channelGid}/{key}/history",116],["GET","/v1/messages/search",121],["GET","/v1/messages/{messageGid}/deliveries",9],["POST","/v1/messages/{messageGid}/time-travel",117],["GET","/v1/messages/{messageId}",118],["GET","/v1/messages/{messageId}/delivery-status",119],["GET","/v1/messages/{messageId}/receipts",120],["GET","/v1/notifications/dispatches",285],["GET","/v1/notifications/inbox",286],["POST","/v1/notifications/inbox/mark-all-read",288],["POST","/v1/notifications/inbox/{gid}/archive",287],["POST","/v1/notifications/inbox/{gid}/mark-read",288],["DELETE","/v1/notifications/preferences",290],["GET","/v1/notifications/preferences",289],["PUT","/v1/notifications/preferences",288],["PUT","/v1/notifications/preferences/digest",288],["PUT","/v1/notifications/preferences/global-mute",288],["PUT","/v1/notifications/preferences/quiet-hours",288],["GET","/v1/notifications/summary",291],["GET","/v1/notifications/templates",292],["POST","/v1/notifications/templates",1],["POST","/v1/notifications/templates/preview",296],["GET","/v1/notifications/templates/{gid}",293],["PATCH","/v1/notifications/templates/{gid}",288],["POST","/v1/notifications/templates/{gid}/retire",294],["POST","/v1/notifications/templates/{gid}/test-send",295],["GET","/v1/notifications/types",297],["GET","/v1/notifications/types/{typeSlug}",298],["GET","/v1/pipes/agent-executions",122],["GET","/v1/pipes/agent-executions/{agentExecutionGid}",123],["GET","/v1/pipes/analyses",124],["GET","/v1/pipes/analyses/{analysisGid}",125],["GET","/v1/pipes/connectors",126],["GET","/v1/pipes/credentials",127],["POST","/v1/pipes/credentials",128],["POST","/v1/pipes/credentials/test",133],["DELETE","/v1/pipes/credentials/{credentialId}",130],["PATCH","/v1/pipes/credentials/{credentialId}",129],["POST","/v1/pipes/credentials/{credentialId}/revoke",131],["POST","/v1/pipes/credentials/{credentialId}/rotate",132],["GET","/v1/pipes/decisions",134],["GET","/v1/pipes/decisions/{decisionGid}",135],["POST","/v1/pipes/decisions/{decisionGid}/approve",136],["POST","/v1/pipes/decisions/{decisionGid}/reject",136],["GET","/v1/pipes/dlq",137],["GET","/v1/pipes/dlq/stats",140],["GET","/v1/pipes/dlq/{dlqEntryId}",138],["POST","/v1/pipes/dlq/{dlqEntryId}/discard",139],["GET","/v1/pipes/executions/{executionId}",141],["POST","/v1/pipes/executions/{executionId}/cancel",13],["GET","/v1/pipes/executions/{executionId}/status",141],["GET","/v1/pipes/governance",142],["PATCH","/v1/pipes/governance",142],["DELETE","/v1/pipes/governance/allowlist",3],["POST","/v1/pipes/governance/allowlist",3],["GET","/v1/pipes/governance/approvals",143],["POST","/v1/pipes/governance/approvals",144],["GET","/v1/pipes/governance/approvals/pending",143],["POST","/v1/pipes/governance/approvals/{requestId}/approve",3],["POST","/v1/pipes/governance/approvals/{requestId}/reject",3],["GET","/v1/pipes/governance/audit",145],["DELETE","/v1/pipes/governance/blocklist",3],["POST","/v1/pipes/governance/blocklist",3],["POST","/v1/pipes/governance/connectors/{connectorGid}/revoke",3],["GET","/v1/pipes/record-dlq",146],["GET","/v1/pipes/record-dlq/stats",150],["GET","/v1/pipes/record-dlq/{entryGid}",147],["POST","/v1/pipes/record-dlq/{entryGid}/discard",148],["POST","/v1/pipes/record-dlq/{entryGid}/replay",149],["GET","/v1/pipes/tools",151],["GET","/v1/pipes/tools/{toolName}",152],["GET","/v1/pipes/watermarks",153],["GET","/v1/pipes/watermarks/{sourceId}",154],["POST","/v1/pipes/watermarks/{watermarkGid}/reset",155],["GET","/v1/pipes/webhook-triggers",156],["GET","/v1/pipes/webhook-triggers/{workflowId}",157],["POST","/v1/pipes/webhook-triggers/{workflowId}/rotate-secret",158],["GET","/v1/pipes/workflows",159],["POST","/v1/pipes/workflows",160],["DELETE","/v1/pipes/workflows/{workflowId}",162],["GET","/v1/pipes/workflows/{workflowId}",160],["PATCH","/v1/pipes/workflows/{workflowId}",161],["POST","/v1/pipes/workflows/{workflowId}/activate",163],["POST","/v1/pipes/workflows/{workflowId}/archive",163],["GET","/v1/pipes/workflows/{workflowId}/executions",164],["PATCH","/v1/pipes/workflows/{workflowId}/meta",161],["POST","/v1/pipes/workflows/{workflowId}/nodes/{nodeId}/execute",165],["POST","/v1/pipes/workflows/{workflowId}/pause",163],["POST","/v1/pipes/workflows/{workflowId}/trigger",166],["PATCH","/v1/pipes/workflows/{workflowId}/trigger-config",167],["GET","/v1/primus/agent-goals",299],["POST","/v1/primus/agent-goals",1],["GET","/v1/primus/agent-goals/{goalId}",300],["PATCH","/v1/primus/agent-goals/{goalId}",3],["POST","/v1/primus/agent-goals/{goalId}/progress",301],["POST","/v1/primus/agent-goals/{goalId}/status",302],["GET","/v1/primus/agents",303],["POST","/v1/primus/agents",1],["DELETE","/v1/primus/agents/{agentId}",305],["GET","/v1/primus/agents/{agentId}",304],["PATCH","/v1/primus/agents/{agentId}",1],["POST","/v1/primus/agents/{agentId}/activate",1],["POST","/v1/primus/agents/{agentId}/archive",306],["POST","/v1/primus/agents/{agentId}/invoke",307],["POST","/v1/primus/agents/{agentId}/pause",1],["POST","/v1/primus/agents/{agentId}/run",308],["POST","/v1/primus/agents/{agentId}/skills/assign",309],["POST","/v1/primus/agents/{agentId}/skills/unassign",3],["GET","/v1/primus/approvals",310],["POST","/v1/primus/approvals",1],["GET","/v1/primus/approvals/by-agent",310],["GET","/v1/primus/approvals/pending",310],["GET","/v1/primus/approvals/pending/summary",312],["GET","/v1/primus/approvals/{approvalId}",311],["POST","/v1/primus/approvals/{approvalId}/approve",1],["POST","/v1/primus/approvals/{approvalId}/reject",1],["DELETE","/v1/primus/brain/config",4],["GET","/v1/primus/brain/config",313],["PUT","/v1/primus/brain/config",314],["GET","/v1/primus/brain/llm-dashboard",315],["GET","/v1/primus/brain/models",316],["POST","/v1/primus/brain/models/refresh",317],["POST","/v1/primus/brain/provider-keys",318],["POST","/v1/primus/brain/provider-models",319],["GET","/v1/primus/brain/usage-dashboard",320],["POST","/v1/primus/config/apply",321],["GET","/v1/primus/config/export",322],["GET","/v1/primus/conversations",323],["POST","/v1/primus/conversations",1],["GET","/v1/primus/conversations/by-agent",323],["GET","/v1/primus/conversations/stats",326],["DELETE","/v1/primus/conversations/{conversationId}",1],["GET","/v1/primus/conversations/{conversationId}",324],["PATCH","/v1/primus/conversations/{conversationId}",1],["POST","/v1/primus/conversations/{conversationId}/archive",1],["GET","/v1/primus/conversations/{conversationId}/messages",325],["POST","/v1/primus/conversations/{conversationId}/send",1],["GET","/v1/primus/delegations/by-delegate",327],["GET","/v1/primus/delegations/by-delegator",327],["GET","/v1/primus/delegations/by-team",328],["GET","/v1/primus/entitlements",329],["GET","/v1/primus/executions",330],["POST","/v1/primus/executions",13],["POST","/v1/primus/executions/batch",336],["GET","/v1/primus/executions/by-agent",330],["GET","/v1/primus/executions/by-conversation",330],["GET","/v1/primus/executions/pending-approvals",330],["GET","/v1/primus/executions/stats",337],["GET","/v1/primus/executions/{executionId}",331],["POST","/v1/primus/executions/{executionId}/approve",3],["POST","/v1/primus/executions/{executionId}/cancel",332],["GET","/v1/primus/executions/{executionId}/details",333],["GET","/v1/primus/executions/{executionId}/events",334],["POST","/v1/primus/executions/{executionId}/reject",3],["GET","/v1/primus/executions/{executionId}/traces",335],["GET","/v1/primus/guardrails/outcomes",338],["GET","/v1/primus/guardrails/outcomes/{outcomeId}",339],["GET","/v1/primus/integrations",340],["POST","/v1/primus/integrations/connect",1],["GET","/v1/primus/integrations/{connectionId}",341],["POST","/v1/primus/integrations/{connectionId}/disconnect",342],["POST","/v1/primus/integrations/{connectionId}/refresh",343],["GET","/v1/primus/kill-switch",344],["POST","/v1/primus/kill-switch/activate",1],["GET","/v1/primus/kill-switch/active",344],["GET","/v1/primus/kill-switch/check",345],["POST","/v1/primus/kill-switch/deactivate",3],["GET","/v1/primus/kill-switch/status",346],["GET","/v1/primus/kill-switch/{killSwitchId}",345],["GET","/v1/primus/learning/feedback",347],["POST","/v1/primus/learning/feedback",348],["GET","/v1/primus/learning/feedback/by-agent",347],["GET","/v1/primus/learning/patterns",349],["GET","/v1/primus/learning/patterns/by-agent",349],["POST","/v1/primus/learning/patterns/set-active",350],["GET","/v1/primus/learning/predictions",351],["GET","/v1/primus/learning/proactive-actions",352],["POST","/v1/primus/learning/proactive-actions/decide",353],["GET","/v1/primus/learning/stats",354],["GET","/v1/primus/mcp-connections",355],["POST","/v1/primus/mcp-connections/{credentialId}/revoke",1],["GET","/v1/primus/mcp-servers",356],["POST","/v1/primus/mcp-servers",357],["POST","/v1/primus/mcp-servers/test",364],["GET","/v1/primus/mcp-servers/{mcpServerId}",358],["POST","/v1/primus/mcp-servers/{mcpServerId}/connect/begin",359],["POST","/v1/primus/mcp-servers/{mcpServerId}/disconnect",360],["POST","/v1/primus/mcp-servers/{mcpServerId}/oauth/client",361],["POST","/v1/primus/mcp-servers/{mcpServerId}/reconnect",362],["POST","/v1/primus/mcp-servers/{mcpServerId}/rename",1],["POST","/v1/primus/mcp-servers/{mcpServerId}/rotate-auth",363],["POST","/v1/primus/memories/{memoryId}/decrypt",365],["GET","/v1/primus/memories/{memoryId}/encryption",366],["POST","/v1/primus/memories/{memoryId}/reencrypt",367],["GET","/v1/primus/memory",368],["POST","/v1/primus/memory",1],["GET","/v1/primus/memory/by-agent",368],["GET","/v1/primus/memory/by-conversation",368],["GET","/v1/primus/memory/quarantined",368],["GET","/v1/primus/memory/recall",370],["POST","/v1/primus/memory/search",371],["POST","/v1/primus/memory/search/explain",372],["POST","/v1/primus/memory/store",1],["GET","/v1/primus/memory/store/by-team",368],["GET","/v1/primus/memory/store/list",368],["GET","/v1/primus/memory/store/quarantine-summary",375],["GET","/v1/primus/memory/store/quarantined",376],["GET","/v1/primus/memory/store/{memoryId}/lineage",373],["GET","/v1/primus/memory/store/{memoryId}/retrieval-history",374],["DELETE","/v1/primus/memory/{memoryId}",3],["GET","/v1/primus/memory/{memoryId}",369],["PATCH","/v1/primus/memory/{memoryId}",3],["POST","/v1/primus/memory/{memoryId}/quarantine",3],["POST","/v1/primus/memory/{memoryId}/unquarantine",78],["GET","/v1/primus/metrics",377],["GET","/v1/primus/metrics/aggregate",378],["GET","/v1/primus/metrics/system",379],["GET","/v1/primus/observability/alerts",380],["POST","/v1/primus/observability/alerts/acknowledge",3],["POST","/v1/primus/observability/alerts/resolve",3],["GET","/v1/primus/observability/errors",381],["GET","/v1/primus/observability/errors/by-agent",381],["GET","/v1/primus/observability/errors/by-execution",381],["GET","/v1/primus/observability/errors/distribution",382],["POST","/v1/primus/observability/errors/resolve",3],["GET","/v1/primus/observability/traces/{traceId}",383],["GET","/v1/primus/overview/active-triggers",384],["GET","/v1/primus/overview/memory-health",385],["GET","/v1/primus/overview/metrics-summary",386],["GET","/v1/primus/overview/stats",387],["GET","/v1/primus/overview/top-agents",388],["GET","/v1/primus/self-knowledge",389],["POST","/v1/primus/self-knowledge",1],["GET","/v1/primus/self-knowledge/{knowledgeId}",390],["POST","/v1/primus/self-knowledge/{knowledgeId}/active",350],["POST","/v1/primus/self-knowledge/{knowledgeId}/validate",391],["GET","/v1/primus/skill-synthesis",392],["GET","/v1/primus/skill-synthesis/for-tool",394],["POST","/v1/primus/skill-synthesis/run-pipeline",395],["GET","/v1/primus/skill-synthesis/{skillId}",393],["POST","/v1/primus/skill-synthesis/{skillId}/promote",3],["GET","/v1/primus/skills",396],["POST","/v1/primus/skills",1],["GET","/v1/primus/skills/built-in",396],["GET","/v1/primus/skills/by-category",396],["DELETE","/v1/primus/skills/{skillId}",1],["GET","/v1/primus/skills/{skillId}",397],["PATCH","/v1/primus/skills/{skillId}",1],["POST","/v1/primus/skills/{skillId}/disable",1],["POST","/v1/primus/skills/{skillId}/enable",1],["GET","/v1/primus/skills/{skillId}/executions",398],["GET","/v1/primus/skills/{skillId}/stats",399],["GET","/v1/primus/spend-cap",400],["PUT","/v1/primus/spend-cap",401],["GET","/v1/primus/teams",402],["POST","/v1/primus/teams",403],["POST","/v1/primus/teams/assign",406],["POST","/v1/primus/teams/delegate",407],["POST","/v1/primus/teams/members",408],["POST","/v1/primus/teams/remove-member",3],["POST","/v1/primus/teams/unassign",409],["POST","/v1/primus/teams/with-specialists",410],["DELETE","/v1/primus/teams/{teamId}",405],["GET","/v1/primus/teams/{teamId}",404],["PATCH","/v1/primus/teams/{teamId}",3],["GET","/v1/primus/tenants",411],["POST","/v1/primus/tenants",1],["GET","/v1/primus/tenants/by-external-id",412],["GET","/v1/primus/tenants/{tenantId}",412],["PATCH","/v1/primus/tenants/{tenantId}",1],["POST","/v1/primus/tenants/{tenantId}/archive",3],["POST","/v1/primus/tenants/{tenantId}/suspend",3],["GET","/v1/primus/tools",413],["POST","/v1/primus/tools",414],["GET","/v1/primus/tools/by-name",415],["POST","/v1/primus/tools/import",417],["GET","/v1/primus/tools/stats",418],["DELETE","/v1/primus/tools/{toolId}",1],["GET","/v1/primus/tools/{toolId}",415],["PATCH","/v1/primus/tools/{toolId}",1],["POST","/v1/primus/tools/{toolId}/disable",1],["POST","/v1/primus/tools/{toolId}/enable",1],["POST","/v1/primus/tools/{toolId}/test",416],["GET","/v1/primus/triggers",419],["POST","/v1/primus/triggers",420],["GET","/v1/primus/triggers/by-agent",419],["DELETE","/v1/primus/triggers/{triggerId}",1],["GET","/v1/primus/triggers/{triggerId}",421],["PATCH","/v1/primus/triggers/{triggerId}",1],["POST","/v1/primus/triggers/{triggerId}/disable",1],["POST","/v1/primus/triggers/{triggerId}/enable",1],["GET","/v1/primus/triggers/{triggerId}/executions",422],["POST","/v1/primus/triggers/{triggerId}/rotate-secret",420],["POST","/v1/primus/triggers/{triggerId}/test-fire",423],["GET","/v1/primus/usage/by-tenant",424],["GET","/v1/primus/usage/history",425],["GET","/v1/primus/usage/limits",426],["GET","/v1/primus/usage/summary",427],["GET","/v1/primus/webhooks",428],["POST","/v1/primus/webhooks",429],["DELETE","/v1/primus/webhooks/{webhookId}",171],["GET","/v1/receipts/{receiptId}",73],["POST","/v1/receipts/{receiptId}/acknowledge",3],["GET","/v1/scheduled-messages/{scheduledMessageGid}",168],["PATCH","/v1/scheduled-messages/{scheduledMessageGid}",168],["POST","/v1/scheduled-messages/{scheduledMessageGid}/cancel",168],["POST","/v1/snapshots/{snapshotGid}/seek",21],["GET","/v1/sources",169],["DELETE","/v1/sources/{sourceGid}",171],["GET","/v1/sources/{sourceGid}",170],["POST","/v1/sources/{sourceGid}/pause",13],["POST","/v1/sources/{sourceGid}/resume",13],["GET","/v1/subscriptions/{subscriptionGid}/deliveries",9],["GET","/v1/subscriptions/{subscriptionGid}/snapshots",172],["DELETE","/v1/subscriptions/{subscriptionId}",175],["GET","/v1/subscriptions/{subscriptionId}",173],["PATCH","/v1/subscriptions/{subscriptionId}",174],["POST","/v1/subscriptions/{subscriptionId}/ack",176],["POST","/v1/subscriptions/{subscriptionId}/archive",3],["GET","/v1/subscriptions/{subscriptionId}/delivery-receipts",177],["GET","/v1/subscriptions/{subscriptionId}/dlq",178],["POST","/v1/subscriptions/{subscriptionId}/dlq/reprocess",179],["GET","/v1/subscriptions/{subscriptionId}/dlq/stats",180],["GET","/v1/subscriptions/{subscriptionId}/dlq/trend",181],["POST","/v1/subscriptions/{subscriptionId}/flow-credit",182],["POST","/v1/subscriptions/{subscriptionId}/messages/batch-delete",183],["POST","/v1/subscriptions/{subscriptionId}/messages/batch-visibility",183],["POST","/v1/subscriptions/{subscriptionId}/messages/receive",184],["DELETE","/v1/subscriptions/{subscriptionId}/messages/{receiptHandle}",3],["POST","/v1/subscriptions/{subscriptionId}/messages/{receiptHandle}/visibility",3],["POST","/v1/subscriptions/{subscriptionId}/pause",3],["GET","/v1/subscriptions/{subscriptionId}/queue",185],["PATCH","/v1/subscriptions/{subscriptionId}/queue/config",3],["GET","/v1/subscriptions/{subscriptionId}/queue/messages",186],["POST","/v1/subscriptions/{subscriptionId}/queue/purge",187],["GET","/v1/subscriptions/{subscriptionId}/receipts",188],["GET","/v1/subscriptions/{subscriptionId}/receipts/stats",189],["POST","/v1/subscriptions/{subscriptionId}/resume",3],["POST","/v1/subscriptions/{subscriptionId}/rotate",190],["POST","/v1/subscriptions/{subscriptionId}/secret/reveal",191],["POST","/v1/subscriptions/{subscriptionId}/unsubscribe",192],["GET","/v1/subscriptions/{subscriptionId}/webhook-health",193],["GET","/v1/system-events/catalog",194],["POST","/v1/system-events/subscriptions",195],["DELETE","/v1/system-events/subscriptions/{subscriptionId}",196],["GET","/v1/system-events/subscriptions/{subscriptionId}/deliveries",197],["POST","/v1/system-events/subscriptions/{subscriptionId}/rotate",191],["GET","/v1/tools",413],["GET","/v1/webhook-health/degraded",198],["GET","/v1/webhooks",199],["POST","/v1/webhooks",200],["DELETE","/v1/webhooks/{webhookId}",202],["GET","/v1/webhooks/{webhookId}",201],["PATCH","/v1/webhooks/{webhookId}",201],["POST","/v1/webhooks/{webhookId}/reveal-secret",203],["POST","/v1/webhooks/{webhookId}/rotate-secret",203]]};var Bb=Object.freeze({});function gy(i){if(i!==null&&typeof i=="object"){let o=i._extra;if(o!==null&&typeof o=="object")return o}return Bb}u(gy,"extraOf");var hy;function qb(){let i=new Map;for(let[o,e,t]of Yr.ops){let r=Yr.shapes[t];if(!r)continue;let s=0,n=e.split("/").map(c=>/^\{[^}]+\}$/.test(c)?(s++,"[^/]+"):c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("/"),p=i.get(o)??[];p.push({re:new RegExp(`^${n}/?$`),params:s,shape:r}),i.set(o,p)}return i}u(qb,"compile");function Lb(i){try{return new URL(i).pathname}catch{let e=(i.split(/[?#]/)[0]??i).replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"");return e.startsWith("/")?e:`/${e}`}}u(Lb,"pathOf");function Fb(i,o){hy??=qb();let e=hy.get(i.toUpperCase());if(!e)return;let t=Lb(o),r;for(let s of e)s.re.test(t)&&(!r||s.params<r.params)&&(r=s);return r?.shape}u(Fb,"knownShapeFor");function my(i){if(i===null||typeof i!="object"||Array.isArray(i))return!1;let o=Object.getPrototypeOf(i);return o===Object.prototype||o===null}u(my,"isPlainObject");function yy(i,o){Object.prototype.hasOwnProperty.call(i,"_extra")||!Object.isExtensible(i)||Object.defineProperty(i,"_extra",{value:Object.freeze(o),enumerable:!1,configurable:!0,writable:!1})}u(yy,"defineExtra");var Ry=new WeakMap;function Db(i){let o=Ry.get(i);return o||(o=new Set(i.p),Ry.set(i,o)),o}u(Db,"knownOf");var zb=12;function Ps(i,o,e){if(e>zb)return;if("a"in o){if(Array.isArray(i)){for(let s of i)Ps(s,o.a,e+1);return}if(my(i)){yy(i,{...i});for(let s of Object.values(i))Array.isArray(s)&&Ps(s,o.a,e+1)}return}if(Array.isArray(i)){for(let s of i)Ps(s,o,e+1);return}if(!my(i))return;let t=Db(o),r={};for(let[s,n]of Object.entries(i))t.has(s)||(r[s]=n);if(yy(i,r),o.c)for(let[s,n]of Object.entries(o.c))s in i&&Ps(i[s],n,e+1)}u(Ps,"apply");function Py(i,o,e){try{let t=Fb(i,o);t&&Ps(e,t,0)}catch{}return e}u(Py,"attachExtra");function gc(i){let o=i!==null&&typeof i=="object"&&!Array.isArray(i)?i:{},t={gid:typeof o.gid=="string"?o.gid:typeof o.messageGid=="string"?o.messageGid:void 0},r={};for(let[s,n]of Object.entries(o))s==="gid"||s==="_extra"||(r[s]=n);return Object.defineProperty(t,"_extra",{value:Object.freeze(r),enumerable:!1,configurable:!0,writable:!1}),t}u(gc,"toPublishReceipt");async function by(i){if(!(i.publisher||!i.provision))try{await i.provision()}catch(o){throw Ey(o)}}u(by,"provisionOnFirstUse");async function Ob(i,o){if(i.kernelDoorPublisherFor)try{return await i.kernelDoorPublisherFor(o)}catch(e){throw Ey(e)}}u(Ob,"kernelDoorPublisherOnFirstUse");function Ey(i){let o=Xr(i);if(o!==void 0)return o;if(i instanceof xe||i instanceof O)return i;let e=new V(`NPP transport could not be set up: ${i instanceof Error?i.message:String(i)}`);return Object.defineProperty(e,"cause",{value:i,configurable:!0,writable:!0}),e}u(Ey,"provisioningFailure");var jb=/\/v1\/channels\/([^/?]+)\/messages(?:\?|$)/,Wb=/\/v1\/channels\/([^/?]+)\/subscribe(?:\?|$)/,$b=new Set(["GET","POST","PUT","PATCH","DELETE"]);function fy(i){try{return JSON.parse(i)}catch{return}}u(fy,"safeJson");function Ae(i){return{status:i,statusText:"",headers:new Headers,url:"",redirected:!1,type:"default"}}u(Ae,"emptyRawResponse");function vy(i){if(!i)return;let o={};for(let[e,t]of Object.entries(i))t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean"?o[e]=t:o[e]=JSON.stringify(t));return Object.keys(o).length>0?o:void 0}u(vy,"flattenQuery");function Kb(i){let o=i;if(typeof i=="string")try{o=JSON.parse(i)}catch{return}if(o===null||typeof o!="object"||Array.isArray(o))return;let e=o.idempotencyKey;return typeof e=="string"&&e!==""?e:void 0}u(Kb,"callerIdempotencyKey");function Vb(i){for(let[o,e]of Object.entries(Pc(i)??{}))if(o.toLowerCase()==="idempotency-key"&&e!=="")return e}u(Vb,"callerIdempotencyHeader");function Pc(i){if(!i)return;let o={};for(let[e,t]of Object.entries(i)){if(t==null||e.toLowerCase()==="authorization")continue;let r=typeof t=="function"?t():t;r!=null&&(o[e]=r)}return Object.keys(o).length>0?o:void 0}u(Pc,"resolveHeaders");function Ny(i,o){return!o||i&&Object.keys(i).some(t=>t.toLowerCase()==="content-type")?i:{...i??{},"Content-Type":o}}u(Ny,"withContentType");function Sy(i,o){return u(async function(t){let r=t.method.toUpperCase();if(!$b.has(r))return{ok:!1,rawResponse:Ae(0),error:{reason:"unknown",errorMessage:`Unsupported method ${t.method}`}};let s=r==="POST"?jb.exec(t.url):null;if(s&&o&&o.transport==="npp"){let N=(typeof t.body=="string"?fy(t.body):t.body)??{},E=new Set(["payload","qosLevel","channelId"]);if(Vb(t.headers)===void 0&&"payload"in N&&Object.keys(N).every(A=>E.has(A)||N[A]===void 0)){let A=decodeURIComponent(s[1]),I=await Ob(o,A);if(!I){if(await by(o),!o.publisher)throw new V(o.refusal?`NPP transport selected but not provisioned: ${o.refusal}`:'NPP transport selected but not provisioned. Pass an edgeUrl (or set NPAYLOAD_EDGE_URL), use NPayload.connect(), or pass transport: "http".');I=o.publisher}let B=N.payload,G=await I.publish(A,B,{...N.qosLevel!==void 0?{qosLevel:N.qosLevel}:{},...typeof N.routingKey=="string"?{routingKey:N.routingKey}:{}}).catch(z=>{throw Xr(z)??z});if(!G.accepted){if(G.statusCode===vr.REJECTED_OTHER&&G.error!==void 0&&yi(G.error.reason))throw new $r({message:`PLAN_REQUIRED: this app publishes only on a plan, so the message was not published; choose a plan at ${xo}`,code:"PLAN_REQUIRED",product:mi,upgradeUrl:xo,npp:{statusCode:G.statusCode,statusName:G.statusName,httpStatus:G.httpStatus,reason:G.error.reason,errorCode:G.error.code,errorName:G.error.name},rawResponse:Ae(402)});return{ok:!1,rawResponse:Ae(G.httpStatus),error:{reason:"status-code",statusCode:G.httpStatus,body:{code:"NPP_PUBLISH_REJECTED",message:dy(G),bulkAckStatus:G.statusCode,bulkAckStatusName:G.statusName,...G.error?{error:G.error}:{},...G.upstream?{upstream:G.upstream}:{}}}}}return{ok:!0,body:gc({gid:G.gid,status:"accepted",statusCode:G.statusCode,statusName:G.statusName,sequence:G.sequence,httpStatus:G.httpStatus,transport:"npp"}),rawResponse:Ae(200)}}}let n=r==="POST"?Wb.exec(t.url):null;if(n&&o&&o.transport==="npp"){if(await by(o),!o.publisher)throw new V(o.refusal?`NPP transport selected but not provisioned: ${o.refusal}`:'NPP transport selected but not provisioned (pass edgeUrl / NPAYLOAD_EDGE_URL, use NPayload.connect(), or transport: "http").');let c=decodeURIComponent(n[1]),E=(typeof t.body=="string"?fy(t.body):t.body)??{},S=E.consumerId??E.consumer_id??`consumer-${c}`;return{ok:!0,body:await o.publisher.subscribe(c,{consumerId:S,...E.mode!==void 0?{mode:E.mode}:{},...E.deliveryPreference!==void 0?{deliveryPreference:E.deliveryPreference}:{}}).catch(I=>{throw Xr(I)??I}),rawResponse:Ae(200)}}let p=Kb(t.body);try{let c=await i.send({method:r,...p!==void 0?{idempotencyKey:p}:{},path:t.url,...vy(t.queryParameters)?{query:vy(t.queryParameters)}:{},...Ny(Pc(t.headers),t.contentType)?{headers:Ny(Pc(t.headers),t.contentType)}:{},...t.body!==void 0?{body:t.body}:{},...t.timeoutMs!==void 0?{timeoutMs:t.timeoutMs}:{},...t.maxRetries!==void 0?{maxAttempts:t.maxRetries+1}:{},...t.abortSignal!==void 0?{signal:t.abortSignal}:{}}),N=Py(r,t.url,c);return{ok:!0,body:s?gc(N):N,rawResponse:Ae(200)}}catch(c){if(c instanceof ar)throw bc(c);if(c instanceof Ge)throw _y(c);if(c instanceof me)throw ky(c);if(c instanceof O){if(c.status!=null)return{ok:!1,rawResponse:Ae(c.status),error:{reason:"status-code",statusCode:c.status,body:{code:c.code,message:c.message}}};throw c}throw c}},"kernelFetcher")}u(Sy,"createKernelFetcher");function _y(i){let o=i.status??403;return new Kr({message:i.message,code:i.code,statusCode:o,...i.requestId!==void 0?{requestId:i.requestId}:{},rawResponse:Ae(o)})}u(_y,"toPublicSourceRefusal");function ky(i){let o=i.status??403;return new Vr({message:i.message,code:i.code,statusCode:o,...i.requestId!==void 0?{requestId:i.requestId}:{},...i.fingerprint!==void 0?{fingerprint:i.fingerprint}:{},rawResponse:Ae(o)})}u(ky,"toPublicFingerprintRefusal");function Xr(i){if(i instanceof Ge)return _y(i);if(i instanceof me)return ky(i);if(i instanceof xe){let o=i.upstreamCode,e=i.status??403,t=i.details.upstreamMessage;if(o!==void 0&&Zr(o)){let r=o.toLowerCase()==="source_network_not_declared";return new Kr({message:t??(r?Ds:Fs),code:o,statusCode:e,rawResponse:Ae(e)})}if(o!==void 0&&eo(o))return new Vr({message:t??zs,code:o,statusCode:e,rawResponse:Ae(e)})}}u(Xr,"toPublicCallerRefusal");function bc(i){return new $r({message:i.message,code:i.code,...i.product!==void 0?{product:i.product}:{},...i.upgradeUrl!==void 0?{upgradeUrl:i.upgradeUrl}:{},...i.requestId!==void 0?{requestId:i.requestId}:{},rawResponse:Ae(402)})}u(bc,"toPublicPlanRefusal");var _i=new TextEncoder;function bs(i){let o="";for(let t=0;t<i.length;t+=1)o+=String.fromCharCode(i[t]);return(typeof Buffer<"u"?Buffer.from(i).toString("base64"):btoa(o)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}u(bs,"b64url");async function Jb(i){return bs(new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",_i.encode(i))))}u(Jb,"sha256B64url");async function Ty(i,o){let t={typ:"dpop+jwt",alg:"EdDSA",jwk:{kty:"OKP",crv:"Ed25519",x:i.publicKeyJwk.x}},r={jti:bs(globalThis.crypto.getRandomValues(new Uint8Array(16))),htm:o.htm,htu:o.htu,iat:Math.floor((o.nowMs??Date.now())/1e3)};o.accessToken!==void 0&&(r.ath=await Jb(o.accessToken));let s=`${bs(_i.encode(JSON.stringify(t)))}.${bs(_i.encode(JSON.stringify(r)))}`,n=new Uint8Array(await globalThis.crypto.subtle.sign({name:"Ed25519"},i.privateKey,_i.encode(s)));return`${s}.${bs(n)}`}u(Ty,"eddsaDpopProof");var Qb=3e4,ki=class{static{u(this,"KernelFrameDoorCredential")}opts;fetchImpl;minted;inflight;constructor(o){this.opts=o,this.fetchImpl=o.fetchImpl??globalThis.fetch.bind(globalThis)}async accessToken(){let o=this.opts.refreshMarginMs??Qb;return this.minted&&this.minted.expiresAt-Date.now()>o?this.minted.token:(this.inflight??=this.mint().finally(()=>{this.inflight=void 0}),this.minted=await this.inflight,this.minted.token)}proof(o,e){return Ty(this.opts.key,{htm:"POST",htu:o,accessToken:e})}async unit(){return Jm(await this.accessToken())}async mint(){let{tokenUrl:o,clientId:e}=this.opts,t=await Ty(this.opts.key,{htm:"POST",htu:o}),r=new URLSearchParams({grant_type:"client_credentials",client_id:e,scope:""});this.opts.appId&&r.set("app_id",this.opts.appId),this.opts.env&&r.set("env_id",this.opts.env),this.opts.clientSecret&&r.set("client_secret",this.opts.clientSecret);let n=await Mo(this.opts.refusal??(()=>{}),N=>new V(N.charAt(0).toUpperCase()+N.slice(1)),this.fetchImpl)(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",DPoP:t},body:r.toString()}),p=await n.json().catch(()=>({}));if(!n.ok){let N=typeof p.error=="string"&&p.error!==""?p.error:"oauth_failed",E=typeof p.error_description=="string"&&p.error_description!==""?p.error_description:N;throw new fe(`the token endpoint ${o} refused the kernel frame door's token (HTTP ${n.status}, ${N}): ${E}; no frame was posted.`,{code:N,status:n.status})}if(typeof p.access_token!="string"||p.access_token==="")throw new fe(`the token endpoint ${o} answered no access_token for the kernel frame door; no frame was posted.`,{code:"oauth_missing_token",status:n.status});if(typeof p.token_type=="string"&&p.token_type.toLowerCase()!=="dpop")throw new fe(`the token endpoint ${o} answered a ${p.token_type} token where the kernel frame door needs a DPoP-bound one; no frame was posted.`,{code:"non_dpop_token",status:n.status});let c=typeof p.expires_in=="number"&&p.expires_in>0?p.expires_in:600;return{token:p.access_token,expiresAt:Date.now()+c*1e3}}};var Ar=class i{constructor(o,e){this.estate=o;this.cureFor=e}static{u(this,"DialGuard")}get production(){return this.estate.other===void 0}refusal(o){let e=Ei(this.estate,o);return e===void 0?void 0:`${e}. ${this.cureFor(sr(o))}`}noEdge(){let o=Zm(this.estate);return o===void 0?void 0:`${o}. ${this.cureFor("edge")}`}checkPages(...o){for(let e of o){let t=Xm(this.estate,e);if(t!==void 0)throw new V(fc(`${t}. ${this.cureFor(sr(e))}`))}}check(...o){for(let e of o){let t=this.refusal(e);if(t!==void 0)throw new V(fc(t))}}with(o){return new i(Ke([...this.estate.named.map(e=>[e.source,e.url]),...o]),this.cureFor)}};function Ti(i,o){return Mo(e=>i.refusal(e),e=>new V(fc(e)),o)}u(Ti,"guardedFetch");var Cy=Symbol("npayload.dial.refusal");function Yb(i){let o=new Error(i.message);return o.name="AbortError",o[Cy]=i,o}u(Yb,"carried");function Xb(i){return i instanceof Error?i[Cy]:void 0}u(Xb,"refusalCarriedBy");function fc(i){return i.charAt(0).toUpperCase()+i.slice(1)}u(fc,"capitalised");var vc=new WeakMap;function fs(i){return vc.get(i)?.guard}u(fs,"guardOf");function xy(i){return vc.get(i)?.tokenUrl}u(xy,"tokenUrlOf");function Nc(i){return`${(i.authUrl??i.baseUrl??Cr).replace(/\/+$/,"")}/oauth/token`}u(Nc,"tokenEndpointOf");function Zb(i,o){let e=o.path;for(let[t,r]of Object.entries(o.pathParams??{}))e=e.replace(`{${t}}`,encodeURIComponent(r));return i.replace(/\/+$/,"")+e}u(Zb,"requestUrl");function Ci(i,o){let e=Ti(o),t,r={fetch:u(async N=>{try{return await e(N.url,{method:N.method,headers:N.headers,body:N.body??null,...N.signal!==void 0?{signal:N.signal}:{},...t!==void 0?{dispatcher:t}:{}})}catch(E){throw E instanceof V?Yb(E):ef(E)}},"fetch")},s=new pt({config:{...i,httpClient:r}});t=s.dispatcher;let n=Nc(i),p=i.baseUrl??Cr;vc.set(s,{guard:o,tokenUrl:n,apiUrl:p});let c=s.auth;if(c!==void 0&&typeof c.getAccessToken=="function"){let N=c;typeof N.fetchImpl=="function"&&(N.fetchImpl=Ti(o,N.fetchImpl));let E=c.getAccessToken.bind(c);c.getAccessToken=async S=>(o.check(n),E(S))}if(typeof s.send=="function"){let N=s.send.bind(s);s.send=(async E=>{o.check(n,Zb(p,E));try{return await N(E)}catch(S){throw Xb(S)??S}})}return s}u(Ci,"dialKernel");function ef(i){if(!(i instanceof TypeError))return i;let o=i.cause,e=o instanceof Error?o.message:typeof o=="string"?o:void 0;return e===void 0||e===""||i.message.includes(e)?i:new TypeError(`${i.message}: ${e}`,{cause:o})}u(ef,"withDialReason");function vs(i){if(i instanceof V)throw i}u(vs,"rethrowRefusal");function Ns(i,o){wy(i,e=>o.refusal(e))}u(Ns,"guardTransport");function Iy(i,o){let e=i?.trim();return e!==void 0&&/^app_[a-z0-9]+$/i.test(e)?e:$(o["npayload/appId"])??$(o.appId)??$(o.app)??$(o.app_id)}u(Iy,"resolveProducerAppId");var rf="npayload/npp/app-signing-key/v1",Ec=[48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32];async function of(i){let o=globalThis.crypto.subtle,e=new TextEncoder,t=await o.importKey("raw",e.encode(i.clientSecret),"HKDF",!1,["deriveBits"]),r=new Uint8Array(await o.deriveBits({name:"HKDF",hash:"SHA-256",salt:e.encode(rf),info:e.encode(i.clientId)},t,256)),s=new Uint8Array(Ec.length+r.byteLength);s.set(Ec,0),s.set(r,Ec.length),r.fill(0);try{let n=await o.importKey("pkcs8",s,{name:"Ed25519"},!0,["sign"]),p=await o.exportKey("jwk",n);return{privateKey:await o.importKey("jwk",p,{name:"Ed25519"},!1,["sign"]),publicKeyJwk:{kty:p.kty,crv:p.crv,x:p.x}}}finally{s.fill(0)}}u(of,"deriveAppNppSigningKey");async function sf(){let i=globalThis.crypto.subtle,o=await i.generateKey({name:"Ed25519"},!0,["sign","verify"]);return{privateKey:o.privateKey,publicKeyJwk:await i.exportKey("jwk",o.publicKey)}}u(sf,"generateNppSigningKey");function Gy(i){let{clientId:o,clientSecret:e}=i.config;return o&&e?of({clientId:o,clientSecret:e}):sf()}u(Gy,"appNppSigningKeyFor");async function My(i,o){let{privateKey:e,publicKeyJwk:t}=await Gy(i),r=(await i.auth.getAccessToken([])).token,s=$e(r),n=Iy(o.appId,s),p=wc(s);if(!n||!p)throw new Error(`Could not resolve appId/orgId from the access token for NPP provisioning. Claims present: ${Object.keys(s).join(", ")}`);let c=await Uy(i,o,t),N=globalThis.crypto.getRandomValues(new Uint32Array(1))[0],E=new Qr({edgeUrl:o.edgeUrl,accessToken:r,appId:n,clientId:o.clientId,jwkThumbprint:c,ed25519PrivateKey:e,...o.sequenceStore?{sequenceStore:o.sequenceStore}:{}},N),S=fs(i);return S!==void 0&&Ns(E,S),E}u(My,"provisionNppPublisher");async function Uy(i,o,e){let t;try{t=(await i.send({method:"POST",path:o.kernelHasNoBaseUrl?`${o.baseUrl.replace(/\/+$/,"")}/v1/apps/dpop-keys`:"/v1/apps/dpop-keys",body:{publicKeyJwk:e,algorithm:"EdDSA"}})).jwkThumbprint}catch(r){vs(r);let s=r instanceof Error?r.message:String(r);if(/already.?registered|already.?exists|ALREADY_EXISTS/i.test(s))t=await af(e);else throw r}return t}u(Uy,"registerAppNppKey");async function Hy(i,o){let e=await Gy(i),t=i.config,r=fs(i),s=new ki({tokenUrl:Nc(t),clientId:t.clientId,...t.clientSecret!==void 0?{clientSecret:t.clientSecret}:{},...t.appId!==void 0?{appId:t.appId}:{},...t.env!==void 0?{env:t.env}:{},key:e,...r!==void 0?{refusal:u(A=>r.refusal(A),"refusal")}:{}}),n=await s.accessToken(),p=Iy(o.appId,$e(n));if(!p)throw new Error(`Could not resolve appId from the kernel frame door's access token. Claims present: ${Object.keys($e(n)).join(", ")}`);let c=await Uy(i,o,e.publicKeyJwk),N=typeof o.producerEpoch=="function"?await o.producerEpoch(c):o.producerEpoch,E=globalThis.crypto.getRandomValues(new Uint32Array(1))[0],S=new Qr({edgeUrl:o.frameDoorUrl,accessToken:u(()=>s.accessToken(),"accessToken"),appId:p,clientId:o.clientId,jwkThumbprint:c,ed25519PrivateKey:e.privateKey,sequenceStore:o.sequenceStore??new ws,...o.fetchImpl?{fetchImpl:o.fetchImpl}:{},kernel:{readChannel:o.readChannel,producerEpoch:N,credential:s}},E);return r!==void 0&&Ns(S,r),S}u(Hy,"provisionKernelDoorPublisher");var tf=Date.UTC(2025,0,1),nf=2147483647,Ay=new Map;function By(i,o=Date.now()){let e=Math.floor((o-tf)/1e3),t=Ay.get(i),r=Math.min(nf,Math.max(0,e,t===void 0?0:t+1));return Ay.set(i,r),r}u(By,"drawClientProducerEpoch");async function af(i){return Ms(i)}u(af,"rfc7638Thumbprint");function qy(i){let o=Go(i.edge),e=o!==void 0,t=o??(i.npp&&i.guard.production?Ni:void 0);if(t===void 0&&!i.npp)return{named:!1};for(let s of i.provisioning??[]){let n=i.guard.refusal(s);if(n!==void 0)return{named:e,refusal:n}}if(t===void 0){let s=i.guard.noEdge();return s===void 0?{named:!1}:{named:!1,refusal:s}}let r=i.guard.refusal(t);return r===void 0?{edgeUrl:t,named:e}:{named:e,refusal:r}}u(qy,"resolveEdge");var df="Pass the door and the node keys of that estate (the door option, or KERNEL_DOOR_URL, and nodeKeys), or name nothing outside npayload's production hosts to use its production estate.";function pf(i){let o=i.env??(typeof process<"u"?process.env:{});return new Ar(Ke([["the door option",i.door],["the nodeKeys URL",typeof i.nodeKeys=="string"?i.nodeKeys:void 0],...xr(o)]),()=>df)}u(pf,"loneDoorGuard");function cf(i,o,e){let t=Tr({door:i.door,...i.env!==void 0?{env:i.env}:{}});t.kind==="kernel"&&t.url!==void 0&&o.check(t.url),typeof i.nodeKeys=="string"&&o.check(i.nodeKeys);let r=u(N=>{try{return N()}catch(E){throw E instanceof V&&e.push(E),E}},"kept"),s=Ti(o,i.fetch),n={...i,fetch:u((async(N,E)=>{try{return await s(N,E)}catch(S){throw S instanceof V&&e.push(S),S}}),"fetch")},p=i.webSocket,c=globalThis.WebSocket;return(p!==void 0||typeof c=="function")&&(n.webSocket=N=>r(()=>(o.check(N),p!==void 0?p(N):new c(N)))),n}u(cf,"holdOptions");async function Fy(i,o,e){let t=[],r=cf(o,e,t);try{return await i(r)}catch(s){throw t[0]??s}}u(Fy,"connectHeld");var Ly=Symbol.for("npayload.kernelDoor.held"),Es=Io;if(Es[Ly]!==!0){let i=Es.connect.bind(Io);Es.connect=o=>Fy(i,o,pf(o)),Es[Ly]=!0}function Dy(i,o){return Fy(Es.connect,i,o)}u(Dy,"connectUnderGuard");var uf="The transport dials the API its baseUrl option names alone: pass that estate's API as baseUrl (its auth host as authUrl), or name nothing outside npayload's production hosts to use its production API.",zy=Symbol.for("npayload.transport.http"),Oy=Symbol.for("npayload.transport.http.config");function Sc(i){return typeof i=="object"&&i!==null&&i[zy]===!0}u(Sc,"isHttpTransport");function _c(i){return i[Oy]}u(_c,"httpTransportConfig");var xi=class{static{u(this,"HttpTransport")}kind="http";baseUrl;config;kernelPromise;constructor(o){if(!o||typeof o.clientId!="string"||o.clientId.length===0)throw new Error("HttpTransport requires clientId");this.config=o,Object.defineProperty(this,zy,{value:!0}),Object.defineProperty(this,Oy,{value:o}),this.baseUrl=(o.baseUrl??Cr).replace(/\/+$/,"")}async kernel(){return this.kernelPromise||(this.kernelPromise=(async()=>{let o=this.config.dpopPrivateJwk??(await Gs()).privateJwk,e=typeof process<"u"?process.env:{},t=new Ar(Ke([["baseUrl",this.config.baseUrl],["authUrl",this.config.authUrl],...xr(e)]),()=>uf);return Ci({clientId:this.config.clientId,dpopPrivateJwk:o,baseUrl:this.baseUrl,authUrl:this.config.authUrl??this.baseUrl,...this.config.appId!==void 0?{appId:this.config.appId}:{},...this.config.hmacSecret!==void 0?{clientSecret:this.config.hmacSecret}:{},...this.config.environment!==void 0?{environment:this.config.environment}:{}},t)})()),this.kernelPromise}async send(o){return(await this.kernel()).send(o)}};var kc="NPAYLOAD_DPOP_PRIVATE_JWK";function lf(i){if(i===null||typeof i!="object")return!1;let o=i;return o.kty==="EC"&&o.crv==="P-256"&&["d","x","y"].every(e=>typeof o[e]=="string"&&o[e].length>0)}u(lf,"isSigningDpopJwk");function jy(i){let o=i[kc]?.trim();if(!o)return;let e;try{e=JSON.parse(o)}catch{throw new TypeError(`${kc} is set but is not a JSON Web Key. Set it to the key \`npx @npayload/sdk init\` wrote, or unset it.`)}if(!lf(e))throw new TypeError(`${kc} is set but is not an ES256 (P-256) private key. Set it to the key \`npx @npayload/sdk init\` wrote, or unset it.`);return e}u(jy,"persistedDpopKey");var Ir={create(i,o){return{url:`${i}/v1/sources`,method:"POST",contentType:"application/json",body:{channel:o.channel,wsUrl:o.wsUrl,...o.subscribe!==void 0?{subscribe:o.subscribe}:{},...o.map!==void 0?{map:o.map}:{},...o.key!==void 0?{key:o.key}:{},...o.name!==void 0?{name:o.name}:{}}}},list(i){return{url:`${i}/v1/sources`,method:"GET"}},get(i,o){return{url:`${i}/v1/sources/${encodeURIComponent(o)}`,method:"GET"}},pause(i,o){return{url:`${i}/v1/sources/${encodeURIComponent(o)}/pause`,method:"POST"}},resume(i,o){return{url:`${i}/v1/sources/${encodeURIComponent(o)}/resume`,method:"POST"}},remove(i,o){return{url:`${i}/v1/sources/${encodeURIComponent(o)}`,method:"DELETE"}}},Uo=class{static{u(this,"SourcesResource")}fetcher;baseUrl;constructor(o,e){this.fetcher=o,this.baseUrl=e}async create(o){let e=Ir.create(this.baseUrl,o);return(await this.fetcher(e)).body}async list(){return(await this.fetcher(Ir.list(this.baseUrl))).body}async get(o){return(await this.fetcher(Ir.get(this.baseUrl,o))).body}async pause(o){return(await this.fetcher(Ir.pause(this.baseUrl,o))).body}async resume(o){return(await this.fetcher(Ir.resume(this.baseUrl,o))).body}async remove(o){return(await this.fetcher(Ir.remove(this.baseUrl,o))).body}};var Ai=class extends Error{static{u(this,"IncomingWebhookRefusal")}code;constructor(o,e){super(e),this.name="IncomingWebhookRefusal",this.code=o}};function Wy(i){if(i.startsWith("whk_"))return"channel";if(i.startsWith("trg_"))return"agent";throw new Ai("NOT_AN_INCOMING_WEBHOOK",`"${i}" names no incoming webhook: a channel's webhook id starts with whk_, an agent's webhook trigger id with trg_`)}u(Wy,"ownerOf");var ee=u(i=>typeof i=="string"?i:"","str"),Tc=u(i=>{if(Array.isArray(i))return i;let o=i;return Array.isArray(o?.items)?o.items:Array.isArray(o?.data)?o.data:[]},"rowsOf"),$y=u(i=>typeof i=="number"&&Number.isFinite(i)?new Date(i).toISOString():null,"iso");async function Ky(i){let[o,e]=await Promise.all([i.listChannelWebhooks(),i.listAgentWebhookTriggers()]),t=Tc(o),r=Tc(e).filter(N=>N.type==="webhook"),s=[...new Set(t.map(N=>ee(N.channelGid)).filter(Boolean))],n=new Map;await Promise.all(s.map(async N=>{try{let E=await i.channel(N);n.set(N,ee(E?.name)||null)}catch(E){vs(E),n.set(N,null)}}));let p=new Map;if(r.length>0)try{for(let N of Tc(await i.listAgents()))p.set(ee(N.gid),ee(N.name))}catch(N){vs(N)}return[...t.map(N=>({id:ee(N.gid),name:ee(N.name),deliversTo:{kind:"channel",id:ee(N.channelGid),name:n.get(ee(N.channelGid))??null},signingSecret:N.hasSigningSecret===!0?"set":"not set",lastDelivery:null,status:ee(N.status)})),...r.map(N=>{let E=N.config??{};return{id:ee(N.gid),name:ee(N.name),deliversTo:{kind:"agent",id:ee(N.agentGid),name:p.get(ee(N.agentGid))||null},signingSecret:ee(E.webhookSecret)!==""?"set":"not set",lastDelivery:$y(N.lastTriggeredAt),status:N.enabled===!1?"paused":"active"}})].sort((N,E)=>N.name.localeCompare(E.name)||N.id.localeCompare(E.id))}u(Ky,"listIncomingWebhooks");async function Vy(i,o){if("channel"in o){let t=await i.createChannelWebhook({channelGid:o.channel,name:o.name,...o.description!==void 0?{description:o.description}:{}});return{id:ee(t.gid),name:ee(t.name)||o.name,deliversTo:{kind:"channel",id:o.channel},signingSecret:ee(t.signingSecret)}}let e=await i.createAgentWebhookTrigger({agentGid:o.agent,name:o.name,...o.description!==void 0?{description:o.description}:{},type:"webhook",config:{},action:{goal:o.goal}});return{id:ee(e.gid),name:o.name,deliversTo:{kind:"agent",id:o.agent},signingSecret:ee(e.webhookSecret)}}u(Vy,"addIncomingWebhook");async function Jy(i,o){if(Wy(o)==="agent")throw new Ai("ROTATION_NOT_AVAILABLE",`the signing secret of an agent's webhook trigger (${o}) cannot be rotated yet: revoke it and add a new one`);let e=await i.rotateChannelWebhookSecret(o),t=$y(e.previousExpiresAt);return{id:o,signingSecret:ee(e.signingSecret),...t?{previousSecretValidUntil:t}:{}}}u(Jy,"rotateIncomingWebhookSecret");async function Qy(i,o){return Wy(o)==="channel"?await i.revokeChannelWebhook(o):await i.removeAgentTrigger(o),{id:o,revoked:!0}}u(Qy,"revokeIncomingWebhook");var Yy={debug:u((i,o)=>o?console.debug(`[npayload] ${i}`,o):console.debug(`[npayload] ${i}`),"debug"),info:u((i,o)=>o?console.info(`[npayload] ${i}`,o):console.info(`[npayload] ${i}`),"info"),warn:u((i,o)=>o?console.warn(`[npayload] ${i}`,o):console.warn(`[npayload] ${i}`),"warn"),error:u((i,o)=>o?console.error(`[npayload] ${i}`,o):console.error(`[npayload] ${i}`),"error")},Xy={debug:u(()=>{},"debug"),info:u(()=>{},"info"),warn:u(()=>{},"warn"),error:u(()=>{},"error")},wf=["token","secret","hmacsecret","privatekey","password","authorization","cookie"];function Ss(i,o=0){if(o>5)return i;let e={};for(let[t,r]of Object.entries(i))wf.some(s=>t.toLowerCase().includes(s))?e[t]="[REDACTED]":r&&typeof r=="object"&&!Array.isArray(r)?e[t]=Ss(r,o+1):e[t]=r;return e}u(Ss,"redactSensitive");var Zy="5.0.5";var _s=Zy,Cc="npayload",eR=`${Cc}/${_s}`;var rR=new WeakMap,mf=["list","add","rotateSecret","revoke"],oR={grants:"connectAccess",bridges:"connectBridges",explore:"connectExplore",profile:"connectProfile",partner:"connectPartner",approvals:"connectTenantApproval"},xc={request:["connect","requestAccess"],approve:["connect","approveAccess"],reject:["connect","rejectAccess"],revoke:["connect","revokeGrant"],list:["connectAccess","listMyGrants"],retrieve:["connectAccess","getGrant"]},yf=new Set(["constructor","toJSON","toString"]);function Ac(i,o,e,t){if(t>3)return;let r=Object.getPrototypeOf(i);if(!(!r||r===Object.prototype))for(let s of Object.getOwnPropertyNames(r)){if(yf.has(s)||s.startsWith("_"))continue;let n=Object.getOwnPropertyDescriptor(r,s);if(n)if(typeof n.get=="function"){let p;try{p=i[s]}catch{continue}p!==null&&typeof p=="object"&&Ac(p,`${o}${s}.`,e,t+1)}else typeof n.value=="function"&&t>0&&e.add(`${o}${s}`)}}u(Ac,"collectMethods");var Rf=new Set(["d","p","q","dp","dq","qi","oth","k"]);function gf(i){let o=i.publicJwk,e=o!==null&&typeof o=="object"?{...o}:{...i},t={};for(let[r,s]of Object.entries(e))t[r]=Rf.has(r)?"[REDACTED]":s;return t.d="[REDACTED]",t}u(gf,"redactPrivateJwk");var Ii=class i{static{u(this,"NPayload")}generated;kernel;nppHolder;clientId;configSnapshot;appId;baseUrl;primusApiUrl;kernelFetcher;aiFacade;sourcesResource;nppProvisionPromise;channelAnswers=new Map;firstKernelAnswers=new Map;kernelDoorPublisherPromise;constructor(o){this.configSnapshot=o;let e=typeof process<"u"?process.env:{},t=bf(o.transport,e),r=_f(t),s=r.publisher!==void 0?Rc(r.publisher):void 0,n=r.http!==void 0?_c(r.http):void 0,p=n??o;this.clientId=p.clientId,this.appId=p.appId,this.baseUrl=r.http!==void 0?r.http.baseUrl:o.baseUrl??Cr;let c=r.http!==void 0?n?.authUrl??this.baseUrl:o.authUrl??this.baseUrl;tR.set(this,c),this.primusApiUrl=o.primusApiUrl??(typeof process<"u"?process.env?.NPAYLOAD_PRIMUS_API_URL:void 0);let N=sr(this.baseUrl)!==void 0||sr(Go(c)??this.baseUrl)!==void 0,E=r.http!==void 0?ff:Ef,S=new Ar(Ke([["baseUrl",o.baseUrl],["authUrl",o.authUrl],["edgeUrl",o.edgeUrl],["primusApiUrl",o.primusApiUrl],["door",o.door],["the transport's edgeUrl",s],["the transport's baseUrl",n?.baseUrl],["the transport's authUrl",n?.authUrl],...xr(e)]),D=>D!=="edge"?E:`${N?`${E} `:""}${s!==void 0?Nf:vf}`),A=n?.dpopPrivateJwk??o.dpopPrivateJwk,I=p.hmacSecret,B=p.environment;this.kernel=Ci({clientId:this.clientId,dpopPrivateJwk:A,baseUrl:"",authUrl:c,...this.appId!==void 0?{appId:this.appId}:{},...I!==void 0?{clientSecret:I}:{},...B!==void 0?{environment:B}:{}},S);let G=r.kind==="npp"&&typeof t=="string",z=qy({edge:s??o.edgeUrl??e.NPAYLOAD_EDGE_URL,npp:G,guard:S,...G?{provisioning:[xy(this.kernel),Sf(this.baseUrl)]}:{}});if(this.nppHolder={transport:r.kind,...z.edgeUrl!==void 0?{edgeUrl:z.edgeUrl,edgeNamed:z.named}:{},...z.refusal!==void 0?{refusal:z.refusal}:{},...r.publisher&&z.refusal===void 0?{publisher:r.publisher}:{}},this.nppHolder.publisher&&Ns(r.publisher,S),this.nppHolder.transport==="npp"&&this.nppHolder.edgeUrl&&!this.nppHolder.publisher){let D=this.nppHolder.edgeUrl;this.nppHolder.provision=()=>(this.nppProvisionPromise||(this.nppProvisionPromise=this.provisionNpp(D).catch(j=>{throw this.nppProvisionPromise=void 0,j})),this.nppProvisionPromise),this.nppHolder.kernelDoorPublisherFor=j=>this.kernelDoorPublisherFor(D,j)}let F=Sy(this.kernel,this.nppHolder);this.kernelFetcher=F,this.generated=new vo({baseUrl:this.baseUrl,token:u(()=>"dpop-kernel-owned","token"),fetcher:F});let Q=u(async D=>{let j=await F(D);if(!j.ok)throw Object.assign(new Error("np.sources request failed"),{error:j.error,status:j.rawResponse?.status});return{ok:!0,body:j.body,rawResponse:{status:j.rawResponse?.status??200}}},"sourceFetcher");this.sourcesResource=new Uo(Q,this.baseUrl)}channelGidCache=new Map;eventsFacade;async resolveChannelGid(o){if(/^chn?_/.test(o)||/^ch_/.test(o))return o;let e=this.channelGidCache.get(o);if(e)return e;let t=await this.generated.events.channels.getBySlug({slug:o});return this.channelGidCache.set(o,t.gid),t.gid}get events(){if(this.eventsFacade)return this.eventsFacade;let o=this.generated.events,e=u((t,r,s)=>this.resolveChannelGid(t).then(n=>o.messages.publish({...s,channelGid:n,payload:r})),"publish");return this.eventsFacade=new Proxy(o,{get:u((t,r,s)=>r==="publish"?e:r==="webhooks"?this.eventsWebhooks():Reflect.get(t,r,s),"get")}),this.eventsFacade}eventsWebhooksSurface;eventsWebhooks(){if(this.eventsWebhooksSurface)return this.eventsWebhooksSurface;let o=this.generated.webhooks.webhooks;return this.eventsWebhooksSurface=Object.freeze({register:o.create.bind(o),list:o.list.bind(o),retrieve:o.get.bind(o),update:o.update.bind(o),delete:o.revoke.bind(o),rotateSecret:o.rotateSecret.bind(o),revealSecret:o.revealSecret.bind(o)}),this.eventsWebhooksSurface}methodCatalog;listMethods(){if(this.methodCatalog)return this.methodCatalog;let o=new Set;Ac(this.generated,"",o,0),Ac(this.sourcesResource,"sources.",o,0),o.add("events.publish");for(let t of Object.keys(this.eventsWebhooks()))o.add(`events.webhooks.${t}`);for(let t of mf)o.add(`webhooks.${t}`);for(let[t,r]of Object.entries(oR)){let s=`connect.${r}.`;for(let n of[...o])n.startsWith(s)&&o.add(`connect.${t}.${n.slice(s.length)}`)}for(let t of Object.keys(xc))o.add(`connect.grants.${t}`);let e=Object.freeze([...o].sort());for(let t of e)this.kernel.registerMethod(t);return this.methodCatalog=e,e}async health(){let o=Date.now(),e=new Date(o).toISOString();try{return await this.kernel.send({method:"GET",path:`${this.baseUrl}/health`,maxAttempts:1,timeoutMs:5e3}),{ok:!0,baseUrl:this.baseUrl,latencyMs:Date.now()-o,checkedAt:e}}catch(t){let r=t.status,s=t?.code;return{ok:!1,baseUrl:this.baseUrl,latencyMs:Date.now()-o,checkedAt:e,...typeof r=="number"?{status:r}:{},error:t instanceof Error?`${t.name}: ${t.message}`:String(t),...typeof s=="string"&&s!==""?{code:s}:{},...t instanceof Error?{type:t.name}:{}}}}version(){return{sdkVersion:_s,specVersion:Yr.specVersions.cell??"",specVersions:{...Yr.specVersions},supportedApiVersions:[...Yr.apiVersions]}}get door(){return Tr({door:this.configSnapshot.door,edgeUrl:this.nppHolder.edgeUrl})}async connectKernelDoor(o){let e=this.door,t={...o,door:e.kind==="kernel"?e.url:void 0,env:{}},r=fs(this.kernel),s=typeof o.nodeKeys=="string"?o.nodeKeys:void 0;return Dy(t,r.with([["the nodeKeys URL",s]]))}config(){let{dpopPrivateJwk:o,transport:e,...t}=this.configSnapshot,r={...t};return delete r.edgeUrl,Object.freeze({...Ss(r),baseUrl:this.baseUrl,authUrl:tR.get(this)??this.baseUrl,...this.nppHolder.edgeUrl!==void 0?{edgeUrl:this.nppHolder.edgeUrl}:{},transport:typeof e=="string"?e:this.nppHolder.transport,dpopPrivateJwk:gf(o)})}connectFacade;get connect(){if(this.connectFacade)return this.connectFacade;let o=this.generated.connect,e=oR,t,r=u(n=>typeof n=="string"&&Object.prototype.hasOwnProperty.call(xc,n),"isGrantVerb"),s=u(()=>t??=new Proxy(o.connectAccess,{get:u((n,p,c)=>{if(!r(p))return Reflect.get(n,p,c);let[N,E]=xc[p],S=o[N];return S[E].bind(S)},"get"),has:u((n,p)=>r(p)||Reflect.has(n,p),"has")}),"grantsFacade");return this.connectFacade=new Proxy(o,{get:u((n,p,c)=>p==="grants"||p==="connectAccess"?s():typeof p=="string"&&p in e?Reflect.get(n,e[p],c):Reflect.get(n,p,c),"get")}),this.connectFacade}get pipes(){return this.generated.pipes}get primus(){if(!this.aiFacade)if(this.primusApiUrl&&this.primusApiUrl!==this.baseUrl){let o=new vo({baseUrl:this.primusApiUrl,token:u(()=>"dpop-kernel-owned","token"),fetcher:this.kernelFetcher});this.aiFacade=o.primus}else this.aiFacade=this.generated.primus;return this.aiFacade}get feed(){return this.generated.feed}get analytics(){return this.generated.analytics}get billing(){return this.generated.billing}get notify(){return this.generated.notify}get account(){return this.generated.account}get embed(){return this.generated.embed}get tenants(){return this.generated.tenants}get webhooks(){let o=rR.get(this);if(o)return o;let e=this.generated.webhooks,t={listChannelWebhooks:u(()=>e.webhooks.list({}),"listChannelWebhooks"),listAgentWebhookTriggers:u(()=>this.primus.triggers.list({type:"webhook"}),"listAgentWebhookTriggers"),channel:u(p=>this.generated.events.channels.get({channelGid:p}),"channel"),listAgents:u(()=>this.primus.agents.list(),"listAgents"),createChannelWebhook:u(p=>e.webhooks.create(p),"createChannelWebhook"),createAgentWebhookTrigger:u(p=>this.primus.triggers.create(p),"createAgentWebhookTrigger"),rotateChannelWebhookSecret:u(p=>e.webhooks.rotateSecret({webhookGid:p}),"rotateChannelWebhookSecret"),revokeChannelWebhook:u(p=>e.webhooks.revoke({webhookGid:p}),"revokeChannelWebhook"),removeAgentTrigger:u(p=>this.primus.triggers.remove({triggerGid:p}),"removeAgentTrigger")},r={list:u(()=>Ky(t),"list"),add:u(p=>Vy(t,p),"add"),rotateSecret:u(p=>Jy(t,p),"rotateSecret"),revoke:u(p=>Qy(t,p),"revoke")},s=u(p=>typeof p=="string"&&Object.prototype.hasOwnProperty.call(r,p),"isVerb"),n=new Proxy(e,{get:u((p,c,N)=>s(c)?r[c]:Reflect.get(p,c,N),"get"),has:u((p,c)=>s(c)||Reflect.has(p,c),"has")});return rR.set(this,n),n}get audit(){return this.generated.audit}get sources(){return this.sourcesResource}get transport(){return this.nppHolder.transport}async identity(){let o=(await this.mintToken()).token,e=$e(o);return{clientId:this.clientId,orgId:$(e["npayload/orgId"])??$(e.orgId)??$(e.org)??$(e.org_id)??$(e.sub),appId:this.appId??$(e["npayload/appId"])??$(e.appId)??$(e.app)??$(e.app_id)}}fingerprint(){return this.kernel.auth.fingerprint()}async enroll(){let o=await this.kernel.auth.fingerprint();this.kernel.auth.invalidate();let e=await this.mintToken(),t=e.scopes.length>0?sR.filter(r=>Oc(e.scopes,r.scope)):sR;for(let r of t)try{return await this.kernel.send({method:"GET",path:`${this.baseUrl}${r.path}`,query:{limit:1}}),{fingerprint:o,read:!0}}catch(s){let n=Xr(s);if(n!==void 0)throw n;if(s instanceof tr||s instanceof Mr)continue;throw Pf(s)}return{fingerprint:o,read:!1}}async mintToken(){try{return await this.kernel.auth.getAccessToken([])}catch(o){throw Xr(o)??o}}static async connect(o){let e=typeof process<"u"?process.env:{},t=Sc(o.transport)?_c(o.transport)?.dpopPrivateJwk:void 0,r=o.dpopPrivateJwk??t??jy(e)??(await Gs()).privateJwk,s=o.appId??e.NPAYLOAD_APP_ID,n=o.hmacSecret??e.NPAYLOAD_HMAC_SECRET,p=new i({...o,dpopPrivateJwk:r,...s!==void 0?{appId:s}:{},...n!==void 0?{hmacSecret:n}:{}}),{transport:c,edgeUrl:N,edgeNamed:E}=p.nppHolder;if((o.transport===void 0||typeof o.transport=="string")&&c==="npp"&&E===!0&&N!==void 0)try{await p.provisionNpp(N)}catch(A){throw Xr(A)??A}return p}async provisionNpp(o){this.nppHolder.publisher=await My(this.kernel,{baseUrl:this.baseUrl,edgeUrl:o,clientId:this.clientId,appId:this.appId,kernelHasNoBaseUrl:!0})}async kernelDoorPublisherFor(o,e){let t;if(this.channelAnswers.has(e))t=this.channelAnswers.get(e);else{try{t=await this.readChannelAnswer(e)}catch{return}this.channelAnswers.set(e,t),hc(t)&&this.firstKernelAnswers.set(e,t)}if(hc(t)){if(!this.kernel.config.clientSecret)throw new Le("KERNEL_CONFIG",`channel ${e} is published through the kernel frame door at ${o}, whose access token is minted with the app's client secret, and this client holds none: pass hmacSecret (or set NPAYLOAD_HMAC_SECRET). Nothing was sent.`);return this.kernelDoorPublisherPromise||(this.kernelDoorPublisherPromise=Hy(this.kernel,{baseUrl:this.baseUrl,frameDoorUrl:o,clientId:this.clientId,appId:this.appId,kernelHasNoBaseUrl:!0,readChannel:u(r=>{if(this.firstKernelAnswers.has(r)){let s=this.firstKernelAnswers.get(r);return this.firstKernelAnswers.delete(r),Promise.resolve(s)}return this.readChannelAnswer(r)},"readChannel"),producerEpoch:u(r=>Promise.resolve(By(r)),"producerEpoch")}).catch(r=>{throw this.kernelDoorPublisherPromise=void 0,r})),this.kernelDoorPublisherPromise}}readChannelAnswer(o){return this.kernel.send({method:"GET",path:`${this.baseUrl.replace(/\/+$/,"")}/v1/channels/{channelId}`,pathParams:{channelId:o}})}},sR=[{scope:"channels:read",path:"/v1/apps/channels/paginated"},{scope:"messages:read",path:"/v1/apps/messages"},{scope:"keys:write",path:"/v1/apps/dpop-keys"}];function Pf(i){return i instanceof ar?bc(i):i instanceof O&&i.status!==void 0?new a({message:i.message,statusCode:i.status,body:{code:i.code,message:i.message}}):i}u(Pf,"toPublicHttpError");function bf(i,o){return i??(o.NPAYLOAD_TRANSPORT==="http"?"http":"npp")}u(bf,"resolveTransportOption");var tR=new WeakMap,ff="The client dials the API its HttpTransport names: build the transport with that estate's API as baseUrl (its auth host as authUrl), or name nothing outside npayload's production hosts to use its production API.",vf='Pass the edge of that estate as edgeUrl (or set NPAYLOAD_EDGE_URL), or pass transport: "http".',Nf='Build the transport with the edge of that estate, or pass transport: "http".',Ef="The client dials the API its baseUrl option names alone: pass that estate's API as baseUrl (its auth host as authUrl, and its edge as edgeUrl), or name nothing outside npayload's production hosts to use its production API.";function Sf(i){return`${i.replace(/\/+$/,"")}/v1/apps/dpop-keys`}u(Sf,"keyRegistrationUrl");function _f(i){if(i===void 0)return{kind:"npp"};if(typeof i=="string")return{kind:i};if(Sc(i))return{kind:"http",http:i};if(ly(i))return{kind:"npp",publisher:i};throw new V(`The client sends through an NppTransport or an HttpTransport of this package (built from either of its module formats); a transport of kind ${JSON.stringify(i.kind)} that is neither is refused, so no request goes elsewhere than it names. Pass that transport's kind as a string, or build an HttpTransport with this package.`)}u(_f,"selectTransport");var Gi=class extends Error{static{u(this,"NPayloadError")}type;code;status;requestId;upgradeUrl;raw;constructor(o,e){super(o),this.name="NPayloadError",this.type=e.type,this.code=e.code,this.status=e.status,this.requestId=e.requestId,this.raw=e.raw,Object.setPrototypeOf(this,new.target.prototype)}toJSON(){return{name:this.name,type:this.type,code:this.code,status:this.status,message:this.message,requestId:this.requestId,...this.upgradeUrl!==void 0?{upgradeUrl:this.upgradeUrl}:{}}}};var le=class extends Gi{static{u(this,"WebhookVerificationError")}verificationCode;constructor(o,e){super(o,{type:"webhook_error",code:e,status:400}),this.name="WebhookVerificationError",this.verificationCode=e,Object.setPrototypeOf(this,new.target.prototype)}},kf=300,iR=/^[0-9a-fA-F]{64}$/,we={signature:"X-NPayload-Signature",timestamp:"X-NPayload-Timestamp",signaturePrevious:"X-NPayload-Signature-Previous",messageId:"X-NPayload-Message-Id",deliveryId:"X-NPayload-Delivery-Id",channelGid:"X-NPayload-Channel-Gid",publishedAt:"X-NPayload-Published-At",metadata:"X-NPayload-Metadata"},Mi=class{static{u(this,"WebhookHandler")}async constructEvent(o,e,t,r){let s=nR(e,r),{timestamp:n}=await this._verifyOrThrow(o,s,t,r),p=typeof o=="string"?o:aR(o),c;try{c=JSON.parse(p)}catch{throw new le("Webhook body is not valid JSON","INVALID_PAYLOAD")}let{headers:N}=s,E={id:N?Gr(N,we.messageId)??"":"",type:"",data:c,timestamp:n,signature:s.signature};if(N){let S=Gr(N,we.deliveryId);S!==void 0&&(E.deliveryId=S);let A=Gr(N,we.channelGid);A!==void 0&&(E.channelGid=A);let I=Gr(N,we.publishedAt);if(I!==void 0){let G=Number(I);Number.isFinite(G)&&(E.publishedAt=G)}let B=Gr(N,we.metadata);if(B!==void 0){let G=Gf(B);G!==void 0&&(E.metadata=G)}}return E}async verify(o,e,t,r){try{return await this._verifyOrThrow(o,nR(e,r),t,r),!0}catch{return!1}}async _verifyOrThrow(o,e,t,r){if(!e.signature)throw new le("Missing webhook signature","MISSING_SIGNATURE");if(!t)throw new le("Missing webhook secret","MISSING_SECRET");let{timestamp:s,hashes:n}=Tf(e),p=r?.tolerance??kf,c=Math.floor(Date.now()/1e3),N=Math.abs(c-s);if(N>p)throw new le(`Webhook timestamp is too old or too far in the future (age: ${N}s, tolerance: ${p}s)`,"TIMESTAMP_EXPIRED");let E=typeof o=="string"?o:aR(o),S=`${s}.${E}`,A=[t];r?.previousSecret&&A.push(r.previousSecret);for(let I of A){let B=await Mf(I,S);for(let G of n)if(await Uf(G,B))return{timestamp:s}}throw new le("Webhook signature verification failed","INVALID_SIGNATURE")}};function nR(i,o){if(typeof i=="string")return{signature:i,timestampHeader:o?.timestamp===void 0?void 0:String(o.timestamp),previousSignature:o?.previousSignature};if(typeof i!="object"||i===null)return{signature:""};let e=If(i);return{headers:e,signature:Gr(e,we.signature)??"",timestampHeader:Gr(e,we.timestamp),previousSignature:Gr(e,we.signaturePrevious)}}u(nR,"resolveSignatureInput");function Tf(i){let o=[],e;if(i.signature.includes("=")){let t=dR(i.signature);e=t.timestamp,o.push(t.hash.toLowerCase())}else{if(!iR.test(i.signature))throw new le(`Invalid signature: ${we.signature} is neither a hex HMAC-SHA256 nor a t=<ts>,v1=<hex> value`,"MALFORMED_SIGNATURE");if(i.timestampHeader===void 0)throw new le(`Invalid signature: a hex ${we.signature} needs its ${we.timestamp} \u2014 hand constructEvent the delivery headers, or pass the header value as options.timestamp`,"MALFORMED_SIGNATURE");e=Cf(i.timestampHeader),o.push(i.signature.toLowerCase())}if(i.previousSignature){let t=xf(i.previousSignature);t!==void 0&&o.push(t)}return{timestamp:e,hashes:o}}u(Tf,"parseSignatureInput");function Cf(i){let o=i.trim(),e=/^\d+$/.test(o)?Number(o):NaN;if(!Number.isFinite(e)||e<=0)throw new le(`Invalid signature: ${we.timestamp} is not a unix-seconds value`,"MALFORMED_SIGNATURE");return e}u(Cf,"parseTimestampHeader");function xf(i){if(i.includes("="))try{return dR(i).hash.toLowerCase()}catch{return}return iR.test(i)?i.toLowerCase():void 0}u(xf,"extractHash");function dR(i){let o=i.split(","),e,t;for(let r of o){let[s,...n]=r.trim().split("="),p=n.join("=");s==="t"?e=parseInt(p,10):s==="v1"&&(t=p)}if(e===void 0||isNaN(e))throw new le("Invalid signature header: missing or invalid timestamp","MALFORMED_SIGNATURE");if(!t)throw new le("Invalid signature header: missing v1 hash","MALFORMED_SIGNATURE");return{timestamp:e,hash:t}}u(dR,"parseSignatureHeader");function Af(i){return typeof i=="object"&&i!==null&&typeof i.get=="function"}u(Af,"isHeadersLike");function If(i){let o=i.headers;return typeof o=="object"&&o!==null?o:i}u(If,"resolveHeaderSource");function Gr(i,o){if(Af(i)){let t=i.get(o);return typeof t=="string"?t:void 0}let e=o.toLowerCase();for(let[t,r]of Object.entries(i))if(t.toLowerCase()===e)return typeof r=="string"?r:Array.isArray(r)&&typeof r[0]=="string"?r[0]:void 0}u(Gr,"readHeader");function Gf(i){try{let o=JSON.parse(i);if(typeof o=="object"&&o!==null&&!Array.isArray(o))return o}catch{}}u(Gf,"parseMetadataHeader");async function Mf(i,o){let e=new TextEncoder,t=await crypto.subtle.importKey("raw",e.encode(i),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",t,e.encode(o));return Hf(r)}u(Mf,"computeHmacSha256");async function Uf(i,o){let e=new TextEncoder,t=new Uint8Array(await crypto.subtle.digest("SHA-256",e.encode(i))),r=new Uint8Array(await crypto.subtle.digest("SHA-256",e.encode(o)));if(t.length!==r.length)return!1;let s=0;for(let n=0;n<t.length;n++)s|=t[n]^r[n];return s===0}u(Uf,"timingSafeEqual");function Hf(i){return Array.from(new Uint8Array(i)).map(o=>o.toString(16).padStart(2,"0")).join("")}u(Hf,"arrayBufferToHex");function aR(i){return typeof i.toString=="function"?i.toString("utf-8"):new TextDecoder().decode(i)}u(aR,"bufferToString");var ks=class{constructor(o,e){this.listFn=o;this.args=e}static{u(this,"AutoPaginator")}async*[Symbol.asyncIterator](){let o,e=!0;for(;e;){let t=await this.listFn({...this.args,cursor:o});for(let r of t.data)yield r;if(e=t.hasMore,o=t.cursor,e&&!o)break}}async toArray(){let o=[];for await(let e of this)o.push(e);return o}};function pR(i,o){return new ks(i,o??{})}u(pR,"autoPaginate");function cR(i,o){return o?{timeout:o.timeout??i.timeout,idempotencyKey:o.idempotencyKey,headers:{...i.headers,...o.headers},maxRetries:o.maxRetries??i.maxRetries,apiVersion:o.apiVersion??i.apiVersion}:i}u(cR,"mergeRequestOptions");var Ui=class{static{u(this,"NPayloadEventEmitter")}listeners=new Map;on(o,e){return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(e),this}off(o,e){return this.listeners.get(o)?.delete(e),this}emit(o,e){this.listeners.get(o)?.forEach(t=>{try{t(e)}catch{}})}listenerCount(o){return this.listeners.get(o)?.size??0}removeAllListeners(){this.listeners.clear()}};var uR="f4d5410c733e4c4a28858907bb7addc6d1fd34280961bdfb74cf0ac7a0a8419b";function lR(i){return i}u(lR,"defineEventsConfig");var wR={channels:{identity:"slug",deps:[],refs:{},ops:{archive:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelId/archive",scopes:["channels:admin"],pathParams:{channelId:"channelGid"}},create:{convexFn:"",method:"POST",pattern:"/v1/apps/channels",scopes:["channels:write"]},list:{convexFn:"",method:"GET",pattern:"/v1/apps/channels",scopes:["channels:read"]},pause:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelId/pause",scopes:["channels:write"],pathParams:{channelId:"channelGid"}},remove:{convexFn:"",method:"DELETE",pattern:"/v1/channels/:channelId",scopes:["channels:admin"],pathParams:{channelId:"channelGid"}},resume:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelId/resume",scopes:["channels:write"],pathParams:{channelId:"channelGid"}},update:{convexFn:"",method:"PATCH",pattern:"/v1/channels/:channelId",scopes:["channels:write"],pathParams:{channelId:"channelGid"},updatable:["complianceClass","nppMinQos","rateLimit","name","description","status","schema","settings","privacy","replication","compactionConfig","schemaValidation","platformConnectEnforcement","metadata","pii"]}}},consumerGroups:{identity:"name",deps:["channels"],refs:{channelGid:{parent:"channels",product:"events",wire:"gid",identity:"slug",array:!1,publicField:"channelGid"}},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelGid/consumer-groups",scopes:["consumer_groups:write"],pathParams:{channelGid:"channelGid"}},join:{convexFn:"",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/members",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid"},updatable:["subscriptionGid"]},leave:{convexFn:"",method:"DELETE",pattern:"/v1/consumer-groups/:consumerGroupGid/members/:subscriptionGid",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid",subscriptionGid:"subscriptionGid"}},list:{convexFn:"",method:"GET",pattern:"/v1/channels/:channelGid/consumer-groups",scopes:["consumer_groups:read"],pathParams:{channelGid:"channelGid"}},pause:{convexFn:"",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/pause",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid"}},resume:{convexFn:"",method:"POST",pattern:"/v1/consumer-groups/:consumerGroupGid/resume",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid"}},update:{convexFn:"",method:"PATCH",pattern:"/v1/consumer-groups/:consumerGroupGid",scopes:["consumer_groups:write"],pathParams:{consumerGroupGid:"groupGid"},updatable:["strategy","maxConcurrency"]}}},eventTypes:{identity:"name",deps:["channels"],refs:{channels:{parent:"channels",product:"events",wire:"gid",identity:"slug",array:!0,publicField:"channels"}},ops:{activate:{convexFn:"",method:"POST",pattern:"/v1/events/types/:eventTypeGid/activate",scopes:["catalogue:write"],pathParams:{eventTypeGid:"eventTypeGid"}},deprecate:{convexFn:"",method:"POST",pattern:"/v1/events/types/:eventTypeGid/deprecate",scopes:["catalogue:admin"],pathParams:{eventTypeGid:"eventTypeGid"},updatable:["message","sunsetDate"]},list:{convexFn:"",method:"GET",pattern:"/v1/apps/events/types",scopes:["catalogue:read"]},create:{convexFn:"",method:"POST",pattern:"/v1/apps/events/types",scopes:["catalogue:write"]},registerVersion:{convexFn:"",method:"POST",pattern:"/v1/events/types/:eventTypeGid/versions",scopes:["catalogue:write"],pathParams:{eventTypeGid:"eventTypeGid"},updatable:["version","schema","compatibility","changelog","publishedBy"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/events/types/:eventTypeGid",scopes:["catalogue:write"],pathParams:{eventTypeGid:"eventTypeGid"},updatable:["displayName","description","ownership","channels","tags","schema"]}}},exchanges:{identity:"name",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/exchanges",scopes:["exchanges:write"]},createBinding:{convexFn:"",method:"POST",pattern:"/v1/exchanges/:exchange_gid/bindings",scopes:["exchanges:write"],pathParams:{exchange_gid:"exchangeGid"},updatable:["channelGid","routingKey","headerRules"]},pause:{convexFn:"",method:"POST",pattern:"/v1/exchanges/:exchange_gid/disable",scopes:["exchanges:write"],pathParams:{exchange_gid:"exchangeGid"}},resume:{convexFn:"",method:"POST",pattern:"/v1/exchanges/:exchange_gid/enable",scopes:["exchanges:write"],pathParams:{exchange_gid:"exchangeGid"}},list:{convexFn:"",method:"GET",pattern:"/v1/exchanges",scopes:["exchanges:read"]},remove:{convexFn:"",method:"DELETE",pattern:"/v1/exchanges/:exchange_gid",scopes:["exchanges:admin"],pathParams:{exchange_gid:"exchangeGid"}},removeBinding:{convexFn:"",method:"DELETE",pattern:"/v1/exchange-bindings/:binding_gid",scopes:["exchanges:write"],pathParams:{binding_gid:"bindingGid"}},update:{convexFn:"",method:"PATCH",pattern:"/v1/exchanges/:exchange_gid",scopes:["exchanges:write"],pathParams:{exchange_gid:"exchangeGid"},updatable:["config"]}}},subscriptions:{identity:"name",deps:["channels"],refs:{channelGid:{parent:"channels",product:"events",wire:"gid",identity:"slug",array:!1,publicField:"channelGid"}},ops:{archive:{convexFn:"",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/archive",scopes:["subscriptions:write"],pathParams:{subscriptionId:"subscriptionGid"}},create:{convexFn:"",method:"POST",pattern:"/v1/channels/:channelId/subscriptions",scopes:["subscriptions:write"],pathParams:{channelId:"channelGid"}},list:{convexFn:"",method:"GET",pattern:"/v1/channels/:channelId/subscriptions",scopes:["subscriptions:read"],pathParams:{channelId:"channelGid"}},pause:{convexFn:"",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/pause",scopes:["subscriptions:write"],pathParams:{subscriptionId:"subscriptionGid"}},remove:{convexFn:"",method:"DELETE",pattern:"/v1/subscriptions/:subscriptionId",scopes:["subscriptions:admin"],pathParams:{subscriptionId:"subscriptionGid"}},resume:{convexFn:"",method:"POST",pattern:"/v1/subscriptions/:subscriptionId/resume",scopes:["subscriptions:write"],pathParams:{subscriptionId:"subscriptionGid"}},update:{convexFn:"",method:"PATCH",pattern:"/v1/subscriptions/:subscriptionId",scopes:["subscriptions:write"],pathParams:{subscriptionId:"subscriptionGid"},updatable:["description","status","filter","endpoint","delivery","dlq","metadata","deliveryConfig","transformPipeId","transformTimeout","transformOnFailure"]}}}};var hR="41cca5221cf2d3f14ebe43426ffadbc50816dfa8db8d6325205687a732db66dc";function mR(i){return i}u(mR,"definePrimusConfig");var yR={agents:{identity:"slug",deps:["skills"],refs:{skills:{parent:"skills",product:"primus",wire:"gid",identity:"name",array:!0,publicField:"skills"}},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/primus/agents",scopes:["agents:write"]},list:{convexFn:"",method:"GET",pattern:"/v1/primus/agents",scopes:["agents:read"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/primus/agents/:agentId",scopes:["agents:write"],pathParams:{agentId:"agentGid"},updatable:["name","description","systemPrompt","personality","language","skills","enabledIntegrations","trustLevel","defaultModel","maxTurns","config"]}}},skills:{identity:"slug",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/primus/skills",scopes:["skills:write"]},list:{convexFn:"",method:"GET",pattern:"/v1/primus/skills",scopes:["skills:read"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/primus/skills/:skillId",scopes:["skills:write"],pathParams:{skillId:"skillGid"},updatable:["name","description","category","icon","executor","enabled","definition","limits"]}}},tools:{identity:"slug",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/primus/tools",scopes:["tools:write"]},list:{convexFn:"",method:"GET",pattern:"/v1/primus/tools",scopes:["tools:read"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/primus/tools/:toolId",scopes:["tools:write"],pathParams:{toolId:"toolGid"},updatable:["description","parameters","outputSchema","riskLevel","requiresApproval","endpoint","executor","timeout","category","secretRef","headers"]}}},triggers:{identity:"slug",deps:["agents"],refs:{agentGid:{parent:"agents",product:"primus",wire:"gid",identity:"slug",array:!1,publicField:"agentGid"}},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/primus/triggers",scopes:["triggers:write"]},update:{convexFn:"",method:"PATCH",pattern:"/v1/primus/triggers/:triggerId",scopes:["triggers:write"],pathParams:{triggerId:"triggerGid"},updatable:["name","description","config","action","conditions","enabled"]},list:{convexFn:"",method:"GET",pattern:"/v1/primus/triggers",scopes:["triggers:read"]}}}};var RR="d6f97f724c494689c7307f26fa9081b55303f9d0c6f4b7b9523b2f4a26172cb3";function gR(i){return i}u(gR,"defineConnectConfig");var PR={bridges:{identity:"targetOrgGID",deps:[],refs:{},ops:{create:{convexFn:"",method:"POST",pattern:"/v1/connect/bridges",scopes:["bridges:write"]}}}};0&&(module.exports={AutoPaginator,CONNECT_CONFIG_RESOURCES,CONNECT_CONTRACT_HASH,EVENTS_CONFIG_RESOURCES,EVENTS_CONTRACT_HASH,HttpTransport,KERNEL_DOOR_URL_ENV,KernelDoorError,KernelDoorKey,KernelDoorSession,KernelSubscription,NPayload,NPayloadApi,NPayloadError,NPayloadEventEmitter,NPayloadFingerprintNotEnrolledError,NPayloadPlanRequiredError,NPayloadSourceNotAllowedError,NPayloadTimeoutError,NppKernelDoorError,NppProtocolError,NppRefusedError,NppTransport,NppTransportError,PRIMUS_CONFIG_RESOURCES,PRIMUS_CONTRACT_HASH,SDK_NAME,SDK_VERSION,SourceRequests,SourcesResource,TransportRefusedError,TransportUnavailableError,USER_AGENT,WEBHOOK_DELIVERY_HEADERS,WebhookHandler,WebhookVerificationError,autoPaginate,defaultLogger,defineConnectConfig,defineEventsConfig,definePrimusConfig,extraOf,mergeRequestOptions,redactSensitive,resolveDoor,silentLogger});