UNPKG

hud-sdk

Version:

Hud's Node SDK

1 lines 514 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(global,()=>(()=>{"use strict";var e,t,n={244:(e,t,n)=>{function r(e,t,n){return e.$source||(e.$source={}),e.$source[t]=n,e}n.d(t,{g:()=>r})},258:(e,t,n)=>{n.d(t,{B:()=>r});const r=(e,t,n)=>{let r,s,i,o=!1;const a=async()=>{s||(s=e());try{r=await s,i=!0,o=!1}finally{s=void 0}return r};return void 0===t?async e=>(i&&!e?.forceRefresh||(r=await a()),r):async e=>(i&&!e?.forceRefresh||(r=await a()),o?r:n&&!n(r)?(o=!0,r):t(r)?(await a(),r):r)}},369:(e,t,n)=>{n.d(t,{C:()=>r});const r=e=>new Date(Date.now()+e)},400:(e,t,n)=>{n.d(t,{ey:()=>S});var r=n(7075);const s=e=>e?.body instanceof r.Readable||"undefined"!=typeof ReadableStream&&e?.body instanceof ReadableStream;var i=n(7626),o=n(7090),a=n(9943),c=n(1787),u=n(2251),l=n(4652),d=n(1792);const p=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):"string"==typeof e?new Error(e):new Error(`AWS SDK error wrapper for ${e}`);function m(e){return t=>(n,r)=>async s=>{let c=await t.retryStrategy();const l=await t.maxAttempts();if(!f(c))return c?.mode&&(r.userAgent=[...r.userAgent||[],["cfg/retry-mode",c.mode]]),c.retry(n,s);{let d=await c.acquireInitialRetryToken((r.partition_id??"")+(r.__retryLongPoll?":longpoll":"")),m=new Error,f=0,y=0;const{request:b}=s,S=o.K.isInstance(b);for(S&&(b.headers[u.l5]=(0,a.v4)());;)try{S&&(b.headers[u.ok]=`attempt=${f+1}; max=${l}`);const{response:e,output:t}=await n(s);return c.recordSuccess(d),t.$metadata.attempts=f+1,t.$metadata.totalRetryDelay=y,{response:e,output:t}}catch(n){const s=h(n,t.logger);if(m=p(n),S&&e(b))throw(r.logger instanceof i.N?console:r.logger)?.warn("An error was encountered in a non-retryable streaming request."),m;try{d=await c.refreshRetryTokenForRetry(d,s)}catch(e){throw m.$metadata||(m.$metadata={}),m.$metadata.attempts=f+1,m.$metadata.totalRetryDelay=y,m}f=d.getRetryCount();const o=d.getRetryDelay();y+=(d?.$retryLog?.acquisitionDelay??0)+o,o>0&&await g(o)}}}}const g=e=>new Promise(t=>setTimeout(t,e)),f=e=>void 0!==e.acquireInitialRetryToken&&void 0!==e.refreshRetryTokenForRetry&&void 0!==e.recordSuccess,h=(e,t)=>{const n={error:e,errorType:y(e)},r=function(e,t){if(l.c.isInstance(e))for(const n of Object.keys(e.headers)){const r=n.toLowerCase();if("retry-after"===r){const r=e.headers[n];let s=NaN;if(r.endsWith("GMT"))try{s=((0,d.xE)(r).getTime()-Date.now())/1e3}catch(e){t?.trace?.("Failed to parse retry-after header"),t?.trace?.(e)}else r.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?s=Number(r.match(/ GMT, ([\d.]+)$/)?.[1]):r.match(/^((\d+)|(\d+\.\d+))$/)?s=Number(r):Date.parse(r)>=Date.now()&&(s=(Date.parse(r)-Date.now())/1e3);if(isNaN(s))return;return new Date(Date.now()+1e3*s)}if("x-amz-retry-after"===r){const r=e.headers[n],s=Number(r);return isNaN(s)?void t?.trace?.(`Failed to parse x-amz-retry-after=${r}`):new Date(Date.now()+s)}}}(e.$response,t);return r&&(n.retryAfterHint=r),n},y=e=>(0,c.Qb)(e)?"THROTTLING":(0,c.bV)(e)?"TRANSIENT":(0,c.GQ)(e)?"SERVER_ERROR":"CLIENT_ERROR",b={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0};m(s);const S=function(e){const t=m(e);return e=>({applyToStack:n=>{n.add(t(e),b)}})}(s)},402:(e,t,n)=>{n.d(t,{B:()=>r});class r{serdeContext;setSerdeContext(e){this.serdeContext=e}}},429:(e,t,n)=>{n.d(t,{k:()=>a});var r=n(7075),s=n(3772),i=n(8315),o=n(7249);const a=e=>(0,o.q)(e)?(0,i.kS)(e):(0,o.H)(e)?(0,i.Bq)(e):new Promise((t,n)=>{const r=new c,i=e;i.pipe(r),i.on("error",e=>{r.end(),n(e)}),r.on("error",n),r.on("finish",function(){const e=(0,s.I)(this.bufferedBytes);t(e)})});class c extends r.Writable{bufferedBytes=[];_write(e,t,n){this.bufferedBytes.push(e),n()}}},478:(e,t,n)=>{n.d(t,{qs:()=>f,kN:()=>y,$z:()=>h});var r=n(7277),s=n(1787);class i{static setTimeoutFn=(e,t)=>setTimeout(e,t);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let t;this.updateMeasuredRate();const n=e;if("THROTTLING"===n?.errorType||(0,s.Qb)(n?.error??e)){const e=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=e,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(e),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const r=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(r)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){const t=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(e=>i.setTimeoutFn(e,t)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp)return void(this.lastTimestamp=e);const t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(2*e)/2;if(this.requestCount++,t>this.lastTxRateBucket){const e=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(e*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}var o=n(2251);class a{static v2026="undefined"!=typeof process&&"true"===process.env?.SMITHY_NEW_RETRIES_2026;static delay(){return a.v2026?50:100}static throttlingDelay(){return a.v2026?1e3:500}static cost(){return a.v2026?14:5}static throttlingCost(){return a.v2026?5:10}static modifiedCostType(){return a.v2026?"THROTTLING":"TRANSIENT"}}class c{x=a.delay();computeNextBackoffDelay(e){const t=Math.random()*Math.min(this.x*2**e,o.G8);return Math.floor(t)}setDelayBase(e){this.x=e}}class u{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(e,t,n,r){this.delay=e,this.count=t,this.cost=n,this.longPoll=r}getRetryCount(){return this.count}getRetryDelay(){return Math.min(o.G8,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}var l=n(1762);class d{mode=l.cm.STANDARD;retryBackoffStrategy;capacity=o.Df;maxAttemptsProvider;baseDelay;constructor(e){"number"==typeof e?this.maxAttemptsProvider=async()=>e:"function"==typeof e?this.maxAttemptsProvider=e:e&&"object"==typeof e&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>l.Gz,this.baseDelay??=a.delay(),this.retryBackoffStrategy??=new c}async acquireInitialRetryToken(e){return new u(a.delay(),0,void 0,a.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts(),r=this.retryCode(e,t,n),s=0===r,i=e.isLongPoll?.();if(s||i){const n=t.errorType;this.retryBackoffStrategy.setDelayBase("THROTTLING"===n?a.throttlingDelay():this.baseDelay);const o=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());let c=o;if(t.retryAfterHint instanceof Date&&(c=Math.max(o,Math.min(t.retryAfterHint.getTime()-Date.now(),o+5e3))),s){const t=this.getCapacityCost(n);this.capacity-=t;const r=new u(0,e.getRetryCount()+1,t,e.isLongPoll?.()??!1);return await new Promise(e=>setTimeout(e,c)),r.$retryLog.acquisitionDelay=c,r}{const e=a.v2026&&3===r&&i?c:0;e>0&&await new Promise(t=>setTimeout(t,e))}}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(o.Df,this.capacity+(e.getRetryCost()??o.XP))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn(`Max attempts provider could not resolve. Using default of ${l.Gz}`),l.Gz}}retryCode(e,t,n){const r=e.getRetryCount()+1,s=this.isRetryableError(t.errorType)?0:1,i=r<n?0:2,o=this.capacity>=this.getCapacityCost(t.errorType)?0:3;return s||i||o}getCapacityCost(e){return e===a.modifiedCostType()?a.throttlingCost():a.cost()}isRetryableError(e){return"THROTTLING"===e||"TRANSIENT"===e}}class p{mode=l.cm.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,t){const{rateLimiter:n}=t??{};this.rateLimiter=n??new i,this.standardRetryStrategy=new d(t?{maxAttempts:"number"==typeof e?e:3,...t}:e)}async acquireInitialRetryToken(e){const t=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),t}async refreshRetryTokenForRetry(e,t){this.rateLimiter.updateClientSendingRate(t);const n=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,t);return await this.rateLimiter.getSendToken(),n}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}const m="AWS_MAX_ATTEMPTS",g="max_attempts",f={environmentVariableSelector:e=>{const t=e[m];if(!t)return;const n=parseInt(t);if(Number.isNaN(n))throw new Error(`Environment variable ${m} mast be a number, got "${t}"`);return n},configFileSelector:e=>{const t=e[g];if(!t)return;const n=parseInt(t);if(Number.isNaN(n))throw new Error(`Shared config file entry ${g} mast be a number, got "${t}"`);return n},default:l.Gz},h=(e,t)=>{const{retryStrategy:n,retryMode:s}=e,{defaultMaxAttempts:i=l.Gz,defaultBaseDelay:o=a.delay()}=t??{},c=(0,r.t)(e.maxAttempts??i);let u=n?Promise.resolve(n):void 0;return Object.assign(e,{maxAttempts:c,retryStrategy:()=>u??=(async()=>{const e=await c();return await(0,r.t)(s)()===l.cm.ADAPTIVE?new p(c,{maxAttempts:e,baseDelay:o}):new d({maxAttempts:e,baseDelay:o})})()})},y={environmentVariableSelector:e=>e.AWS_RETRY_MODE,configFileSelector:e=>e.retry_mode,default:l.L0}},498:(e,t,n)=>{n.d(t,{sM:()=>m});var r=n(643),s=n(7090),i=n(3415);const o=/\d{12}\.ddb/,a="user-agent",c="x-amz-user-agent",u=/[^!$%&'*+\-.^_`|~\w]/g,l=/[^!$%&'*+\-.^_`|~\w#]/g,d=e=>{const t=e[0].split("/").map(e=>e.replace(u,"-")).join("/"),n=e[1]?.replace(l,"-"),r=t.indexOf("/"),s=t.substring(0,r);let i=t.substring(r+1);return"api"===s&&(i=i.toLowerCase()),[s,i,n].filter(e=>e&&e.length>0).reduce((e,t,n)=>{switch(n){case 0:return t;case 1:return`${e}/${t}`;default:return`${e}#${t}`}},"")},p={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},m=e=>({applyToStack:t=>{var n;t.add((n=e,(e,t)=>async u=>{const{request:l}=u;if(!s.K.isInstance(l))return e(u);const{headers:p}=l,m=t?.userAgent?.map(d)||[],g=(await n.defaultUserAgentProvider()).map(d);await async function(e,t,n){const r=n.request;if("rpc-v2-cbor"===r?.headers?.["smithy-protocol"]&&(0,i.J)(e,"PROTOCOL_RPC_V2_CBOR","M"),"function"==typeof t.retryStrategy){const n=await t.retryStrategy();"function"==typeof n.acquireInitialRetryToken?n.constructor?.name?.includes("Adaptive")?(0,i.J)(e,"RETRY_MODE_ADAPTIVE","F"):(0,i.J)(e,"RETRY_MODE_STANDARD","E"):(0,i.J)(e,"RETRY_MODE_LEGACY","D")}if("function"==typeof t.accountIdEndpointMode){const n=e.endpointV2;switch(String(n?.url?.hostname).match(o)&&(0,i.J)(e,"ACCOUNT_ID_ENDPOINT","O"),await(t.accountIdEndpointMode?.())){case"disabled":(0,i.J)(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":(0,i.J)(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":(0,i.J)(e,"ACCOUNT_ID_MODE_REQUIRED","R")}}const s=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(s?.$source){const t=s;t.accountId&&(0,i.J)(e,"RESOLVED_ACCOUNT_ID","T");for(const[n,r]of Object.entries(t.$source??{}))(0,i.J)(e,n,r)}}(t,n,u);const f=t;g.push(`m/${function(e){let t="";for(const n in e){const r=e[n];if(!(t.length+r.length+1<=1024))break;t.length?t+=","+r:t+=r}return t}(Object.assign({},t.__smithy_context?.features,f.__aws_sdk_context?.features))}`);const h=n?.customUserAgent?.map(d)||[],y=await n.userAgentAppId();y&&g.push(d(["app",`${y}`]));const b=(0,r.vL)(),S=(b?[b]:[]).concat([...g,...m,...h]).join(" "),C=[...g.filter(e=>e.startsWith("aws-sdk-")),...h].join(" ");return"browser"!==n.runtime?(C&&(p[c]=p[c]?`${p[a]} ${C}`:C),p[a]=S):p[c]=S,e({...u,request:l})}),p)}})},523:e=>{e.exports=require("./logger")},592:(e,t,n)=>{n.d(t,{V:()=>o});var r=n(7598),s=n(7057),i=n(4978);class o{algorithmIdentifier;secret;hash;constructor(e,t){this.algorithmIdentifier=e,this.secret=t,this.reset()}update(e,t){this.hash.update((0,i.F)(a(e,t)))}digest(){return Promise.resolve(this.hash.digest())}reset(){this.hash=this.secret?(0,r.createHmac)(this.algorithmIdentifier,a(this.secret)):(0,r.createHash)(this.algorithmIdentifier)}}function a(e,t){return Buffer.isBuffer(e)?e:"string"==typeof e?(0,s.s)(e,t):ArrayBuffer.isView(e)?(0,s.Q)(e.buffer,e.byteOffset,e.byteLength):(0,s.Q)(e)}},607:(e,t,n)=>{n.d(t,{s:()=>P});const r="endpoints";function s(e){return"object"!=typeof e||null==e?e:"ref"in e?`$${s(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(s).join(", ")})`:JSON.stringify(e,null,2)}class i extends Error{constructor(e){super(e),this.name="EndpointError"}}var o=n(947);const a=(e,t)=>(e=>{const t=e.split("."),n=[];for(const r of t){const t=r.indexOf("[");if(-1!==t){if(r.indexOf("]")!==r.length-1)throw new i(`Path: '${e}' does not end with ']'`);const s=r.slice(t+1,-1);if(Number.isNaN(parseInt(s)))throw new i(`Invalid array index: '${s}' in path: '${e}'`);0!==t&&n.push(r.slice(0,t)),n.push(s)}else n.push(r)}return n})(t).reduce((n,r)=>{if("object"!=typeof n)throw new i(`Index '${r}' in '${t}' not found in '${JSON.stringify(e)}'`);if(Array.isArray(n)){const e=parseInt(r);return n[e<0?n.length+e:e]}return n[r]},e);var c,u=n(2437);!function(e){e.HTTP="http",e.HTTPS="https"}(c||(c={}));var l=n(5517);const d={[c.HTTP]:80,[c.HTTPS]:443},p={booleanEquals:(e,t)=>e===t,coalesce:function(...e){for(const t of e)if(null!=t)return t},getAttr:a,isSet:e=>null!=e,isValidHostLabel:u.X,ite:function(e,t,n){return e?t:n},not:e=>!e,parseURL:e=>{const t=(()=>{try{if(e instanceof URL)return e;if("object"==typeof e&&"hostname"in e){const{hostname:t,port:n,protocol:r="",path:s="",query:i={}}=e,o=new URL(`${r}//${t}${n?`:${n}`:""}${s}`);return o.search=Object.entries(i).map(([e,t])=>`${e}=${t}`).join("&"),o}return new URL(e)}catch(e){return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:r,hostname:s,pathname:i,protocol:o,search:a}=t;if(a)return null;const u=o.slice(0,-1);if(!Object.values(c).includes(u))return null;const p=(0,l.o)(s);return{scheme:u,authority:`${r}${n.includes(`${r}:${d[u]}`)||"string"==typeof e&&e.includes(`${r}:${d[u]}`)?`:${d[u]}`:""}`,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:p}},split:function(e,t,n){if(1===n)return[e];if(""===e)return[""];const r=e.split(t);return 0===n?r:r.slice(0,n-1).concat(r.slice(1).join(t))},stringEquals:(e,t)=>e===t,substring:(e,t,n,r)=>null==e||t>=n||e.length<n||/[^\u0000-\u007f]/.test(e)?null:r?e.substring(e.length-n,e.length-t):e.substring(t,n),uriEncode:e=>encodeURIComponent(e).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)},m=(e,t)=>{const n=[],{referenceRecord:r,endpointParams:s}=t;let i=0;for(;i<e.length;){const t=e.indexOf("{",i);if(-1===t){n.push(e.slice(i));break}n.push(e.slice(i,t));const o=e.indexOf("}",t);if(-1===o){n.push(e.slice(t));break}"{"===e[t+1]&&"}"===e[o+1]&&(n.push(e.slice(t+1,o)),i=o+2);const c=e.substring(t+1,o);if(c.includes("#")){const[e,t]=c.split("#");n.push(a(r[e]??s[e],t))}else n.push(r[c]??s[c]);i=o+1}return n.join("")},g=(e,t,n)=>{if("string"==typeof e)return m(e,n);if(e.fn)return h.callFunction(e,n);if(e.ref)return(({ref:e},t)=>t.referenceRecord[e]??t.endpointParams[e])(e,n);throw new i(`'${t}': ${String(e)} is not a string, function or reference.`)},f=({fn:e,argv:t},n)=>{const r=Array(t.length);for(let e=0;e<r.length;++e){const s=t[e];r[e]="boolean"==typeof s||"number"==typeof s?s:h.evaluateExpression(s,"arg",n)}const s=e.indexOf(".");if(-1!==s){const t=o.m[e.slice(0,s)],n=t?.[e.slice(s+1)];if("function"==typeof n)return n(...r)}const i=p[e];if("function"==typeof i)return i(...r);throw new Error(`function ${e} not loaded in endpointFunctions.`)},h={evaluateExpression:g,callFunction:f},y=(e,t)=>{const{assign:n}=e;if(n&&n in t.referenceRecord)throw new i(`'${n}' is already defined in Reference Record.`);const o=f(e,t);t.logger?.debug?.(`${r} evaluateCondition: ${s(e)} = ${s(o)}`);const a=""===o||!!o;return null!=n?{result:a,toAssign:{name:n,value:o}}:{result:a}},b=(e=[],t)=>{const n={},i={...t,referenceRecord:{...t.referenceRecord}};let o=!1;for(const a of e){const{result:e,toAssign:c}=y(a,i);if(!e)return{result:e};c&&(o=!0,n[c.name]=c.value,i.referenceRecord[c.name]=c.value,t.logger?.debug?.(`${r} assign: ${c.name} := ${s(c.value)}`))}return o?{result:!0,referenceRecord:n}:{result:!0}},S=(e,t)=>Object.entries(e).reduce((e,[n,r])=>(e[n]=w.getEndpointProperty(r,t),e),{}),C=(e,t)=>{if(Array.isArray(e))return e.map(e=>C(e,t));switch(typeof e){case"string":return m(e,t);case"object":if(null===e)throw new i(`Unexpected endpoint property: ${e}`);return w.getEndpointProperties(e,t);case"boolean":return e;default:throw new i("Unexpected endpoint property type: "+typeof e)}},w={getEndpointProperty:C,getEndpointProperties:S},k=(e,t)=>{const n=g(e,"Endpoint URL",t);if("string"==typeof n)try{return new URL(n)}catch(e){throw console.error(`Failed to construct URL with ${n}`,e),e}throw new i("Endpoint URL must be a string, got "+typeof n)},E=(e,t)=>{const{conditions:n,endpoint:o}=e,{result:a,referenceRecord:c}=b(n,t);if(!a)return;const u=c?{...t,referenceRecord:{...t.referenceRecord,...c}}:t,{url:l,properties:d,headers:p}=o;t.logger?.debug?.(`${r} Resolving endpoint from template: ${s(o)}`);const m={url:k(l,u)};return null!=p&&(m.headers=((e,t)=>Object.entries(e??{}).reduce((e,[n,r])=>(e[n]=r.map(e=>{const r=g(e,"Header value entry",t);if("string"!=typeof r)throw new i(`Header '${n}' value '${r}' is not a string`);return r}),e),{}))(p,u)),null!=d&&(m.properties=S(d,u)),m},v=(e,t)=>{const{conditions:n,error:r}=e,{result:s,referenceRecord:o}=b(n,t);if(!s)return;const a=o?{...t,referenceRecord:{...t.referenceRecord,...o}}:t;throw new i(g(r,"Error",a))},x=(e,t)=>{for(const n of e)if("endpoint"===n.type){const e=E(n,t);if(e)return e}else if("error"===n.type)v(n,t);else{if("tree"!==n.type)throw new i(`Unknown endpoint rule: ${n}`);{const e=A.evaluateTreeRule(n,t);if(e)return e}}throw new i("Rules evaluation failed")},A={evaluateRules:x,evaluateTreeRule:(e,t)=>{const{conditions:n,rules:r}=e,{result:s,referenceRecord:i}=b(n,t);if(!s)return;const o=i?{...t,referenceRecord:{...t.referenceRecord,...i}}:t;return A.evaluateRules(r,o)}},P=(e,t)=>{const{endpointParams:n,logger:o}=t,{parameters:a,rules:c}=e;t.logger?.debug?.(`${r} Initial EndpointParams: ${s(n)}`);for(const e in a){const t=a[e],r=n[e];if(null!=r||null==t.default){if(t.required&&null==r)throw new i(`Missing required parameter: '${e}'`)}else n[e]=t.default}const u=x(c,{endpointParams:n,logger:o,referenceRecord:{}});return t.logger?.debug?.(`${r} Resolved endpoint: ${s(u)}`),u}},643:(e,t,n)=>{n.d(t,{UF:()=>u,vL:()=>c});var r=n(947),s=n(2437),i=n(5517);const o=(e,t=!1)=>{if(t){for(const t of e.split("."))if(!o(t))return!1;return!0}return!(!(0,s.X)(e)||e.length<3||e.length>63||e!==e.toLowerCase()||(0,i.o)(e))};let a=JSON.parse('{"partitions":[{"id":"aws","outputs":{"dnsSuffix":"amazonaws.com","dualStackDnsSuffix":"api.aws","implicitGlobalRegion":"us-east-1","name":"aws","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^(us|eu|ap|sa|ca|me|af|il|mx)\\\\-\\\\w+\\\\-\\\\d+$","regions":{"af-south-1":{"description":"Africa (Cape Town)"},"ap-east-1":{"description":"Asia Pacific (Hong Kong)"},"ap-east-2":{"description":"Asia Pacific (Taipei)"},"ap-northeast-1":{"description":"Asia Pacific (Tokyo)"},"ap-northeast-2":{"description":"Asia Pacific (Seoul)"},"ap-northeast-3":{"description":"Asia Pacific (Osaka)"},"ap-south-1":{"description":"Asia Pacific (Mumbai)"},"ap-south-2":{"description":"Asia Pacific (Hyderabad)"},"ap-southeast-1":{"description":"Asia Pacific (Singapore)"},"ap-southeast-2":{"description":"Asia Pacific (Sydney)"},"ap-southeast-3":{"description":"Asia Pacific (Jakarta)"},"ap-southeast-4":{"description":"Asia Pacific (Melbourne)"},"ap-southeast-5":{"description":"Asia Pacific (Malaysia)"},"ap-southeast-6":{"description":"Asia Pacific (New Zealand)"},"ap-southeast-7":{"description":"Asia Pacific (Thailand)"},"aws-global":{"description":"aws global region"},"ca-central-1":{"description":"Canada (Central)"},"ca-west-1":{"description":"Canada West (Calgary)"},"eu-central-1":{"description":"Europe (Frankfurt)"},"eu-central-2":{"description":"Europe (Zurich)"},"eu-north-1":{"description":"Europe (Stockholm)"},"eu-south-1":{"description":"Europe (Milan)"},"eu-south-2":{"description":"Europe (Spain)"},"eu-west-1":{"description":"Europe (Ireland)"},"eu-west-2":{"description":"Europe (London)"},"eu-west-3":{"description":"Europe (Paris)"},"il-central-1":{"description":"Israel (Tel Aviv)"},"me-central-1":{"description":"Middle East (UAE)"},"me-south-1":{"description":"Middle East (Bahrain)"},"mx-central-1":{"description":"Mexico (Central)"},"sa-east-1":{"description":"South America (Sao Paulo)"},"us-east-1":{"description":"US East (N. Virginia)"},"us-east-2":{"description":"US East (Ohio)"},"us-west-1":{"description":"US West (N. California)"},"us-west-2":{"description":"US West (Oregon)"}}},{"id":"aws-cn","outputs":{"dnsSuffix":"amazonaws.com.cn","dualStackDnsSuffix":"api.amazonwebservices.com.cn","implicitGlobalRegion":"cn-northwest-1","name":"aws-cn","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^cn\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-cn-global":{"description":"aws-cn global region"},"cn-north-1":{"description":"China (Beijing)"},"cn-northwest-1":{"description":"China (Ningxia)"}}},{"id":"aws-eusc","outputs":{"dnsSuffix":"amazonaws.eu","dualStackDnsSuffix":"api.amazonwebservices.eu","implicitGlobalRegion":"eusc-de-east-1","name":"aws-eusc","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^eusc\\\\-(de)\\\\-\\\\w+\\\\-\\\\d+$","regions":{"eusc-de-east-1":{"description":"EU (Germany)"}}},{"id":"aws-iso","outputs":{"dnsSuffix":"c2s.ic.gov","dualStackDnsSuffix":"api.aws.ic.gov","implicitGlobalRegion":"us-iso-east-1","name":"aws-iso","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^us\\\\-iso\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-iso-global":{"description":"aws-iso global region"},"us-iso-east-1":{"description":"US ISO East"},"us-iso-west-1":{"description":"US ISO WEST"}}},{"id":"aws-iso-b","outputs":{"dnsSuffix":"sc2s.sgov.gov","dualStackDnsSuffix":"api.aws.scloud","implicitGlobalRegion":"us-isob-east-1","name":"aws-iso-b","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^us\\\\-isob\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-iso-b-global":{"description":"aws-iso-b global region"},"us-isob-east-1":{"description":"US ISOB East (Ohio)"},"us-isob-west-1":{"description":"US ISOB West"}}},{"id":"aws-iso-e","outputs":{"dnsSuffix":"cloud.adc-e.uk","dualStackDnsSuffix":"api.cloud-aws.adc-e.uk","implicitGlobalRegion":"eu-isoe-west-1","name":"aws-iso-e","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^eu\\\\-isoe\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-iso-e-global":{"description":"aws-iso-e global region"},"eu-isoe-west-1":{"description":"EU ISOE West"}}},{"id":"aws-iso-f","outputs":{"dnsSuffix":"csp.hci.ic.gov","dualStackDnsSuffix":"api.aws.hci.ic.gov","implicitGlobalRegion":"us-isof-south-1","name":"aws-iso-f","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^us\\\\-isof\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-iso-f-global":{"description":"aws-iso-f global region"},"us-isof-east-1":{"description":"US ISOF EAST"},"us-isof-south-1":{"description":"US ISOF SOUTH"}}},{"id":"aws-us-gov","outputs":{"dnsSuffix":"amazonaws.com","dualStackDnsSuffix":"api.aws","implicitGlobalRegion":"us-gov-west-1","name":"aws-us-gov","supportsDualStack":true,"supportsFIPS":true},"regionRegex":"^us\\\\-gov\\\\-\\\\w+\\\\-\\\\d+$","regions":{"aws-us-gov-global":{"description":"aws-us-gov global region"},"us-gov-east-1":{"description":"AWS GovCloud (US-East)"},"us-gov-west-1":{"description":"AWS GovCloud (US-West)"}}}],"version":"1.1"}');const c=()=>"",u={isVirtualHostableS3Bucket:o,parseArn:e=>{const t=e.split(":");if(t.length<6)return null;const[n,r,s,i,o,...a]=t;return"arn"!==n||""===r||""===s||""===a.join(":")?null:{partition:r,service:s,region:i,accountId:o,resourceId:a.map(e=>e.split("/")).flat()}},partition:e=>{const{partitions:t}=a;for(const n of t){const{regions:t,outputs:r}=n;for(const[n,s]of Object.entries(t))if(n===e)return{...r,...s}}for(const n of t){const{regionRegex:t,outputs:r}=n;if(new RegExp(t).test(e))return{...r}}const n=t.find(e=>"aws"===e.id);if(!n)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...n.outputs}}};r.m.aws=u},650:(e,t,n)=>{n.d(t,{G:()=>r});const r=e=>{const t=e.length,n=[];let r,s=!1,i=0;for(let o=0;o<t;++o){const t=e[o];switch(t){case'"':"\\"!==r&&(s=!s);break;case",":s||(n.push(e.slice(i,o)),i=o+1)}r=t}return n.push(e.slice(i)),n.map(e=>{const t=(e=e.trim()).length;return t<2?e:('"'===e[0]&&'"'===e[t-1]&&(e=e.slice(1,t-1)),e.replace(/\\"/g,'"'))})}},677:(e,t,n)=>{n.d(t,{fromEnv:()=>r.sF});var r=n(1478)},857:e=>{e.exports=require("os")},865:(e,t,n)=>{n.d(t,{z:()=>c});var r=n(8754),s=n(2288),i=n(2165),o=n(3279),a=n(5053);class c extends o.f{codecDeserializer;stringDeserializer;constructor(e,t){super(),this.codecDeserializer=e,this.stringDeserializer=new a.k(t)}setSerdeContext(e){this.stringDeserializer.setSerdeContext(e),this.codecDeserializer.setSerdeContext(e),this.serdeContext=e}read(e,t){const n=r.l1.of(e),o=n.getMergedTraits(),a=this.serdeContext?.utf8Encoder??s.P;if(o.httpHeader||o.httpResponseCode)return this.stringDeserializer.read(n,a(t));if(o.httpPayload){if(n.isBlobSchema()){const e=this.serdeContext?.utf8Decoder??i.a;return"string"==typeof t?e(t):t}if(n.isStringSchema())return"byteLength"in t?a(t):t}return this.codecDeserializer.read(n,t)}}},909:(e,t,n)=>{n.d(t,{CreateTokenCommand:()=>wt,SSOOIDCClient:()=>Ie});var r=n(1095),s=n(7813),i=n(5112),o=n(7287),a=n(498),c=n(4715),u=n(1739),l=n(8429),d=n(1295),p=n(4564),m=n(1770),g=n(9598),f=n(478),h=n(400),y=n(1109),b=n(9257),S=n(2238),C=n(7277);const w=async(e,t,n)=>({operation:(0,S.u)(t).operation,region:await(0,C.t)(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),k=e=>{const t=[];return"CreateToken"===e.operation?t.push({schemeId:"smithy.api#noAuth"}):t.push(function(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"sso-oauth",region:e.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}(e)),t},E={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var v=n(9955),x=n(5122),A=n(4472),P=n(8246),R=n(9915),T=n(3001),I=n(7193),O=n(4753),B=n(592),D=n(9884),_=n(5999),$=n(429),N=n(971),M=n(2802),L=n(8486),j=n(3078),U=n(1762),q=n(2906),z=n(5413),F=n(5687),G=n(7626),H=n(2505),W=n(9013),V=n(9848),K=n(2165),Z=n(2288),J=n(643),Q=n(6762),Y=n(607),X=n(947);const ee="required",te="fn",ne="argv",re="ref",se=!0,ie="isSet",oe="booleanEquals",ae="error",ce="endpoint",ue="tree",le="PartitionResult",de="getAttr",pe={[ee]:!1,type:"string"},me={[ee]:!0,default:!1,type:"boolean"},ge={[re]:"Endpoint"},fe={[te]:oe,[ne]:[{[re]:"UseFIPS"},!0]},he={[te]:oe,[ne]:[{[re]:"UseDualStack"},!0]},ye={},be={[te]:de,[ne]:[{[re]:le},"supportsFIPS"]},Se={[re]:le},Ce={[te]:oe,[ne]:[!0,{[te]:de,[ne]:[Se,"supportsDualStack"]}]},we=[fe],ke=[he],Ee=[{[re]:"Region"}],ve={version:"1.0",parameters:{Region:pe,UseDualStack:me,UseFIPS:me,Endpoint:pe},rules:[{conditions:[{[te]:ie,[ne]:[ge]}],rules:[{conditions:we,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:ae},{conditions:ke,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:ae},{endpoint:{url:ge,properties:ye,headers:ye},type:ce}],type:ue},{conditions:[{[te]:ie,[ne]:Ee}],rules:[{conditions:[{[te]:"aws.partition",[ne]:Ee,assign:le}],rules:[{conditions:[fe,he],rules:[{conditions:[{[te]:oe,[ne]:[se,be]},Ce],rules:[{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:ye,headers:ye},type:ce}],type:ue},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:ae}],type:ue},{conditions:we,rules:[{conditions:[{[te]:oe,[ne]:[be,se]}],rules:[{conditions:[{[te]:"stringEquals",[ne]:[{[te]:de,[ne]:[Se,"name"]},"aws-us-gov"]}],endpoint:{url:"https://oidc.{Region}.amazonaws.com",properties:ye,headers:ye},type:ce},{endpoint:{url:"https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}",properties:ye,headers:ye},type:ce}],type:ue},{error:"FIPS is enabled but this partition does not support FIPS",type:ae}],type:ue},{conditions:ke,rules:[{conditions:[Ce],rules:[{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:ye,headers:ye},type:ce}],type:ue},{error:"DualStack is enabled but this partition does not support DualStack",type:ae}],type:ue},{endpoint:{url:"https://oidc.{Region}.{PartitionResult#dnsSuffix}",properties:ye,headers:ye},type:ce}],type:ue}],type:ue},{error:"Invalid Configuration: Missing Region",type:ae}]},xe=new Q.k({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Ae=(e,t={})=>xe.get(e,()=>(0,Y.s)(ve,{endpointParams:e,logger:t.logger}));X.m.aws=J.UF;var Pe=n(4163),Re=n(5117),Te=n(6748);class Ie extends y.K{config;constructor(...[e]){const t=(e=>{(0,N.I)(process.version);const t=(0,j.I)(e),n=()=>t().then(M.l),r=(e=>({apiVersion:"2019-06-10",base64Decoder:e?.base64Decoder??W.E,base64Encoder:e?.base64Encoder??V.n,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Ae,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??k,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new q.f2},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new F.m}],logger:e?.logger??new G.N,protocol:e?.protocol??z.Y,protocolSettings:e?.protocolSettings??{defaultNamespace:"com.amazonaws.ssooidc",version:"2019-06-10",serviceTarget:"AWSSSOOIDCService"},serviceId:e?.serviceId??"SSO OIDC",urlParser:e?.urlParser??H.D,utf8Decoder:e?.utf8Decoder??K.a,utf8Encoder:e?.utf8Encoder??Z.P}))(e);(0,x.I)(process.version);const s={profile:e?.profile,logger:r.logger};return{...r,...e,runtime:"node",defaultsMode:t,authSchemePreference:e?.authSchemePreference??(0,D.Z)(A.$,s),bodyLengthChecker:e?.bodyLengthChecker??L.n,defaultUserAgentProvider:e?.defaultUserAgentProvider??(0,P.pf)({serviceId:r.serviceId,clientVersion:v.rE}),maxAttempts:e?.maxAttempts??(0,D.Z)(f.qs,e),region:e?.region??(0,D.Z)(T.GG,{...T.zH,...s}),requestHandler:_.$.create(e?.requestHandler??n),retryMode:e?.retryMode??(0,D.Z)({...f.kN,default:async()=>(await n()).retryMode||U.L0},e),sha256:e?.sha256??B.V.bind(null,"sha256"),streamCollector:e?.streamCollector??$.k,useDualstackEndpoint:e?.useDualstackEndpoint??(0,D.Z)(I.e$,s),useFipsEndpoint:e?.useFipsEndpoint??(0,D.Z)(O.Ko,s),userAgentAppId:e?.userAgentAppId??(0,D.Z)(R.hV,s)}})(e||{});super(t),this.initConfig=t;const n=(y=t,Object.assign(y,{useDualstackEndpoint:y.useDualstackEndpoint??!1,useFipsEndpoint:y.useFipsEndpoint??!1,defaultSigningName:"sso-oauth"}));var y;const S=(0,o.D)(n),E=(0,f.$z)(S),J=(0,c.T)(E),Q=(0,r.OV)(J),Y=((e,t)=>{const n=Object.assign((0,Pe.R)(e),(0,Te.xA)(e),(0,Re.e)(e),(e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,r=e.credentials;return{setHttpAuthScheme(e){const n=t.findIndex(t=>t.schemeId===e.schemeId);-1===n?t.push(e):t.splice(n,1,e)},httpAuthSchemes:()=>t,setHttpAuthSchemeProvider(e){n=e},httpAuthSchemeProvider:()=>n,setCredentials(e){r=e},credentials:()=>r}})(e));return t.forEach(e=>e.configure(n)),Object.assign(e,(0,Pe.$)(n),(0,Te.uv)(n),(0,Re.j)(n),{httpAuthSchemes:(r=n).httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()});var r})((e=>{const t=(0,b.h)(e);return Object.assign(t,{authSchemePreference:(0,C.t)(e.authSchemePreference??[])})})((0,g.Co)(Q)),e?.extensions||[]);this.config=Y,this.middlewareStack.use((0,p.wq)(this.config)),this.middlewareStack.use((0,a.sM)(this.config)),this.middlewareStack.use((0,h.ey)(this.config)),this.middlewareStack.use((0,m.vK)(this.config)),this.middlewareStack.use((0,r.TC)(this.config)),this.middlewareStack.use((0,s.Y7)(this.config)),this.middlewareStack.use((0,i.n)(this.config)),this.middlewareStack.use((0,u.w)(this.config,{httpAuthSchemeParametersProvider:w,identityProviderConfigProvider:async e=>new l.h({"aws.auth#sigv4":e.credentials})})),this.middlewareStack.use((0,d.l)(this.config))}destroy(){super.destroy()}}var Oe=n(6714),Be=n(7870),De=n(3384);class _e extends De.T{constructor(e){super(e),Object.setPrototypeOf(this,_e.prototype)}}class $e extends _e{name="AccessDeniedException";$fault="client";error;reason;error_description;constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,$e.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}}class Ne extends _e{name="AuthorizationPendingException";$fault="client";error;error_description;constructor(e){super({name:"AuthorizationPendingException",$fault:"client",...e}),Object.setPrototypeOf(this,Ne.prototype),this.error=e.error,this.error_description=e.error_description}}class Me extends _e{name="ExpiredTokenException";$fault="client";error;error_description;constructor(e){super({name:"ExpiredTokenException",$fault:"client",...e}),Object.setPrototypeOf(this,Me.prototype),this.error=e.error,this.error_description=e.error_description}}class Le extends _e{name="InternalServerException";$fault="server";error;error_description;constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,Le.prototype),this.error=e.error,this.error_description=e.error_description}}class je extends _e{name="InvalidClientException";$fault="client";error;error_description;constructor(e){super({name:"InvalidClientException",$fault:"client",...e}),Object.setPrototypeOf(this,je.prototype),this.error=e.error,this.error_description=e.error_description}}class Ue extends _e{name="InvalidGrantException";$fault="client";error;error_description;constructor(e){super({name:"InvalidGrantException",$fault:"client",...e}),Object.setPrototypeOf(this,Ue.prototype),this.error=e.error,this.error_description=e.error_description}}class qe extends _e{name="InvalidRequestException";$fault="client";error;reason;error_description;constructor(e){super({name:"InvalidRequestException",$fault:"client",...e}),Object.setPrototypeOf(this,qe.prototype),this.error=e.error,this.reason=e.reason,this.error_description=e.error_description}}class ze extends _e{name="InvalidScopeException";$fault="client";error;error_description;constructor(e){super({name:"InvalidScopeException",$fault:"client",...e}),Object.setPrototypeOf(this,ze.prototype),this.error=e.error,this.error_description=e.error_description}}class Fe extends _e{name="SlowDownException";$fault="client";error;error_description;constructor(e){super({name:"SlowDownException",$fault:"client",...e}),Object.setPrototypeOf(this,Fe.prototype),this.error=e.error,this.error_description=e.error_description}}class Ge extends _e{name="UnauthorizedClientException";$fault="client";error;error_description;constructor(e){super({name:"UnauthorizedClientException",$fault:"client",...e}),Object.setPrototypeOf(this,Ge.prototype),this.error=e.error,this.error_description=e.error_description}}class He extends _e{name="UnsupportedGrantTypeException";$fault="client";error;error_description;constructor(e){super({name:"UnsupportedGrantTypeException",$fault:"client",...e}),Object.setPrototypeOf(this,He.prototype),this.error=e.error,this.error_description=e.error_description}}const We="client",Ve="error",Ke="error_description",Ze="http",Je="httpError",Qe="reason",Ye="refreshToken",Xe="smithy.ts.sdk.synthetic.com.amazonaws.ssooidc",et="com.amazonaws.ssooidc";var tt=[0,et,"AccessToken",8,0],nt=[0,et,"ClientSecret",8,0],rt=[0,et,"CodeVerifier",8,0],st=[0,et,"IdToken",8,0],it=[0,et,"RefreshToken",8,0],ot=[-3,et,"AccessDeniedException",{[Ve]:We,[Je]:400},[Ve,Qe,Ke],[0,0,0]];Be.O.for(et).registerError(ot,$e);var at=[-3,et,"AuthorizationPendingException",{[Ve]:We,[Je]:400},[Ve,Ke],[0,0]];Be.O.for(et).registerError(at,Ne);var ct=[3,et,"CreateTokenRequest",0,["clientId","clientSecret","grantType","deviceCode","code",Ye,"scope","redirectUri","codeVerifier"],[0,[()=>nt,0],0,0,0,[()=>it,0],64,0,[()=>rt,0]]],ut=[3,et,"CreateTokenResponse",0,["accessToken","tokenType","expiresIn",Ye,"idToken"],[[()=>tt,0],0,1,[()=>it,0],[()=>st,0]]],lt=[-3,et,"ExpiredTokenException",{[Ve]:We,[Je]:400},[Ve,Ke],[0,0]];Be.O.for(et).registerError(lt,Me);var dt=[-3,et,"InternalServerException",{[Ve]:"server",[Je]:500},[Ve,Ke],[0,0]];Be.O.for(et).registerError(dt,Le);var pt=[-3,et,"InvalidClientException",{[Ve]:We,[Je]:401},[Ve,Ke],[0,0]];Be.O.for(et).registerError(pt,je);var mt=[-3,et,"InvalidGrantException",{[Ve]:We,[Je]:400},[Ve,Ke],[0,0]];Be.O.for(et).registerError(mt,Ue);var gt=[-3,et,"InvalidRequestException",{[Ve]:We,[Je]:400},[Ve,Qe,Ke],[0,0,0]];Be.O.for(et).registerError(gt,qe);var ft=[-3,et,"InvalidScopeException",{[Ve]:We,[Je]:400},[Ve,Ke],[0,0]];Be.O.for(et).registerError(ft,ze);var ht=[-3,et,"SlowDownException",{[Ve]:We,[Je]:400},[Ve,Ke],[0,0]];Be.O.for(et).registerError(ht,Fe);var yt=[-3,et,"UnauthorizedClientException",{[Ve]:We,[Je]:400},[Ve,Ke],[0,0]];Be.O.for(et).registerError(yt,Ge);var bt=[-3,et,"UnsupportedGrantTypeException",{[Ve]:We,[Je]:400},[Ve,Ke],[0,0]];Be.O.for(et).registerError(bt,He);var St=[-3,Xe,"SSOOIDCServiceException",0,[],[]];Be.O.for(Xe).registerError(St,_e);var Ct=[9,et,"CreateToken",{[Ze]:["POST","/token",200]},()=>ct,()=>ut];class wt extends(Oe.u.classBuilder().ep(E).m(function(e,t,n,r){return[(0,g.rD)(n,e.getEndpointParameterInstructions())]}).s("AWSSSOOIDCService","CreateToken",{}).n("SSOOIDCClient","CreateTokenCommand").sc(Ct).build()){}},939:(e,t,n)=>{n.d(t,{fromSSO:()=>R});var r=n(6479),s=n(7060),i=n(5135),o=n(8623),a=n(5578),c=n(8841);const u=e=>Object.entries(e).filter(([e])=>e.startsWith(a.I.SSO_SESSION+c.Q)).reduce((e,[t,n])=>({...e,[t.substring(t.indexOf(c.Q)+1)]:n}),{});var l=n(6845),d=n(8380);const p=()=>({}),m=async(e={})=>(0,d.TA)(e.configFilepath??(0,o.g)()).then(l.A).then(u).catch(p);var g=n(244),f=n(2023);class h extends f.m{name="TokenProviderError";constructor(e,t=!0){super(e,t),Object.setPrototypeOf(this,h.prototype)}}var y=n(2334);const b="To refresh this SSO session run 'aws sso login' with the corresponding profile.",S=e=>{if(e.expiration&&e.expiration.getTime()<Date.now())throw new h(`Token is expired. ${b}`,!1)},C=(e,t,n=!1)=>{if(void 0===t)throw new h(`Value not present for '${e}' in SSO Token${n?". Cannot refresh":""}. ${b}`,!1)};var w=n(7405),k=n(9896);const{writeFile:E}=k.promises,v=new Date(0),x=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/token-providers - fromSso");const r=await(0,i.Y)(e),o=(0,s.Bz)({profile:e.profile??t?.profile}),a=r[o];if(!a)throw new h(`Profile '${o}' could not be found in shared credentials file.`,!1);if(!a.sso_session)throw new h(`Profile '${o}' is missing required property 'sso_session'.`);const c=a.sso_session,u=(await m(e))[c];if(!u)throw new h(`Sso session '${c}' could not be found in shared credentials file.`,!1);for(const e of["sso_start_url","sso_region"])if(!u[e])throw new h(`Sso session '${c}' is missing required property '${e}'.`,!1);u.sso_start_url;const l=u.sso_region;let d;try{d=await(0,y.v)(c)}catch(e){throw new h(`The SSO session token associated with profile=${o} was not found or is invalid. ${b}`,!1)}C("accessToken",d.accessToken),C("expiresAt",d.expiresAt);const{accessToken:p,expiresAt:g}=d,f={token:p,expiration:new Date(g)};if(f.expiration.getTime()-Date.now()>3e5)return f;if(Date.now()-v.getTime()<3e4)return S(f),f;C("clientId",d.clientId,!0),C("clientSecret",d.clientSecret,!0),C("refreshToken",d.refreshToken,!0);try{v.setTime(Date.now());const r=await(async(e,t,r={},s)=>{const{CreateTokenCommand:i}=await Promise.resolve().then(n.bind(n,909)),o=await(async(e,t={},r)=>{const{SSOOIDCClient:s}=await Promise.resolve().then(n.bind(n,909)),i=e=>t.clientConfig?.[e]??t.parentClientConfig?.[e]??r?.[e];return new s(Object.assign({},t.clientConfig??{},{region:e??t.clientConfig?.region,logger:i("logger"),userAgentAppId:i("userAgentAppId")}))})(t,r,s);return o.send(new i({clientId:e.clientId,clientSecret:e.clientSecret,refreshToken:e.refreshToken,grantType:"refresh_token"}))})(d,l,e,t);C("accessToken",r.accessToken),C("expiresIn",r.expiresIn);const s=new Date(Date.now()+1e3*r.expiresIn);try{await((e,t)=>{const n=(0,w.C)(e),r=JSON.stringify(t,null,2);return E(n,r)})(c,{...d,accessToken:r.accessToken,expiresAt:s.toISOString(),refreshToken:r.refreshToken})}catch(e){}return{token:r.accessToken,expiration:s}}catch(e){return S(f),f}},A=!1,P=async({ssoStartUrl:e,ssoSession:t,ssoAccountId:s,ssoRegion:i,ssoRoleName:o,ssoClient:a,clientConfig:c,parentClientConfig:u,callerClientConfig:l,profile:d,filepath:p,configFilepath:m,ignoreCache:f,logger:h})=>{let b;const S="To refresh this SSO session run aws sso login with the corresponding profile.";if(t)try{const e=await x({profile:d,filepath:p,configFilepath:m,ignoreCache:f})();b={accessToken:e.token,expiresAt:new Date(e.expiration).toISOString()}}catch(e){throw new r.C(e.message,{tryNextLink:A,logger:h})}else try{b=await(0,y.v)(e)}catch(e){throw new r.C(`The SSO session associated with this profile is invalid. ${S}`,{tryNextLink:A,logger:h})}if(new Date(b.expiresAt).getTime()-Date.now()<=0)throw new r.C(`The SSO session associated with this profile has expired. ${S}`,{tryNextLink:A,logger:h});const{accessToken:C}=b,{SSOClient:w,GetRoleCredentialsCommand:k}=await Promise.resolve().then(n.bind(n,8463)),E=a||new w(Object.assign({},c??{},{logger:c?.logger??l?.logger??u?.logger,region:c?.region??i,userAgentAppId:c?.userAgentAppId??l?.userAgentAppId??u?.userAgentAppId}));let v;try{v=await E.send(new k({accountId:s,roleName:o,accessToken:C}))}catch(e){throw new r.C(e,{tryNextLink:A,logger:h})}const{roleCredentials:{accessKeyId:P,secretAccessKey:R,sessionToken:T,expiration:I,credentialScope:O,accountId:B}={}}=v;if(!(P&&R&&T&&I))throw new r.C("SSO returns an invalid temporary credential.",{tryNextLink:A,logger:h});const D={accessKeyId:P,secretAccessKey:R,sessionToken:T,expiration:new Date(I),...O&&{credentialScope:O},...B&&{accountId:B}};return t?(0,g.g)(D,"CREDENTIALS_SSO","s"):(0,g.g)(D,"CREDENTIALS_SSO_LEGACY","u"),D},R=(e={})=>async({callerClientConfig:t}={})=>{e.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");const{ssoStartUrl:n,ssoAccountId:o,ssoRegion:a,ssoRoleName:c,ssoSession:u}=e,{ssoClient:l}=e,d=(0,s.Bz)({profile:e.profile??t?.profile});if(n||o||a||c||u){if(n&&o&&a&&c)return P({ssoStartUrl:n,ssoSession:u,ssoAccountId:o,ssoRegion:a,ssoRoleName:c,ssoClient:l,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:d,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger});throw new r.C('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"',{tryNextLink:!1,logger:e.logger})}{const t=(await(0,i.Y)(e))[d];if(!t)throw new r.C(`Profile ${d} was not found.`,{logger:e.logger});if(!(p=t)||"string"!=typeof p.sso_start_url&&"string"!=typeof p.sso_account_id&&"string"!=typeof p.sso_session&&"string"!=typeof p.sso_region&&"string"!=typeof p.sso_role_name)throw new r.C(`Profile ${d} is not configured with SSO credentials.`,{logger:e.logger});if(t?.sso_session){const s=(await m(e))[t.sso_session],i=` configurations in profile ${d} and sso-session ${t.sso_session}`;if(a&&a!==s.sso_region)throw new r.C("Conflicting SSO region"+i,{tryNextLink:!1,logger:e.logger});if(n&&n!==s.sso_start_url)throw new r.C("Conflicting SSO start_url"+i,{tryNextLink:!1,logger:e.logger});t.sso_region=s.sso_region,t.sso_start_url=s.sso_start_url}const{sso_start_url:s,sso_account_id:o,sso_region:c,sso_role_name:u,sso_session:g}=((e,t)=>{const{sso_start_url:n,sso_account_id:s,sso_region:i,sso_role_name:o}=e;if(!(n&&s&&i&&o))throw new r.C(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(e).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`,{tryNextLink:!1,logger:t});return e})(t,e.logger);return P({ssoStartUrl:s,ssoSession:g,ssoAccountId:o,ssoRegion:c,ssoRoleName:u,ssoClient:l,clientConfig:e.clientConfig,parentClientConfig:e.parentClientConfig,callerClientConfig:e.callerClientConfig,profile:d,filepath:e.filepath,configFilepath:e.configFilepath,ignoreCache:e.ignoreCache,logger:e.logger})}var p}},947:(e,t,n)=>{n.d(t,{m:()=>r});const r={}},971:(e,t,n)=>{n.d(t,{I:()=>s});let r=!1;const s=e=>{e&&!r&&parseInt(e.substring(1,e.indexOf(".")))<16&&(r=!0)}},1066:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(2334),s=n(8380);const i={getFileRecord:()=>s.Jj,interceptFile(e,t){s.Jj[e]=Promise.resolve(t)},getTokenRecord:()=>r.a,interceptToken(e,t){r.a[e]=t}}},1095:(e,t,n)=>{n.d(t,{OV:()=>s,TC:()=>o});var r=n(7090);function s(e){return e}const i={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},o=e=>({applyToStack:t=>{t.add((e=>t=>async n=>{if(!r.K.isInstance(n.request))return t(n);const{request:s}=n,{handlerProtocol:i=""}=e.requestHandler.metadata||{};if(i.indexOf("h2")>=0&&!s.headers[":authority"])delete s.headers.host,s.headers[":authority"]=s.hostname+(s.port?":"+s.port:"");else if(!s.headers.host){let e=s.hostname;null!=s.port&&(e+=`:${s.port}`),s.headers.host=e}return t(n)})(e),i)}})},1109:(e,t,n)=>{n.d(t,{K:()=>s});var r=n(7959);class s{config;middlewareStack=(0,r.o)();initConfig;handlers;constructor(e){this.config=e;const{protocol:t,protocolSettings:n}=e;n&&"function"==typeof t&&(e.protocol=new t(n))}send(e,t,n){const r="function"!=typeof t?t:void 0,s="function"==typeof t?t:n;let i;if(void 0===r&&!0===this.config.cacheMiddleware){this.handlers||(this.handlers=new WeakMap);const t=this.handlers;t.has(e.constructor)?i=t.get(e.constructor):(i=e.resolveMiddleware(this.middlewareStack,this.config,r),t.set(e.constructor,i))}else delete this.handlers,i=e.resolveMiddleware(this.middlewareStack,this.config,r);if(!s)return i(e).then(e=>e.output);i(e).then(e=>s(null,e.output),e=>s(e)).catch(()=>{})}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}},1295:(e,t,n)=>{n.d(t,{l:()=>c,Q:()=>a});var r=n(7090),s=n(2238);const i=e=>e=>{throw e},o=(e,t)=>{},a={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},c=e=>({applyToStack:e=>{e.addRelativeTo((e,t)=>async n=>{if(!r.K.isInstance(n.request))return e(n);const a=(0,s.u)(t).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:c={}},identity:u,signer:l}=a,d=await e({...n,request:await l.sign(n.request,u,c)}).catch((l.errorHandler||i)(c));return(l.successHandler||o)(d.response,c),d},a)}})},1407:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.trackFileTimestamps=async function(e){for(const t of e)try{const e=await(0,i.stat)(t.filename),n={filename:t.filename,birthtime:e.birthtime,mtime:e.mtime,ctime:e.ctime};o||(o=!0,s.worker_logger.info("First instrumented file timestamps",{filename:n.filename,birthtime:n.birthtime.toISOString(),mtime:n.mtime.toISOString(),ctime:n.ctime.toISOString()})),(!a||n.birthtime>a.birthtime)&&(a=n),(!c||n.mtime>c.mtime)&&(c=n),(!u||n.ctime>u.ctime)&&(u=n),l||(l=!0,setTimeout(()=>{try{a&&s.worker_logger.info("Newest file by creation time (birthtime)",{filename:a.filename,birthtime:a.birthtime.toISOString(),mtime:a.mtime.toISOString(),ctime:a.ctime.toISOString()}),c&&s.worker_logger.info("Newest file by modification time (mtime)",{filename:c.filename,birthtime:c.birthtime.toISOString(),mtime:c.mtime.toISOString(),ctime:c.ctime.toISOString()}),u&&s.worker_logger.info("Newest file by change time (ctime)",{filename:u.filename,birthtime:u.birthtime.toISOString(),mtime:u.mtime.toISOString(),ctime:u.