PageSourceSearch

https://ccported.onrender.com/_app/immutable/chunks/BX89j6Ey.js

js ccported.onrender.com collected 2026-10-03 11:39:48 UTC 338,280 bytes, 36 lines download raw bytes

1import{p as zh}from"./CxSO0-5B.js";import"./DrYIpLXy.js";import{_ as $u}from"./D9Z9MdNV.js";const qh=!0,Uu=qh;let xs=[{hostname:"ccported.github.io",acode:"e/4/500442-526a-41af-9981-22db9286cd37.js"},{hostname:"ccported.click",acode:"5/2/0ff0b7-11f3-4bd8-b154-cfeed8597df1.js"}];function Vh(e){xs=e}const za=[{name:"Charlie",hostname:"ccgstatic.com",path:"/games/",priority:1,protocol:"https"},{name:"Bell",hostname:"ccportedgames.s3.us-west-2.amazonaws.com",path:"/",priority:6,protocol:"https"},{name:"Olympic",hostname:"d1yh00vn2fvto7.cloudfront.net",path:"/games/",priority:3,protocol:"https"},{name:"Shafiyoon",hostname:"d1cp3xh9gda0oe.cloudfront.net",path:"/games/",priority:4,protocol:"https"},{name:"Racecar",hostname:"d1vqjbyryjpk97.cloudfront.net",path:"/games/",priority:5,protocol:"https"},{name:"Ellay",hostname:"ccported.click",path:"/games/",priority:2,protocol:"https"}],Lu=async()=>{try{const e=typeof window<"u"&&window.isSecureContext,t="/servers.txt",n="https://z67jfipy20.execute-api.us-west-2.amazonaws.com/prod/servers",s=[fetch(t).catch(()=>null)],[r,i]=await Promise.all(s);let o=[];if(r&&r.ok){const d=(await r.text()).split(`
2`).map(u=>u.trim()).filter(u=>u.length>0).map((u,h)=>{if(u.startsWith("#"))return null;const p=u.split(",").map(y=>y.trim());return p.length<3?null:{name:p[1],hostname:p[0],path:p[2],priority:h+1,protocol:"https"}}).filter(u=>u!==null);o=o.concat(d)}if(i&&i.ok){const d=(await i.text()).split(`
3`).map(u=>u.trim()).filter(u=>u.length>0).map((u,h)=>{if(u.startsWith("#")||!u.startsWith("<GAMES>"))return null;const p=u.split(/\s+/);return p.length<4?null:{name:p[2],hostname:p[1],path:p[3],priority:h+1,protocol:"http"}}).filter(u=>u!==null);o=o.concat(d)}return o.length===0?null:o}catch{return null}},Wh=async()=>{const e=typeof window<"u"?`${window.location.origin}/ahosts.txt`:"https://ccgstatic.com/ahosts.txt",t=await fetch(e);return t.ok?(await t.text()).split(`
4`).map(i=>i.trim()).filter(i=>i.length>0).map(i=>{const o=i.split(",").map(a=>a.trim());return{hostname:o[0],acode:o[1]}}):xs},Oi=e=>({setHttpHandler(t){e.httpHandler=t},httpHandler(){return e.httpHandler},updateHttpClientConfig(t,n){e.httpHandler?.updateHttpClientConfig(t,n)},httpHandlerConfigs(){return e.httpHandler.httpHandlerConfigs()}}),Bi=e=>({httpHandler:e.httpHandler()});var Bn;(function(e){e.HTTP="http",e.HTTPS="https"})(Bn||(Bn={}));var _s;(function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"})(_s||(_s={}));const di="__smithy_context";class ve{constructor(t){this.method=t.method||"GET",this.hostname=t.hostname||"localhost",this.port=t.port,this.query=t.query||{},this.headers=t.headers||{},this.body=t.body,this.protocol=t.protocol?t.protocol.slice(-1)!==":"?`${t.protocol}:`:t.protocol:"https:",this.path=t.path?t.path.charAt(0)!=="/"?`/${t.path}`:t.path:"/",this.username=t.username,this.password=t.password,this.fragment=t.fragment}static clone(t){const n=new ve({...t,headers:{...t.headers}});return n.query&&(n.query=Kh(n.query)),n}static isInstance(t){if(!t)return!1;const n=t;return"method"in n&&"protocol"in n&&"hostname"in n&&"path"in n&&typeof n.query=="object"&&typeof n.headers=="object"}clone(){return ve.clone(this)}}function Kh(e){return Object.keys(e).reduce((t,n)=>{const s=e[n];return{...t,[n]:Array.isArray(s)?[...s]:s}},{})}class an{constructor(t){this.statusCode=t.statusCode,this.reason=t.reason,this.headers=t.headers||{},this.body=t.body}static isInstance(t){if(!t)return!1;const n=t;return typeof n.statusCode=="number"&&typeof n.headers=="object"}}const Gh=e=>t=>async n=>{if(!ve.isInstance(n.request))return t(n);const{request:s}=n,{handlerProtocol:r=""}=e.requestHandler.metadata||{};if(r.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 i=s.hostname;s.port!=null&&(i+=`:${s.port}`),s.headers.host=i}return t(n)},Jh={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},Mi=e=>({applyToStack:t=>{t.add(Gh(e),Jh)}}),Zh=()=>(e,t)=>async n=>{try{const s=await e(n),{clientName:r,commandName:i,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c,overrideOutputFilterSensitiveLog:d}=a,u=c??t.inputFilterSensitiveLog,h=d??t.outputFilterSensitiveLog,{$metadata:p,...y}=s.output;return o?.info?.({clientName:r,commandName:i,input:u(n.input),output:h(y),metadata:p}),s}catch(s){const{clientName:r,commandName:i,logger:o,dynamoDbDocumentClientOptions:a={}}=t,{overrideInputFilterSensitiveLog:c}=a,d=c??t.inputFilterSensitiveLog;throw o?.error?.({clientName:r,commandName:i,input:d(n.input),error:s,metadata:s.$metadata}),s}},Xh={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},Di=e=>({applyToStack:t=>{t.add(Zh(),Xh)}});var qa={};const Xs="X-Amzn-Trace-Id",Yh="AWS_LAMBDA_FUNCTION_NAME",Qh="_X_AMZN_TRACE_ID",ef=e=>t=>async n=>{const{request:s}=n;if(!ve.isInstance(s)||e.runtime!=="node")return t(n);const r=Object.keys(s.headers??{}).find(c=>c.toLowerCase()===Xs.toLowerCase())??Xs;if(s.headers.hasOwnProperty(r))return t(n);const i=qa[Yh],o=qa[Qh],a=c=>typeof c=="string"&&c.length>0;return a(i)&&a(o)&&(s.headers[Xs]=o),t({...n,request:s})}
4,tf={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},Fi=e=>({applyToStack:t=>{t.add(ef(e),tf)}}),kt=e=>e[di]||(e[di]={}),Me=e=>{if(typeof e=="function")return e;const t=Promise.resolve(e);return()=>t},nf=(e,t)=>{if(!t||t.length===0)return e;const n=[];for(const s of t)for(const r of e)r.schemeId.split("#")[1]===s&&n.push(r);for(const s of e)n.find(({schemeId:r})=>r===s.schemeId)||n.push(s);return n};function sf(e){const t=new Map;for(const n of e)t.set(n.schemeId,n);return t}const rf=(e,t)=>(n,s)=>async r=>{const i=e.httpAuthSchemeProvider(await t.httpAuthSchemeParametersProvider(e,s,r.input)),o=e.authSchemePreference?await e.authSchemePreference():[],a=nf(i,o),c=sf(e.httpAuthSchemes),d=kt(s),u=[];for(const h of a){const p=c.get(h.schemeId);if(!p){u.push(`HttpAuthScheme \`${h.schemeId}\` was not enabled for this service.`);continue}const y=p.identityProvider(await t.identityProviderConfigProvider(e));if(!y){u.push(`HttpAuthScheme \`${h.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:x={},signingProperties:A={}}=h.propertiesExtractor?.(e,s)||{};h.identityProperties=Object.assign(h.identityProperties||{},x),h.signingProperties=Object.assign(h.signingProperties||{},A),d.selectedHttpAuthScheme={httpAuthOption:h,identity:await y(h.identityProperties),signer:p.signer};break}if(!d.selectedHttpAuthScheme)throw new Error(u.join(`
5`));return n(r)},of={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},$i=(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n})=>({applyToStack:s=>{s.addRelativeTo(rf(e,{httpAuthSchemeParametersProvider:t,identityProviderConfigProvider:n}),of)}}),af=(e,t)=>(n,s)=>async r=>{const{response:i}=await n(r);try{const o=await t(i,e);return{response:i,output:o}}catch(o){if(Object.defineProperty(o,"$response",{value:i}),!("$metadata"in o)){const a="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{o.message+=`
6  `+a}catch{!s.logger||s.logger?.constructor?.name==="NoOpLogger"?console.warn(a):s.logger?.warn?.(a)}typeof o.$responseBodyText<"u"&&o.$response&&(o.$response.body=o.$responseBodyText);try{if(an.isInstance(i)){const{headers:c={}}=i,d=Object.entries(c);o.$metadata={httpStatusCode:i.statusCode,requestId:Ys(/^x-[\w-]+-request-?id$/,d),extendedRequestId:Ys(/^x-[\w-]+-id-2$/,d),cfId:Ys(/^x-[\w-]+-cf-id$/,d)}}}catch{}}throw o}},Ys=(e,t)=>(t.find(([n])=>n.match(e))||[void 0,void 0])[1],cf=(e,t)=>(n,s)=>async r=>{const i=e,o=s.endpointV2?.url&&i.urlParser?async()=>i.urlParser(s.endpointV2.url):i.endpoint;if(!o)throw new Error("No valid endpoint provider available.");const a=await t(r.input,{...e,endpoint:o});return n({...r,request:a})},df={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ju={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function Ui(e,t,n){return{applyToStack:s=>{s.add(af(e,n),df),s.add(cf(e,t),ju)}}}const uf=e=>t=>{throw t},lf=(e,t)=>{},hf=e=>(t,n)=>async s=>{if(!ve.isInstance(s.request))return t(s);const i=kt(n).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:o={}},identity:a,signer:c}=i,d=await t({...s,request:await c.sign(s.request,a,o)}).catch((c.errorHandler||uf)(o));return(c.successHandler||lf)(d.response,o),d},Hu={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},Li=e=>({applyToStack:t=>{t.addRelativeTo(hf(),Hu)}}),Qt=e=>{if(typeof e=="function")return e;const t=Promise.resolve(e);return()=>t},Ct={},yn=new Array(64);for(let e=0,t=65,n=90;e+t<=n;e++){const s=String.fromCharCode(e+t);Ct[s]=e,yn[e]=s}for(let e=0,t=97,n=122;e+t<=n;e++){const s=String.fromCharCode(e+t),r=e+26;Ct[s]=r,yn[r]=s}for(let e=0;e<10;e++){Ct[e.toString(10)]=e+52;const t=e.toString(10),n=e+52;Ct[t]=n,yn[n]=t}Ct["+"]=62;yn[62]="+";Ct["/"]=63;yn[63]="/";const en=6,kn=8,ff=63,Un=e=>{let t=e.length/4*3;e.slice(-2)==="=="?t-=2:e.slice(-1)==="="&&t--;const n=new ArrayBuffer(t),s=new DataView(n);for(let r=0;r<e.length;r+=4){let i=0,o=0;for(let d=r,u=r+3;d<=u;d++)if(e[d]!=="="){if(!(e[d]in Ct))throw new TypeError(`Invalid character ${e[d]} in base64 string.`);i|=Ct[e[d]]<<(u-d)*en,o+=en}else i>>=en;const a=r/4*3;i>>=o%kn;const c=Math.floor(o/kn);for(let d=0;d<c;d++){const u=(c-d-1)*kn;s.setUint8(a+d,(i&255<<u)>>u)}}return new Uint8Array(n)},pt=e=>new TextEncoder().encode(e),Mn=e=>typeof e=="string"?pt(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e),wn=e=>{if(typeof e=="string")return e;if(typeof e!="object"||typeof e.byteOffset!="number"||typeof e.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function Ln(e){let t;typeof e=="string"?t=pt(e):t=e;const n=typeof t=="object"&&typeof t.length=="number",s=typeof t=="object"&&typeof t.byteOffset=="number"&&typeof t.byteLength=="number";if(!n&&!s)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let r="";for(let i=0;i<t.length;i+=3){let o=0,a=0;for(let d=i,u=Math.min(i+3,t.length);d<u;
6d++)o|=t[d]<<(u-d-1)*kn,a+=kn;const c=Math.ceil(a/en);o<<=c*en-a;for(let d=1;d<=c;d++){const u=(c-d)*en;r+=yn[(o&ff<<u)>>u]}r+="==".slice(0,4-c)}return r}function pf(e,t="utf-8"){return t==="base64"?Ln(e):wn(e)}function gf(e,t){return t==="base64"?Lt.mutate(Un(e)):Lt.mutate(pt(e))}class Lt extends Uint8Array{static fromString(t,n="utf-8"){switch(typeof t){case"string":return gf(t,n);default:throw new Error(`Unsupported conversion from ${typeof t} to Uint8ArrayBlobAdapter.`)}}static mutate(t){return Object.setPrototypeOf(t,Lt.prototype),t}transformToString(t="utf-8"){return pf(this,t)}}const Va=e=>typeof ReadableStream=="function"&&(e?.constructor?.name===ReadableStream.name||e instanceof ReadableStream),mf=(e,t)=>{const{base64Encoder:n,bodyLengthChecker:s,checksumAlgorithmFn:r,checksumLocationName:i,streamHasher:o}=t,a=n!==void 0&&s!==void 0&&r!==void 0&&i!==void 0&&o!==void 0,c=a?o(r,e):void 0,d=e.getReader();return new ReadableStream({async pull(u){const{value:h,done:p}=await d.read();if(p){if(u.enqueue(`0\r
7`),a){const y=n(await c);u.enqueue(`${i}:${y}\r
8`),u.enqueue(`\r
9`)}u.close()}else u.enqueue(`${(s(h)||0).toString(16)}\r
10${h}\r
11`)}})};async function yf(e,t){let n=0;const s=[],r=e.getReader();let i=!1;for(;!i;){const{done:c,value:d}=await r.read();if(d&&(s.push(d),n+=d?.byteLength??0),n>=t)break;i=c}r.releaseLock();const o=new Uint8Array(Math.min(t,n));let a=0;for(const c of s){if(c.byteLength>o.byteLength-a){o.set(c.subarray(0,o.byteLength-a),a);break}else o.set(c,a);a+=c.length}return o}const jt=e=>encodeURIComponent(e).replace(/[!'()*]/g,wf),wf=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function bf(e){const t=[];for(let n of Object.keys(e).sort()){const s=e[n];if(n=jt(n),Array.isArray(s))for(let r=0,i=s.length;r<i;r++)t.push(`${n}=${jt(s[r])}`);else{let r=n;(s||typeof s=="string")&&(r+=`=${jt(s)}`),t.push(r)}}return t.join("&")}function Wa(e,t){return new Request(e,t)}function Sf(e=0){return new Promise((t,n)=>{e&&setTimeout(()=>{const s=new Error(`Request did not complete within ${e} ms`);s.name="TimeoutError",n(s)},e)})}const Qs={supported:void 0};class jn{static create(t){return typeof t?.handle=="function"?t:new jn(t)}constructor(t){typeof t=="function"?this.configProvider=t().then(n=>n||{}):(this.config=t??{},this.configProvider=Promise.resolve(this.config)),Qs.supported===void 0&&(Qs.supported=typeof Request<"u"&&"keepalive"in Wa("https://[::1]"))}destroy(){}async handle(t,{abortSignal:n,requestTimeout:s}={}){this.config||(this.config=await this.configProvider);const r=s??this.config.requestTimeout,i=this.config.keepAlive===!0,o=this.config.credentials;if(n?.aborted){const P=new Error("Request aborted");return P.name="AbortError",Promise.reject(P)}let a=t.path;const c=bf(t.query||{});c&&(a+=`?${c}`),t.fragment&&(a+=`#${t.fragment}`);let d="";if(t.username!=null||t.password!=null){const P=t.username??"",Z=t.password??"";d=`${P}:${Z}@`}const{port:u,method:h}=t,p=`${t.protocol}//${d}${t.hostname}${u?`:${u}`:""}${a}`,y=h==="GET"||h==="HEAD"?void 0:t.body,x={body:y,headers:new Headers(t.headers),method:h,credentials:o};this.config?.cache&&(x.cache=this.config.cache),y&&(x.duplex="half"),typeof AbortController<"u"&&(x.signal=n),Qs.supported&&(x.keepalive=i),typeof this.config.requestInit=="function"&&Object.assign(x,this.config.requestInit(t));let A=()=>{};const _=Wa(p,x),T=[fetch(_).then(P=>{const Z=P.headers,G={};for(const Y of Z.entries())G[Y[0]]=Y[1];return P.body!=null?{response:new an({headers:G,reason:P.statusText,statusCode:P.status,body:P.body})}:P.blob().then(Y=>({response:new an({headers:G,reason:P.statusText,statusCode:P.status,body:Y})}))}),Sf(r)];return n&&T.push(new Promise((P,Z)=>{const G=()=>{const re=new Error("Request aborted");re.name="AbortError",Z(re)};if(typeof n.addEventListener=="function"){const re=n;re.addEventListener("abort",G,{once:!0}),A=()=>re.removeEventListener("abort",G)}else n.onabort=G})),Promise.race(T).finally(A)}updateHttpClientConfig(t,n){this.config=void 0,this.configProvider=this.configProvider.then(s=>(s[t]=n,s))}httpHandlerConfigs(){return this.config??{}}}const $s=async e=>typeof Blob=="function"&&e instanceof Blob||e.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await e.arrayBuffer()):Ef(e):xf(e);async function Ef(e){const t=await _f(e),n=Un(t);return new Uint8Array(n)}async function xf(e){const t=[],n=e.getReader();let s=!1,r=0;for(;!s;){const{done:a,value:c}=await n.read();c&&(t.push(c),r+=c.length),s=a}const i=new Uint8Array(r);let o=0;for(const a of t)i.set(a,o),o+=a.length;return i}function _f(e){return new Promise((t,n)=>{const s=new FileReader;s.onloadend=()=>
11{if(s.readyState!==2)return n(new Error("Reader aborted too early"));const r=s.result??"",i=r.indexOf(","),o=i>-1?i+1:r.length;t(r.substring(o))},s.onabort=()=>n(new Error("Read aborted")),s.onerror=()=>n(s.error),s.readAsDataURL(e)})}const zu={},ui={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),zu[e]=t,ui[t]=e}function qu(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){const s=e.slice(n,n+2).toLowerCase();if(s in ui)t[n/2]=ui[s];else throw new Error(`Cannot decode unrecognized sequence ${s} as hexadecimal`)}return t}function ze(e){let t="";for(let n=0;n<e.byteLength;n++)t+=zu[e[n]];return t}const Ka="The stream has already been transformed.",vf=e=>{if(!Ga(e)&&!Va(e)){const r=e?.__proto__?.constructor?.name||e;throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${r}`)}let t=!1;const n=async()=>{if(t)throw new Error(Ka);return t=!0,await $s(e)},s=r=>{if(typeof r.stream!="function")throw new Error(`Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.
12If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body`);return r.stream()};return Object.assign(e,{transformToByteArray:n,transformToString:async r=>{const i=await n();if(r==="base64")return Ln(i);if(r==="hex")return ze(i);if(r===void 0||r==="utf8"||r==="utf-8")return wn(i);if(typeof TextDecoder=="function")return new TextDecoder(r).decode(i);throw new Error("TextDecoder is not available, please make sure polyfill is provided.")},transformToWebStream:()=>{if(t)throw new Error(Ka);if(t=!0,Ga(e))return s(e);if(Va(e))return e;throw new Error(`Cannot transform payload to web stream, got ${e}`)}})},Ga=e=>typeof Blob=="function"&&e instanceof Blob;async function Af(e){return typeof e.stream=="function"&&(e=e.stream()),e.tee()}const Cf=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return Lt.mutate(e);if(!e)return Lt.mutate(new Uint8Array);const n=t.streamCollector(e);return Lt.mutate(await n)};function Ja(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}const Gn=e=>typeof e=="function"?e():e;class Us{constructor(t,n){this.name=t,this.traits=n}}class tn extends Us{constructor(t,n,s){super(t,n),this.name=t,this.traits=n,this.valueSchema=s,this.symbol=tn.symbol}static[Symbol.hasInstance](t){const n=tn.prototype.isPrototypeOf(t);return!n&&typeof t=="object"&&t!==null?t.symbol===tn.symbol:n}}tn.symbol=Symbol.for("@smithy/core/schema::ListSchema");class nn extends Us{constructor(t,n,s,r){super(t,n),this.name=t,this.traits=n,this.keySchema=s,this.valueSchema=r,this.symbol=nn.symbol}static[Symbol.hasInstance](t){const n=nn.prototype.isPrototypeOf(t);return!n&&typeof t=="object"&&t!==null?t.symbol===nn.symbol:n}}nn.symbol=Symbol.for("@smithy/core/schema::MapSchema");class sn extends Us{constructor(t,n,s,r){super(t,n),this.name=t,this.traits=n,this.memberNames=s,this.memberList=r,this.symbol=sn.symbol,this.members={};for(let i=0;i<s.length;++i)this.members[s[i]]=Array.isArray(r[i])?r[i]:[r[i],0]}static[Symbol.hasInstance](t){const n=sn.prototype.isPrototypeOf(t);return!n&&typeof t=="object"&&t!==null?t.symbol===sn.symbol:n}}sn.symbol=Symbol.for("@smithy/core/schema::StructureSchema");const he={BLOB:21,STREAMING_BLOB:42,BOOLEAN:2,STRING:0,NUMERIC:1,BIG_INTEGER:17,BIG_DECIMAL:19,DOCUMENT:15,TIMESTAMP_DEFAULT:4,TIMESTAMP_DATE_TIME:5,TIMESTAMP_HTTP_DATE:6,TIMESTAMP_EPOCH_SECONDS:7,LIST_MODIFIER:64,MAP_MODIFIER:128};class rn extends Us{constructor(t,n,s){super(t,s),this.name=t,this.schemaRef=n,this.traits=s,this.symbol=rn.symbol}static[Symbol.hasInstance](t){const n=rn.prototype.isPrototypeOf(t);return!n&&typeof t=="object"&&t!==null?t.symbol===rn.symbol:n}}rn.symbol=Symbol.for("@smithy/core/schema::SimpleSchema");class te{constructor(t,n){this.ref=t,this.memberName=n,this.symbol=te.symbol;const s=[];let r=t,i=t;for(this._isMemberSchema=!1;Array.isArray(r);)s.push(r[1]),r=r[0],i=Gn(r),this._isMemberSchema=!0;if(s.length>0){this.memberTraits={};for(let o=s.length-1;o>=0;--o){const a=s[o];
12Object.assign(this.memberTraits,te.translateTraits(a))}}else this.memberTraits=0;if(i instanceof te){this.name=i.name,this.traits=i.traits,this._isMemberSchema=i._isMemberSchema,this.schema=i.schema,this.memberTraits=Object.assign({},i.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.ref=i.ref,this.memberName=n??i.memberName;return}if(this.schema=Gn(i),this.schema&&typeof this.schema=="object"?this.traits=this.schema?.traits??{}:this.traits=0,this.name=(typeof this.schema=="object"?this.schema?.name:void 0)??this.memberName??this.getSchemaName(),this._isMemberSchema&&!n)throw new Error(`@smithy/core/schema - NormalizedSchema member schema ${this.getName(!0)} must initialize with memberName argument.`)}static[Symbol.hasInstance](t){const n=te.prototype.isPrototypeOf(t);return!n&&typeof t=="object"&&t!==null?t.symbol===te.symbol:n}static of(t,n){return t instanceof te?t:new te(t,n)}static translateTraits(t){if(typeof t=="object")return t;t=t|0;const n={};return(t&1)===1&&(n.httpLabel=1),(t>>1&1)===1&&(n.idempotent=1),(t>>2&1)===1&&(n.idempotencyToken=1),(t>>3&1)===1&&(n.sensitive=1),(t>>4&1)===1&&(n.httpPayload=1),(t>>5&1)===1&&(n.httpResponseCode=1),(t>>6&1)===1&&(n.httpQueryParams=1),n}static memberFrom(t,n){return t instanceof te?(t.memberName=n,t._isMemberSchema=!0,t):new te(t,n)}getSchema(){return this.schema instanceof te?this.schema=this.schema.getSchema():this.schema instanceof rn?Gn(this.schema.schemaRef):Gn(this.schema)}getName(t=!1){return!t&&this.name&&this.name.includes("#")?this.name.split("#")[1]:this.name||void 0}getMemberName(){if(!this.isMemberSchema())throw new Error(`@smithy/core/schema - cannot get member name on non-member schema: ${this.getName(!0)}`);return this.memberName}isMemberSchema(){return this._isMemberSchema}isUnitSchema(){return this.getSchema()==="unit"}isListSchema(){const t=this.getSchema();return typeof t=="number"?t>=he.LIST_MODIFIER&&t<he.MAP_MODIFIER:t instanceof tn}isMapSchema(){const t=this.getSchema();return typeof t=="number"?t>=he.MAP_MODIFIER&&t<=255:t instanceof nn}isDocumentSchema(){return this.getSchema()===he.DOCUMENT}isStructSchema(){const t=this.getSchema();return t!==null&&typeof t=="object"&&"members"in t||t instanceof sn}isBlobSchema(){return this.getSchema()===he.BLOB||this.getSchema()===he.STREAMING_BLOB}isTimestampSchema(){const t=this.getSchema();return typeof t=="number"&&t>=he.TIMESTAMP_DEFAULT&&t<=he.TIMESTAMP_EPOCH_SECONDS}isStringSchema(){return this.getSchema()===he.STRING}isBooleanSchema(){return this.getSchema()===he.BOOLEAN}isNumericSchema(){return this.getSchema()===he.NUMERIC}isBigIntegerSchema(){return this.getSchema()===he.BIG_INTEGER}isBigDecimalSchema(){return this.getSchema()===he.BIG_DECIMAL}isStreaming(){return this.getMergedTraits().streaming?!0:this.getSchema()===he.STREAMING_BLOB}isIdempotencyToken(){return typeof this.traits=="number"?(this.traits&4)===4:typeof this.traits=="object"?!!this.traits.idempotencyToken:!1}getMergedTraits(){return this.normalizedTraits?this.normalizedTraits:(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()},this.normalizedTraits)}getMemberTraits(){return te.translateTraits(this.memberTraits)}getOwnTraits(){return te.translateTraits(this.traits)}getKeySchema(){if(this.isDocumentSchema())return te.memberFrom([he.DOCUMENT,0],"key");if(!this.isMapSchema())throw new Error(`@smithy/core/schema - cannot get key schema for non-map schema: ${this.getName(!0)}`);const t=this.getSchema();return typeof t=="number"?te.memberFrom([63&t,0],"key"):te.memberFrom([t.keySchema,0],"key")}getValueSchema(){const t=this.getSchema();if(typeof t=="number"){if(this.isMapSchema())return te.memberFrom([63&t,0],"value");if(this.isListSchema())return te.memberFrom([63&t,0],"member")}if(t&&typeof t=="object"){if(this.isStructSchema())throw new Error(`cannot call getValueSchema() with StructureSchema ${this.getName(!0)}`);const n=t;if("valueSchema"in n){if(this.isMapSchema())return te.memberFrom([n.valueSchema,0],"value");if(this.isListSchema())return te.memberFrom([n.valueSchema,0],"member")}}if(this.isDocumentSchema())return te.memberFrom([he.DOCUMENT,0],"value");throw new Error(`@smithy/core/schema - the schema ${this.getName(!0)} does not have a value member.`)}
12hasMemberSchema(t){if(this.isStructSchema()){const n=this.getSchema();return t in n.members}return!1}getMemberSchema(t){if(this.isStructSchema()){const n=this.getSchema();if(!(t in n.members))throw new Error(`@smithy/core/schema - the schema ${this.getName(!0)} does not have a member with name=${t}.`);return te.memberFrom(n.members[t],t)}if(this.isDocumentSchema())return te.memberFrom([he.DOCUMENT,0],t);throw new Error(`@smithy/core/schema - the schema ${this.getName(!0)} does not have members.`)}getMemberSchemas(){const{schema:t}=this,n=t;if(!n||typeof n!="object")return{};if("members"in n){const s={};for(const r of n.memberNames)s[r]=this.getMemberSchema(r);return s}return{}}getEventStreamMember(){if(this.isStructSchema()){for(const[t,n]of this.structIterator())if(n.isStreaming()&&n.isStructSchema())return t}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot acquire structIterator on non-struct schema.");const t=this.getSchema();for(let n=0;n<t.memberNames.length;++n)yield[t.memberNames[n],te.memberFrom([t.memberList[n],0],t.memberNames[n])]}getSchemaName(){const t=this.getSchema();if(typeof t=="number"){const n=63&t,s=192&t,r=Object.entries(he).find(([,i])=>i===n)?.[0]??"Unknown";switch(s){case he.MAP_MODIFIER:return`${r}Map`;case he.LIST_MODIFIER:return`${r}List`;case 0:return r}}return"Unknown"}}te.symbol=Symbol.for("@smithy/core/schema::NormalizedSchema");const ji=e=>{switch(e){case"true":return!0;case"false":return!1;default:throw new Error(`Unable to parse boolean value "${e}"`)}},Jn=e=>{if(e!=null){if(typeof e=="number"){if((e===0||e===1)&&Rs.warn(Cs(`
12Expected boolean, got ${typeof e}: ${e}`)),e===0)return!1;if(e===1)return!0}if(typeof e=="string"){const t=e.toLowerCase();if((t==="false"||t==="true")&&Rs.warn(Cs(`Expected boolean, got ${typeof e}: ${e}`)),t==="false")return!1;if(t==="true")return!0}if(typeof e=="boolean")return e;throw new TypeError(`Expected boolean, got ${typeof e}: ${e}`)}},vs=e=>{if(e!=null){if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return String(t)!==String(e)&&Rs.warn(Cs(`Expected number but observed string: ${e}`)),t}if(typeof e=="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)}},Rf=Math.ceil(2**127*(2-2**-23)),Za=e=>{const t=vs(e);if(t!==void 0&&!Number.isNaN(t)&&t!==1/0&&t!==-1/0&&Math.abs(t)>Rf)throw new TypeError(`Expected 32-bit float, got ${e}`);return t},li=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)}},As=e=>Hi(e,32),Xa=e=>Hi(e,16),Ya=e=>Hi(e,8),Hi=(e,t)=>{const n=li(e);if(n!==void 0&&If(n,t)!==n)throw new TypeError(`Expected ${t}-bit integer, got ${e}`);return n},If=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},Hn=(e,t)=>{if(e==null)throw t?new TypeError(`Expected a non-null value for ${t}`):new TypeError("Expected a non-null value");return e},zi=e=>{if(e==null)return;if(typeof e=="object"&&!Array.isArray(e))return e;const t=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${t}: ${e}`)},J=e=>{if(e!=null){if(typeof e=="string")return e;if(["boolean","number","bigint"].includes(typeof e))return Rs.warn(Cs(`
12Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)}},kf=e=>{if(e==null)return;const t=zi(e),n=Object.entries(t).filter(([,s])=>s!=null).map(([s])=>s);if(n.length===0)throw new TypeError("Unions must have exactly one non-null member. None were found.");if(n.length>1)throw new TypeError(`Unions must have exactly one non-null member. Keys ${n} were not null.`);return t},Tf=e=>vs(typeof e=="string"?bn(e):e),Pf=e=>Za(typeof e=="string"?bn(e):e),Nf=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,bn=e=>{const t=e.match(Nf);if(t===null||t[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)},Ht=e=>typeof e=="string"?Of(e):vs(e),Of=e=>{switch(e){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error(`Unable to parse float value: ${e}`)}},Bf=e=>li(typeof e=="string"?bn(e):e),Qa=e=>As(typeof e=="string"?bn(e):e),Mf=e=>Xa(typeof e=="string"?bn(e):e),Df=e=>Ya(typeof e=="string"?bn(e):e),Cs=e=>String(new TypeError(e).stack||e).split(`
13`).slice(0,5).filter(t=>!t.includes("stackTraceWarning")).join(`
14`),Rs={warn:console.warn},Ff=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$f=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),qi=e=>{if(e==null)return;if(typeof e!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");const t=$f.exec(e);if(!t)throw new TypeError("Invalid RFC-3339 date-time value");const[n,s,r,i,o,a,c,d,u]=t,h=Mf(Vu(s)),p=Tn(r,"month",1,12),y=Tn(i,"day",1,31),x=Uf(h,p,y,{hours:o,minutes:a,seconds:c,fractionalMilliseconds:d});return u.toUpperCase()!="Z"&&x.setTime(x.getTime()-qf(u)),x},Gx=e=>{if(e==null)return;let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=Tf(e);else if(typeof e=="object"&&e.tag===1)t=e.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(t)||t===1/0||t===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(t*1e3))},Uf=(e,t,n,s)=>{const r=t-1;return jf(e,r,n),new Date(Date.UTC(e,r,n,Tn(s.hours,"hour",0,23),Tn(s.minutes,"minute",0,59),Tn(s.seconds,"seconds",0,60),zf(s.fractionalMilliseconds)))},Lf=[31,28,31,30,31,30,31,31,30,31,30,31],jf=(e,t,n)=>{let s=Lf[t];if(t===1&&Hf(e)&&(s=29),n>s)throw new TypeError(`Invalid day for ${Ff[t]} in ${e}: ${n}`)},Hf=e=>e%4===0&&(e%100!==0||e%400===0),Tn=(e,t,n,s)=>{const r=Df(Vu(e));if(r<n||r>s)throw new TypeError(`${t} must be between ${n} and ${s}, inclusive`);return r},zf=e=>e==null?0:Pf("0."+e)*1e3,qf=e=>{const t=e[0];let n=1;if(t=="+")n=1;else if(t=="-")n=-1;else throw new TypeError(`Offset direction, ${t}, must be "+" or "-"`);const s=Number(e.substring(1,3)),r=Number(e.substring(4,6));return n*(s*60+r)*60*1e3},Vu=e=>{let t=0;for(;t<e.length-1&&e.charAt(t)==="0";)t++;return t===0?e:e.slice(t)};function Vf(e){return(e.includes(",")||e.includes('"'))&&(e=`"${e.replace(/"/g,'\\"')}"`),e}const Wf=(e,t,n,s,r,i)=>{if(t!=null&&t[n]!==void 0){const o=s();if(o.length<=0)throw new Error("Empty value provided for input HTTP label: "+n+".");e=e.replace(r,i?o.split("/").map(a=>Ja(a)).join("/"):Ja(o))}else throw new Error("No value provided for input HTTP label: "+n+".");return e};function Wu(e,t){return new Kf(e,t)}class Kf{constructor(t,n){this.input=t,this.context=n,this.query={},this.method="",this.headers={},this.path="",this.body=null,this.hostname="",this.resolvePathStack=[]}async build(){const{hostname:t,protocol:n="https",port:s,path:r}=await this.context.endpoint();this.path=r;for(const i of this.resolvePathStack)i(this.path);return new ve({protocol:n,hostname:this.hostname||t,port:s,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(t){return this.hostname=t,this}bp(t){return this.resolvePathStack.push(n=>{this.path=`${n?.endsWith("/")?n.slice(0,-1):n||""}`+t}),this}p(t,n,s,r){return this.resolvePathStack.push(i=>{this.path=Wf(i,this.input,t,n,s,r)}),this}h(t){return this.headers=t,this}q(t){return this.query=t,this}b(t){return this.body=t,this}m(t){return this.method=t,this}}function Gf(e,t,n){e.__smithy_context?e.__smithy_context.features||(e.__smithy_context.features={}):e.__smithy_context={features:{}},e.__smithy_context.features[t]=n}class Vi{constructor(t){this.authSchemes=new Map;for(const[n,s]of Object.entries(t))s!==void 0&&this.authSchemes.set(n,s)}
14getIdentityProvider(t){return this.authSchemes.get(t)}}class Jf{async sign(t,n,s){return t}}const Zf=e=>t=>Ku(t)&&t.expiration.getTime()-Date.now()<e,Xf=3e5,Yf=Zf(Xf),Ku=e=>e.expiration!==void 0,Qf=(e,t,n)=>{if(e===void 0)return;const s=typeof e!="function"?async()=>Promise.resolve(e):e;let r,i,o,a=!1;const c=async d=>{i||(i=s(d));try{r=await i,o=!0,a=!1}finally{i=void 0}return r};return t===void 0?async d=>((!o||d?.forceRefresh)&&(r=await c(d)),r):async d=>((!o||d?.forceRefresh)&&(r=await c(d)),a?r:n(r)?(t(r)&&await c(d),r):(a=!0,r))},ep=void 0;function tp(e){return e===void 0?!0:typeof e=="string"&&e.length<=50}function Wi(e){const t=Qt(e.userAgentAppId??ep),{customUserAgent:n}=e;return Object.assign(e,{customUserAgent:typeof n=="string"?[[n]]:n,userAgentAppId:async()=>{const s=await t();if(!tp(s)){const r=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?console:e.logger;typeof s!="string"?r?.warn("userAgentAppId must be a string or undefined."):s.length>50&&r?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return s}})}let Ki=class{constructor({size:t,params:n}){this.data=new Map,this.parameters=[],this.capacity=t??50,n&&(this.parameters=n)}get(t,n){const s=this.hash(t);if(s===!1)return n();if(!this.data.has(s)){if(this.data.size>this.capacity+10){const r=this.data.keys();let i=0;for(;;){const{value:o,done:a}=r.next();if(this.data.delete(o),a||++i>10)break}}this.data.set(s,n())}return this.data.get(s)}size(){return this.data.size}hash(t){let n="";const{parameters:s}=this;if(s.length===0)return!1;for(const r of s){const i=String(t[r]??"");if(i.includes("|;"))return!1;n+=i+"|;"}return n}};const np=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),Gu=e=>np.test(e)||e.startsWith("[")&&e.endsWith("]"),sp=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),Gi=(e,t=!1)=>{if(!t)return sp.test(e);const n=e.split(".");for(const s of n)if(!Gi(s))return!1;return!0},cn={},Dn="endpoints";function Rt(e){return typeof e!="object"||e==null?e:"ref"in e?`$${Rt(e.ref)}`:"fn"in e?`${e.fn}(${(e.argv||[]).map(Rt).join(", ")})`:JSON.stringify(e,null,2)}class Ge extends Error{constructor(t){super(t),this.name="EndpointError"}}const rp=(e,t)=>e===t,ip=e=>{const t=e.split("."),n=[];for(const s of t){const r=s.indexOf("[");if(r!==-1){if(s.indexOf("]")!==s.length-1)throw new Ge(`Path: '${e}' does not end with ']'`);const i=s.slice(r+1,-1);if(Number.isNaN(parseInt(i)))throw new Ge(`Invalid array index: '${i}' in path: '${e}'`);r!==0&&n.push(s.slice(0,r)),n.push(i)}else n.push(s)}return n},Ju=(e,t)=>ip(t).reduce((n,s)=>{if(typeof n!="object")throw new Ge(`Index '${s}' in '${t}' not found in '${JSON.stringify(e)}'`);return Array.isArray(n)?n[parseInt(s)]:n[s]},e),op=e=>e!=null,ap=e=>!e,er={[Bn.HTTP]:80,[Bn.HTTPS]:443},cp=e=>{const t=(()=>{try{if(e instanceof URL)return e;if(typeof e=="object"&&"hostname"in e){const{hostname:p,port:y,protocol:x="",path:A="",query:_={}}=e,T=new URL(`${x}//${p}${y?`:${y}`:""}${A}`);return T.search=Object.entries(_).map(([P,Z])=>`${P}=${Z}`).join("&"),T}return new URL(e)}catch{return null}})();if(!t)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const n=t.href,{host:s,hostname:r,pathname:i,protocol:o,search:a}=t;if(a)return null;const c=o.slice(0,-1);if(!Object.values(Bn).includes(c))return null;const d=Gu(r),u=n.includes(`${s}:${er[c]}`)||typeof e=="string"&&e.includes(`${s}:${er[c]}`),h=`${s}${u?`:${er[c]}`:""}`;return{scheme:c,authority:h,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:d}},dp=(e,t)=>e===t,up=(e,t,n,s)=>t>=n||e.length<n?null:s?e.substring(e.length-n,e.length-t):e.substring(t,n),lp=e=>encodeURIComponent(e).replace(/[!*'()]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),hp={booleanEquals:rp,getAttr:Ju,isSet:op,isValidHostLabel:Gi,not:ap,parseURL:cp,stringEquals:dp,substring:up,uriEncode:lp},Zu=(e,t)=>{const n=[],s={...t.endpointParams,...t.referenceRecord};let r=0;for(;r<e.length;){const i=e.indexOf("{",r);if(i===-1){n.push(e.slice(r));break}n.push(e.slice(r,i));const o=e.indexOf("}",i);if(o===-1){n.push(e.slice(i));break}e[i+1]==="{"&&e[o+1]==="}"&&(n.push(e.slice(i+1,o)),r=o+2);const a=e.substring(i+1,o);if(a.includes("#")){const[c,d]=a.split("#");n.push(Ju(s[c],d))}else n.push(s[a]);r=o+1}return n.join("")},fp=({ref:e},t)=>({...t.endpointParams,...t.referenceRecord})[e],Ls=(e,t,n)=>{if(typeof e=="string")return Zu(e,n);if(e.fn)return Xu(e,n);if(e.ref)return fp(e,n);throw new Ge(`'${t}': ${String(e)} is not a string, function or reference.`)},Xu=({fn:e,argv:t},n)=>{const s=t.map(i=>["boolean","number"].includes(typeof i)?i:Ls(i,"arg",n)),r=e.split(".");return r[0]in cn&&r[1]!=null?cn[r[0]][r[1]](...s):hp[e](...s)},pp=({assign:e,...t},n)=>{if(e&&e in n.referenceRecord)throw new Ge(`'${e}' is already defined in Reference Record.`);const s=Xu(t,n);return n.logger?.debug?.(`${Dn} evaluateCondition: ${Rt(t)} = ${Rt(s)}`),{result:s===""?!0:!!s,...e!=null&&{toAssign:{name:e,value:s}}}},Ji=(e=[],t)=>{const n={};for(const s of e){const{result:r,toAssign:i}=pp(s,{...t,referenceRecord:{...t.referenceRecord,...n}});if(!r)return{result:r};i&&(n[i.name]=i.value,t.logger?.debug?.(`${Dn} assign: ${i.name} := ${Rt(i.value)}`))}return{result:!0,referenceRecord:n}},gp=(e,t)=>Object.entries(e).reduce((n,[s,r])=>({...n,[s]:r.map(i=>{const o=Ls(i,"Header value entry",t);if(typeof o!="string")throw new Ge(`Header '${s}' value '${o}' is not a string`);return o}
14)}),{}),Yu=(e,t)=>{if(Array.isArray(e))return e.map(n=>Yu(n,t));switch(typeof e){case"string":return Zu(e,t);case"object":if(e===null)throw new Ge(`Unexpected endpoint property: ${e}`);return Qu(e,t);case"boolean":return e;default:throw new Ge(`Unexpected endpoint property type: ${typeof e}`)}},Qu=(e,t)=>Object.entries(e).reduce((n,[s,r])=>({...n,[s]:Yu(r,t)}),{}),mp=(e,t)=>{const n=Ls(e,"Endpoint URL",t);if(typeof n=="string")try{return new URL(n)}catch(s){throw console.error(`Failed to construct URL with ${n}`,s),s}throw new Ge(`Endpoint URL must be a string, got ${typeof n}`)},yp=(e,t)=>{const{conditions:n,endpoint:s}=e,{result:r,referenceRecord:i}=Ji(n,t);if(!r)return;const o={...t,referenceRecord:{...t.referenceRecord,...i}},{url:a,properties:c,headers:d}=s;return t.logger?.debug?.(`${Dn} Resolving endpoint from template: ${Rt(s)}`),{...d!=null&&{headers:gp(d,o)},...c!=null&&{properties:Qu(c,o)},url:mp(a,o)}},wp=(e,t)=>{const{conditions:n,error:s}=e,{result:r,referenceRecord:i}=Ji(n,t);if(r)throw new Ge(Ls(s,"Error",{...t,referenceRecord:{...t.referenceRecord,...i}}))},bp=(e,t)=>{const{conditions:n,rules:s}=e,{result:r,referenceRecord:i}=Ji(n,t);if(r)return el(s,{...t,referenceRecord:{...t.referenceRecord,...i}})},el=(e,t)=>{for(const n of e)if(n.type==="endpoint"){const s=yp(n,t);if(s)return s}else if(n.type==="error")wp(n,t);else if(n.type==="tree"){const s=bp(n,t);if(s)return s}else throw new Ge(`Unknown endpoint rule: ${n}`);throw new Ge("Rules evaluation failed")},Zi=(e,t)=>{const{endpointParams:n,logger:s}=t,{parameters:r,rules:i}=e;t.logger?.debug?.(`${Dn} Initial EndpointParams: ${Rt(n)}`);const o=Object.entries(r).filter(([,d])=>d.default!=null).map(([d,u])=>[d,u.default]);if(o.length>0)for(const[d,u]of o)n[d]=n[d]??u;const a=Object.entries(r).filter(([,d])=>d.required).map(([d])=>d);for(const d of a)if(n[d]==null)throw new Ge(`Missing required parameter: '${d}'`);const c=el(i,{endpointParams:n,logger:s,referenceRecord:{}});return t.logger?.debug?.(`${Dn} Resolved endpoint: ${Rt(c)}`),c},tl=(e,t=!1)=>{if(t){for(const n of e.split("."))if(!tl(n))return!1;return!0}return!(!Gi(e)||e.length<3||e.length>63||e!==e.toLowerCase()||Gu(e))},ec=":",Sp="/",Ep=e=>{const t=e.split(ec);if(t.length<6)return null;const[n,s,r,i,o,...a]=t;if(n!=="arn"||s===""||r===""||a.join(ec)==="")return null;const c=a.map(d=>d.split(Sp)).flat();return{partition:s,service:r,region:i,accountId:o,resourceId:c}},xp=[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},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",supp
14ortsDualStack:!0,supportsFIPS:!0},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:!0,supportsFIPS:!0},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:!1,supportsFIPS:!0},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:!1,supportsFIPS:!0},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)"}}},{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:!1,supportsFIPS:!0},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:!1,supportsFIPS:!0},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:!0,supportsFIPS:!0},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)"}}}],_p={partitions:xp};let vp=_p;const Ap=e=>{const{partitions:t}=vp;for(const s of t){const{regions:r,outputs:i}=s;for(const[o,a]of Object.entries(r))if(o===e)return{...i,...a}}for(const s of t){const{regionRegex:r,outputs:i}=s;if(new RegExp(r).test(e))return{...i}}const n=t.find(s=>s.id==="aws");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}},js={isVirtualHostableS3Bucket:tl,parseArn:Ep,partition:Ap};cn.aws=js;function Cp(e){const t={};if(e=e.replace(/^\?/,""),e)for(const n of e.split("&")){let[s,r=null]=n.split("=");s=decodeURIComponent(s),r&&(r=decodeURIComponent(r)),s in t?Array.isArray(t[s])?t[s].push(r):t[s]=[t[s],r]:t[s]=r}return t}const dn=e=>{if(typeof e=="string")return dn(new URL(e));const{hostname:t,pathname:n,port:s,protocol:r,search:i}=e;let o;return i&&(o=Cp(i)),{hostname:t,port:s?parseInt(s):void 0,protocol:r,path:n,query:o}};function Rp(e,t,n){return e.$source||(e.$source={}),e.$source[t]=n,e}function et(e,t,n){e.__aws_sdk_context?e.__aws_sdk_context.features||(e.__aws_sdk_context.features={}):e.__aws_sdk_context={features:{}},e.__aws_sdk_context.features[t]=n}const tc=e=>an.isInstance(e)?e.headers?.date??e.headers?.Date:void 0,Xi=e=>new Date(Date.now()+e),Ip=(e,t)=>Math.abs(Xi(t).getTime()-e)>=3e5,nc=(e,t)=>{const n=Date.parse(e);return Ip(n,t)?n-Date.now():t},Pn=(e,t)=>{if(!t)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return t},nl=async e=>{const t=Pn("context",e.context),n=Pn("config",e.config),s=t.endpointV2?.properties?.authSchemes?.[0],i=await Pn("signer",n.signer)(s),o=e?.signingRegion,a=e?.signingRegionSet,c=e?.signingName;return{config:n,signer:i,signingRegion:o,signingRegionSet:a,signingName:c}};class Hs{async sign(t,n,s){if(!ve.isInstance(t))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const r=await nl(s),{config:i,signer:o}=r;let{signingRegion:a,signingName:c}=r;const d=s.context;if(d?.authSchemes?.length??!1){const[h,p]=d.authSchemes;h?.name==="sigv4a"&&p?.name==="sigv4"&&(a=p?.signingRegion??a,c=p?.signingName??c)}return await o.sign(t,{signingDate:Xi(i.systemClockOffset),signingRegion:a,signingService:c})}errorHandler(t){return n=>{const s=n.ServerTime??tc(n.$response);if(s){const r=Pn("config",t.config),i=r.systemClockOffset;r.systemClockOffset=nc(s,r.systemClockOffset),r.systemClockOffset!==i&&n.$metadata&&(n.$metadata.clockSkewCorrected=!0)}throw n}}successHandler(t,n){const s=tc(t);if(s){const r=Pn("config",n.config);r.systemClockOffset=nc(s,r.systemClockOffset)}}}class kp extends Hs{async sign(t,n,s){if(!ve.isInstance(t))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const{config:r,signer:i,signingRegion:o,signingRegionSet:a,signingName:c}=await nl(s),u=(await r.sigv4aSigningRegionSet?.()??a??[o]).join(",");return await i.sign(t,{signingDate:Xi(r.systemClockOffset),signingRegion:u,signingService:c})}}
14class Yi extends Error{constructor(t,n=!0){let s,r=!0;typeof n=="boolean"?(s=void 0,r=n):n!=null&&typeof n=="object"&&(s=n.logger,r=n.tryNextLink??!0),super(t),this.name="ProviderError",this.tryNextLink=r,Object.setPrototypeOf(this,Yi.prototype),s?.debug?.(`@smithy/property-provider ${r?"->":"(!)"} ${t}`)}static from(t,n=!0){return Object.assign(new this(t.message,n),t)}}class Sn extends Yi{constructor(t,n=!0){super(t,n),this.name="CredentialsProviderError",Object.setPrototypeOf(this,Sn.prototype)}}const Tp=(e,t,n)=>{let s,r,i,o=!1;const a=async()=>{r||(r=e());try{s=await r,i=!0,o=!1}finally{r=void 0}return s};return async c=>((!i||c?.forceRefresh)&&(s=await a()),s)},Pp=e=>(e.sigv4aSigningRegionSet=Qt(e.sigv4aSigningRegionSet),e),Np="X-Amz-Algorithm",Op="X-Amz-Credential",sl="X-Amz-Date",Bp="X-Amz-SignedHeaders",Mp="X-Amz-Expires",rl="X-Amz-Signature",il="X-Amz-Security-Token",ol="authorization",al=sl.toLowerCase(),Dp="date",Fp=[ol,al,Dp],$p=rl.toLowerCase(),hi="x-amz-content-sha256",Up=il.toLowerCase(),Lp={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},jp=/^proxy-/,Hp=/^sec-/,tr="AWS4-HMAC-SHA256",zp="AWS4-HMAC-SHA256-PAYLOAD",qp="UNSIGNED-PAYLOAD",Vp=50,cl="aws4_request",Wp=3600*24*7,Zn={},nr=[],sr=(e,t,n)=>`${e}/${t}/${n}/${cl}`,Kp=async(e,t,n,s,r)=>{const i=await sc(e,t.secretAccessKey,t.accessKeyId),o=`${n}:${s}:${r}:${ze(i)}:${t.sessionToken}`;if(o in Zn)return Zn[o];for(nr.push(o);nr.length>Vp;)delete Zn[nr.shift()];let a=`AWS4${t.secretAccessKey}`;for(const c of[n,s,r,cl])a=await sc(e,a,c);return Zn[o]=a},sc=(e,t,n)=>{const s=new e(t);return s.update(Mn(n)),s.digest()},rc=({headers:e},t,n)=>{const s={};for(const r of Object.keys(e).sort()){if(e[r]==null)continue;const i=r.toLowerCase();(i in Lp||t?.has(i)||jp.test(i)||Hp.test(i))&&(!n||n&&!n.has(i))||(s[i]=e[r].trim().replace(/\s+/g," "))}return s},Gp=e=>typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]",rr=async({headers:e,body:t},n)=>{for(const s of Object.keys(e))if(s.toLowerCase()===hi)return e[s];if(t==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof t=="string"||ArrayBuffer.isView(t)||Gp(t)){const s=new n;return s.update(Mn(t)),ze(await s.digest())}return qp};class Jp{format(t){const n=[];for(const i of Object.keys(t)){const o=pt(i);n.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(t[i]))}const s=new Uint8Array(n.reduce((i,o)=>i+o.byteLength,0));let r=0;for(const i of n)s.set(i,r),r+=i.byteLength;return s}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":const n=new DataView(new ArrayBuffer(3));return n.setUint8(0,3),n.setInt16(1,t.value,!1),new Uint8Array(n.buffer);case"integer":const s=new DataView(new ArrayBuffer(5));return s.setUint8(0,4),s.setInt32(1,t.value,!1),new Uint8Array(s.buffer);case"long":const r=new Uint8Array(9);return r[0]=5,r.set(t.value.bytes,1),r;case"binary":const i=new DataView(new ArrayBuffer(3+t.value.byteLength));i.setUint8(0,6),i.setUint16(1,t.value.byteLength,!1);const o=new Uint8Array(i.buffer);return o.set(t.value,3),o;case"string":const a=pt(t.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);const d=new Uint8Array(c.buffer);return d.set(a,3),d;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(Xp.fromNumber(t.value.valueOf()).bytes,1),u;case"uuid":if(!Zp.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);const h=new Uint8Array(17);return h[0]=9,h.set(qu(t.value.replace(/\-/g,"")),1),h}}}var ic;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(ic||(ic={}));const Zp=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;let Xp=class dl{constructor(t){if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const n=new Uint8Array(8);
14for(let s=7,r=Math.abs(Math.round(t));s>-1&&r>0;s--,r/=256)n[s]=r;return t<0&&oc(n),new dl(n)}valueOf(){const t=this.bytes.slice(0),n=t[0]&128;return n&&oc(t),parseInt(ze(t),16)*(n?-1:1)}toString(){return String(this.valueOf())}};function oc(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}const Yp=(e,t)=>{e=e.toLowerCase();for(const n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1},Qp=(e,t={})=>{const{headers:n,query:s={}}=ve.clone(e);for(const r of Object.keys(n)){const i=r.toLowerCase();(i.slice(0,6)==="x-amz-"&&!t.unhoistableHeaders?.has(i)||t.hoistableHeaders?.has(i))&&(s[r]=n[r],delete n[r])}return{...e,headers:n,query:s}},ac=e=>{e=ve.clone(e);for(const t of Object.keys(e.headers))Fp.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e},eg=({query:e={}})=>{const t=[],n={};for(const s of Object.keys(e)){if(s.toLowerCase()===$p)continue;const r=jt(s);t.push(r);const i=e[s];typeof i=="string"?n[r]=`${r}=${jt(i)}`:Array.isArray(i)&&(n[r]=i.slice(0).reduce((o,a)=>o.concat([`${r}=${jt(a)}`]),[]).sort().join("&"))}return t.sort().map(s=>n[s]).filter(s=>s).join("&")},tg=e=>ng(e).toISOString().replace(/\.\d{3}Z$/,"Z"),ng=e=>typeof e=="number"?new Date(e*1e3):typeof e=="string"?Number(e)?new Date(Number(e)*1e3):new Date(e):e;class sg{constructor({applyChecksum:t,credentials:n,region:s,service:r,sha256:i,uriEscapePath:o=!0}){this.service=r,this.sha256=i,this.uriEscapePath=o,this.applyChecksum=typeof t=="boolean"?t:!0,this.regionProvider=Me(s),this.credentialProvider=Me(n)}createCanonicalRequest(t,n,s){const r=Object.keys(n).sort();return`${t.method}
15${this.getCanonicalPath(t)}
16${eg(t)}
17${r.map(i=>`${i}:${n[i]}`).join(`
18`)}
19
20${r.join(";")}
21${s}`}async createStringToSign(t,n,s,r){const i=new this.sha256;i.update(Mn(s));const o=await i.digest();return`${r}
22${t}
23${n}
24${ze(o)}`}getCanonicalPath({path:t}){if(this.uriEscapePath){const n=[];for(const i of t.split("/"))i?.length!==0&&i!=="."&&(i===".."?n.pop():n.push(i));const s=`${t?.startsWith("/")?"/":""}${n.join("/")}${n.length>0&&t?.endsWith("/")?"/":""}`;return jt(s).replace(/%2F/g,"/")}return t}validateResolvedCredentials(t){if(typeof t!="object"||typeof t.accessKeyId!="string"||typeof t.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(t){const n=tg(t).replace(/[\-:]/g,"");return{longDate:n,shortDate:n.slice(0,8)}}getCanonicalHeaderList(t){return Object.keys(t).sort().join(";")}}class fi extends sg{constructor({applyChecksum:t,credentials:n,region:s,service:r,sha256:i,uriEscapePath:o=!0}){super({applyChecksum:t,credentials:n,region:s,service:r,sha256:i,uriEscapePath:o}),this.headerFormatter=new Jp}async presign(t,n={}
vendor: 1,965 bytes, lines 24-25
24){const{signingDate:s=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:o,signableHeaders:a,hoistableHeaders:c,signingRegion:d,signingService:u}=n,h=await this.credentialProvider();this.validateResolvedCredentials(h);const p=d??await this.regionProvider(),{longDate:y,shortDate:x}=this.formatDate(s);if(r>Wp)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const A=sr(x,p,u??this.service),_=Qp(ac(t),{unhoistableHeaders:o,hoistableHeaders:c});h.sessionToken&&(_.query[il]=h.sessionToken),_.query[Np]=tr,_.query[Op]=`${h.accessKeyId}/${A}`,_.query[sl]=y,_.query[Mp]=r.toString(10);const T=rc(_,i,a);return _.query[Bp]=this.getCanonicalHeaderList(T),_.query[rl]=await this.getSignature(y,A,this.getSigningKey(h,p,x,u),this.createCanonicalRequest(_,T,await rr(t,this.sha256))),_}async sign(t,n){return typeof t=="string"?this.signString(t,n):t.headers&&t.payload?this.signEvent(t,n):t.message?this.signMessage(t,n):this.signRequest(t,n)}async signEvent({headers:t,payload:n},{signingDate:s=new Date,priorSignature:r,signingRegion:i,signingService:o}){const a=i??await this.regionProvider(),{shortDate:c,longDate:d}=this.formatDate(s),u=sr(c,a,o??this.service),h=await rr({headers:{},body:n},this.sha256),p=new this.sha256;p.update(t);const y=ze(await p.digest()),x=[zp,d,u,r,y,h].join(`
25`);return this.signString(x,{signingDate:s,signingRegion:a,signingService:o})}async signMessage(t,{signingDate:n=new Date,signingRegion:s,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(t.message.headers),payload:t.message.body},{signingDate:n,signingRegion:s,signingService:r,priorSignature:t.priorSignature}).then(o=>({message:t.message,signature:o}))}async signString(t,{signingDate:n=new Date,signingRegion:s,signingService:r}={}){const i=await this.credentialProvider();this.validateResolvedCredentials(i);const o=s??await this.regionProvider(),{shortDate:a}
25=this.formatDate(n),c=new this.sha256(await this.getSigningKey(i,o,a,r));return c.update(Mn(t)),ze(await c.digest())}async signRequest(t,{signingDate:n=new Date,signableHeaders:s,unsignableHeaders:r,signingRegion:i,signingService:o}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const c=i??await this.regionProvider(),d=ac(t),{longDate:u,shortDate:h}=this.formatDate(n),p=sr(h,c,o??this.service);d.headers[al]=u,a.sessionToken&&(d.headers[Up]=a.sessionToken);const y=await rr(d,this.sha256);!Yp(hi,d.headers)&&this.applyChecksum&&(d.headers[hi]=y);const x=rc(d,r,s),A=await this.getSignature(u,p,this.getSigningKey(a,c,h,o),this.createCanonicalRequest(d,x,y));return d.headers[ol]=`${tr} Credential=${a.accessKeyId}/${p}, SignedHeaders=${this.getCanonicalHeaderList(x)}, Signature=${A}`,d}async getSignature(t,n,s,r){const i=await this.createStringToSign(t,n,r,tr),o=new this.sha256(await s);return o.update(Mn(i)),ze(await o.digest())}getSigningKey(t,n,s,r){return Kp(this.sha256,t,s,n,r||this.service)}}const Qi=e=>{let t=e.credentials,n=!!e.credentials,s;Object.defineProperty(e,"credentials",{set(d){d&&d!==t&&d!==s&&(n=!0),t=d;const u=rg(e,{credentials:t,credentialDefaultProvider:e.credentialDefaultProvider}),h=ig(e,u);n&&!h.attributed?(s=async p=>h(p).then(y=>Rp(y,"CREDENTIALS_CODE","e")),s.memoized=h.memoized,s.configBound=h.configBound,s.attributed=!0):s=h},get(){return s},enumerable:!0,configurable:!0}),e.credentials=t;const{signingEscapePath:r=!0,systemClockOffset:i=e.systemClockOffset||0,sha256:o}=e;let a;return e.signer?a=Qt(e.signer):e.regionInfoProvider?a=()=>Qt(e.region)().then(async d=>[await e.regionInfoProvider(d,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},d]).then(([d,u])=>{const{signingRegion:h,signingService:p}=d;e.signingRegion=e.signingRegion||h||u,e.signingName=e.signingName||p||e.serviceId;const y={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:r},x=e.signerConstructor||fi;return new x(y)}):a=async d=>{d=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await Qt(e.region)(),properties:{}},d);const u=d.signingRegion,h=d.signingName;e.signingRegion=e.signingRegion||u,e.signingName=e.signingName||h||e.serviceId;const p={...e,credentials:e.credentials,region:e.signingRegion,service:e.signingName,sha256:o,uriEscapePath:r},y=e.signerConstructor||fi;return new y(p)},Object.assign(e,{systemClockOffset:i,signingEscapePath:r,signer:a})};function rg(e,{credentials:t,credentialDefaultProvider:n}){let s;return t?t?.memoized?s=t:s=Qf(t,Yf,Ku):n?s=Qt(n(Object.assign({},e,{parentClientConfig:e}))):s=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},s.memoized=!0,s}function ig(e,t){if(t.configBound)return t;const n=async s=>t({...s,callerClientConfig:e});return n.memoized=t.memoized,n.configBound=!0,n}const cc=typeof TextEncoder=="function"?new TextEncoder:null,eo=e=>{if(typeof e=="string"){if(cc)return cc.encode(e).byteLength;let t=e.length;for(let n=t-1;n>=0;n--){const s=e.charCodeAt(n);s>127&&s<=2047?t++:s>2047&&s<=65535&&(t+=2),s>=56320&&s<=57343&&n--}return t}else{if(typeof e.byteLength=="number")return e.byteLength;if(typeof e.size=="number")return e.size}throw new Error(`Body Length computation failed for ${e}`)},Pt=(e,t)=>{const n=[];if(e&&n.push(e),t)for(const s of t)n.push(s);return n},mt=(e,t)=>`${e||"anonymous"}${t&&t.length>0?` (a.k.a. ${t.join(",")})`:""}`,Is=()=>{let e=[],t=[],n=!1;const s=new Set,r=h=>h.sort((p,y)=>dc[y.step]-dc[p.step]||uc[y.priority||"normal"]-uc[p.priority||"normal"]),i=h=>{let p=!1;const y=x=>{const A=Pt(x.name,x.aliases);if(A.includes(h)){p=!0;for(const _ of A)s.delete(_);return!1}return!0};return e=e.filter(y),t=t.filter(y),p},o=h=>{let p=!1;const y=x=>{if(x.middleware===h){p=!0;for(const A of Pt(x.name,x.aliases))s.delete(A);return!1}return!0};return e=e.filter(y),t=t.filter(y),p},a=h=>(e.forEach(p=>{h.add(p.middleware,{...p})}),t.forEach(p=>{h.addRelativeTo(p.middleware,{...p})}),h.identifyOnResolve?.(u.identifyOnResolve()),h),c=h=>{const p=[];return h.before.forEach(y=>{y.before.length===0&&y.after.length===0?p.push(y):p.push(...c(y))}
25),p.push(h),h.after.reverse().forEach(y=>{y.before.length===0&&y.after.length===0?p.push(y):p.push(...c(y))}),p},d=(h=!1)=>{const p=[],y=[],x={};return e.forEach(_=>{const T={..._,before:[],after:[]};for(const P of Pt(T.name,T.aliases))x[P]=T;p.push(T)}),t.forEach(_=>{const T={..._,before:[],after:[]};for(const P of Pt(T.name,T.aliases))x[P]=T;y.push(T)}),y.forEach(_=>{if(_.toMiddleware){const T=x[_.toMiddleware];if(T===void 0){if(h)return;throw new Error(`${_.toMiddleware} is not found when adding ${mt(_.name,_.aliases)} middleware ${_.relation} ${_.toMiddleware}`)}_.relation==="after"&&T.after.push(_),_.relation==="before"&&T.before.push(_)}}),r(p).map(c).reduce((_,T)=>(_.push(...T),_),[])},u={add:(h,p={})=>{const{name:y,override:x,aliases:A}=p,_={step:"initialize",priority:"normal",middleware:h,...p},T=Pt(y,A);if(T.length>0){if(T.some(P=>s.has(P))){if(!x)throw new Error(`Duplicate middleware name '${mt(y,A)}'`);for(const P of T){const Z=e.findIndex(re=>re.name===P||re.aliases?.some(Y=>Y===P));if(Z===-1)continue;const G=e[Z];if(G.step!==_.step||_.priority!==G.priority)throw new Error(`"${mt(G.name,G.aliases)}" middleware with ${G.priority} priority in ${G.step} step cannot be overridden by "${mt(y,A)}" middleware with ${_.priority} priority in ${_.step} step.`);e.splice(Z,1)}}for(const P of T)s.add(P)}e.push(_)},addRelativeTo:(h,p)=>{const{name:y,override:x,aliases:A}=p,_={middleware:h,...p},T=Pt(y,A);if(T.length>0){if(T.some(P=>s.has(P))){if(!x)throw new Error(`Duplicate middleware name '${mt(y,A)}'`);for(const P of T){const Z=t.findIndex(re=>re.name===P||re.aliases?.some(Y=>Y===P));if(Z===-1)continue;const G=t[Z];if(G.toMiddleware!==_.toMiddleware||G.relation!==_.relation)throw new Error(`"${mt(G.name,G.aliases)}" middleware ${G.relation} "${G.toMiddleware}" middleware cannot be overridden by "${mt(y,A)}" middleware ${_.relation} "${_.toMiddleware}" middleware.`);t.splice(Z,1)}}for(const P of T)s.add(P)}t.push(_)},clone:()=>a(Is()),use:h=>{h.applyToStack(u)},remove:h=>typeof h=="string"?i(h):o(h),removeByTag:h=>{let p=!1;const y=x=>{const{tags:A,name:_,aliases:T}=x;if(A&&A.includes(h)){const P=Pt(_,T);for(const Z of P)s.delete(Z);return p=!0,!1}return!0};return e=e.filter(y),t=t.filter(y),p},concat:h=>{const p=a(Is());return p.use(h),p.identifyOnResolve(n||p.identifyOnResolve()||(h.identifyOnResolve?.()??!1)),p},applyToStack:a,identify:()=>d(!0).map(h=>{const p=h.step??h.relation+" "+h.toMiddleware;return mt(h.name,h.aliases)+" - "+p}),identifyOnResolve(h){return typeof h=="boolean"&&(n=h),n},resolve:(h,p)=>{for(const y of d().map(x=>x.middleware).reverse())h=y(h,p);return n&&console.log(u.identify()),h}};return u},dc={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},uc={high:3,normal:2,low:1};class to{constructor(t){this.config=t,this.middlewareStack=Is()}send(t,n,s){const r=typeof n!="function"?n:void 0,i=typeof n=="function"?n:s,o=r===void 0&&this.config.cacheMiddleware===!0;let a;if(o){this.handlers||(this.handlers=new WeakMap);const c=this.handlers;c.has(t.constructor)?a=c.get(t.constructor):(a=t.resolveMiddleware(this.middlewareStack,this.config,r),c.set(t.constructor,a))}else delete this.handlers,a=t.resolveMiddleware(this.middlewareStack,this.config,r);if(i)a(t).then(c=>i(null,c.output),c=>i(c)).catch(()=>{});else return a(t).then(c=>c.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const ir="***SensitiveInformation***";function pi(e,t){if(t==null)return t;const n=te.of(e);if(n.getMergedTraits().sensitive)return ir;
25if(n.isListSchema()){if(!!n.getValueSchema().getMergedTraits().sensitive)return ir}else if(n.isMapSchema()){if(!!n.getKeySchema().getMergedTraits().sensitive||!!n.getValueSchema().getMergedTraits().sensitive)return ir}else if(n.isStructSchema()&&typeof t=="object"){const s=t,r={};for(const[i,o]of n.structIterator())s[i]!=null&&(r[i]=pi(o,s[i]));return r}return t}class zs{constructor(){this.middlewareStack=Is()}static classBuilder(){return new og}resolveMiddlewareWithContext(t,n,s,{middlewareFn:r,clientName:i,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,smithyContext:d,additionalContext:u,CommandCtor:h}){for(const _ of r.bind(this)(h,t,n,s))this.middlewareStack.use(_);const p=t.concat(this.middlewareStack),{logger:y}=n,x={logger:y,clientName:i,commandName:o,inputFilterSensitiveLog:a,outputFilterSensitiveLog:c,[di]:{commandInstance:this,...d},...u},{requestHandler:A}=n;return p.resolve(_=>A.handle(_.request,s||{}),x)}}class og{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=void 0,this._outputFilterSensitiveLog=void 0,this._serializer=null,this._deserializer=null}init(t){this._init=t}ep(t){return this._ep=t,this}m(t){return this._middlewareFn=t,this}s(t,n,s={}){return this._smithyContext={service:t,operation:n,...s},this}c(t={}){return this._additionalContext=t,this}n(t,n){return this._clientName=t,this._commandName=n,this}f(t=s=>s,n=s=>s){return this._inputFilterSensitiveLog=t,this._outputFilterSensitiveLog=n,this}ser(t){return this._serializer=t,this}de(t){return this._deserializer=t,this}sc(t){return this._operationSchema=t,this._smithyContext.operationSchema=t,this}build(){const t=this;let n;return n=class extends zs{static getEndpointParameterInstructions(){return t._ep}constructor(...[s]){super(),this.serialize=t._serializer,this.deserialize=t._deserializer,this.input=s??{},t._init(this),this.schema=t._operationSchema}resolveMiddleware(s,r,i){return this.resolveMiddlewareWithContext(s,r,i,{CommandCtor:n,middlewareFn:t._middlewareFn,clientName:t._clientName,commandName:t._commandName,inputFilterSensitiveLog:t._inputFilterSensitiveLog??(t._operationSchema?pi.bind(null,t._operationSchema.input):o=>o),outputFilterSensitiveLog:t._outputFilterSensitiveLog??(t._operationSchema?pi.bind(null,t._operationSchema.output):o=>o),smithyContext:t._smithyContext,additionalContext:t._additionalContext})}}}}const un="***SensitiveInformation***";class Ft extends Error{constructor(t){super(t.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=t.name,this.$fault=t.$fault,this.$metadata=t.$metadata}static isInstance(t){if(!t)return!1;const n=t;return Ft.prototype.isPrototypeOf(n)||!!n.$fault&&!!n.$metadata&&(n.$fault==="client"||n.$fault==="server")}static[Symbol.hasInstance](t){if(!t)return!1;const n=t;return this===Ft?Ft.isInstance(t):Ft.isInstance(t)?n.name&&this.name?this.prototype.isPrototypeOf(t)||n.name===this.name:this.prototype.isPrototypeOf(t):!1}}const N=(e,t={})=>{Object.entries(t).filter(([,s])=>s!==void 0).forEach(([s,r])=>{(e[s]==null||e[s]==="")&&(e[s]=r)});const n=e.message||e.Message||"UnknownError";return e.message=n,delete e.Message,e},ag=({output:e,parsedBody:t,exceptionCtor:n,errorCode:s})=>{const r=cg(e),i=r.httpStatusCode?r.httpStatusCode+"":void 0,o=new n({name:t?.code||t?.Code||s||i||"UnknownError",$fault:"client",$metadata:r});throw N(o,t)},ul=e=>({output:t,parsedBody:n,errorCode:s})=>{ag({output:t,parsedBody:n,exceptionCtor:e,errorCode:s})},cg=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),no=e=>{switch(e){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},dg=e=>{const t=[];for(const n in _s){const s=_s[n];e[s]!==void 0&&t.push({algorithmId:()=>s,checksumConstructor:()=>e[s]})}return{addChecksumAlgorithm(n){t.push(n)},checksumAlgorithms(){return t}}},ug=e=>{const t={};
25return e.checksumAlgorithms().forEach(n=>{t[n.algorithmId()]=n.checksumConstructor()}),t},lg=e=>({setRetryStrategy(t){e.retryStrategy=t},retryStrategy(){return e.retryStrategy}}),hg=e=>{const t={};return t.retryStrategy=e.retryStrategy(),t},so=e=>Object.assign(dg(e),lg(e)),ro=e=>Object.assign(ug(e),hg(e)),gi=e=>Array.isArray(e)?e:[e],ll=e=>{const t="#text";for(const n in e)e.hasOwnProperty(n)&&e[n][t]!==void 0?e[n]=e[n][t]:typeof e[n]=="object"&&e[n]!==null&&(e[n]=ll(e[n]));return e},ks=e=>e!=null;class qs{trace(){}debug(){}info(){}warn(){}error(){}}function le(e,t,n){let s,r,i;if(typeof t>"u"&&typeof n>"u")s={},i=e;else{if(s=e,typeof t=="function")return r=t,i=n,fg(s,r,i);i=t}for(const o of Object.keys(i)){if(!Array.isArray(i[o])){s[o]=i[o];continue}hl(s,null,i,o)}return s}const je=(e,t)=>{const n={};for(const s in t)hl(n,e,t,s);return n},fg=(e,t,n)=>le(e,Object.entries(n).reduce((s,[r,i])=>(Array.isArray(i)?s[r]=i:typeof i=="function"?s[r]=[t,i()]:s[r]=[t,i],s),{})),hl=(e,t,n,s)=>{if(t!==null){let o=n[s];typeof o=="function"&&(o=[,o]);const[a=pg,c=gg,d=s]=o;(typeof a=="function"&&a(t[d])||typeof a!="function"&&a)&&(e[s]=c(t[d]));return}let[r,i]=n[s];if(typeof i=="function"){let o;const a=r===void 0&&(o=i())!=null,c=typeof r=="function"&&!!r(void 0)||typeof r!="function"&&!!r;a?e[s]=o:c&&(e[s]=i())}else{const o=r===void 0&&i!=null,a=typeof r=="function"&&!!r(i)||typeof r!="function"&&!!r;(o||a)&&(e[s]=i)}},pg=e=>e!=null,gg=e=>e,B=e=>{if(e==null)return{};if(Array.isArray(e))return e.filter(t=>t!=null).map(B);if(typeof e=="object"){const t={};for(const n of Object.keys(e))e[n]!=null&&(t[n]=B(e[n]));return t}return e},fl=(e,t)=>Cf(e,t).then(n=>(t?.utf8Encoder??wn)(n)),zn=(e,t)=>fl(e,t).then(n=>{if(n.length)try{return JSON.parse(n)}catch(s){throw s?.name==="SyntaxError"&&Object.defineProperty(s,"$responseBodyText",{value:n}),s}return{}}),mg=async(e,t)=>{const n=await zn(e,t);return n.message=n.message??n.Message,n},yg=(e,t)=>{const n=(i,o)=>Object.keys(i).find(a=>a.toLowerCase()===o.toLowerCase()),s=i=>{let o=i;return typeof o=="number"&&(o=o.toString()),o.indexOf(",")>=0&&(o=o.split(",")[0]),o.indexOf(":")>=0&&(o=o.split(":")[0]),o.indexOf("#")>=0&&(o=o.split("#")[1]),o},r=n(e.headers,"x-amzn-errortype");if(r!==void 0)return s(e.headers[r]);if(t&&typeof t=="object"){const i=n(t,"code");if(i&&t[i]!==void 0)return s(t[i]);if(t.__type!==void 0)return s(t.__type)}},qn=e=>{if(e!=null)return typeof e=="object"&&"__type"in e&&delete e.__type,kf(e)},pl=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",wg=pl+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",bg="["+pl+"]["+wg+"]*",Sg=new RegExp("^"+bg+"$");function gl(e,t){const n=[];let s=t.exec(e);for(;s;){const r=[];r.startIndex=t.lastIndex-s[0].length;const i=s.length;for(let o=0;o<i;o++)r.push(s[o]);n.push(r),s=t.exec(e)}return n}const io=function(e){const t=Sg.exec(e);return!(t===null||typeof t>"u")};function Eg(e){return typeof e<"u"}const xg={allowBooleanAttributes:!1,unpairedTags:[]};function _g(e,t){t=Object.assign({},xg,t);const n=[];let s=!1,r=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=hc(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=fc(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let c="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!=="	"&&e[i]!==`
26`&&e[i]!=="\r";i++)c+=e[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!Pg(c)){let h;return c.trim().length===0?h="Invalid space after '<'.":h="Tag '"+c+"' is an invalid name.",ce("InvalidTag",h,Fe(e,i))}const d=Cg(e,i);if(d===!1)return ce("InvalidAttr","Attributes for '"+c+"' have open quote.",Fe(e,i));let u=d.value;if(i=d.index,u[u.length-1]==="/"){const h=i-u.length;u=u.substring(0,u.length-1);const p=pc(u,t);if(p===!0)s=!0;else return ce(p.err.code,p.err.msg,Fe(e,h+p.err.line))}else if(a)if(d.tagClosed){if(u.trim().length>0)return ce("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Fe(e,o));if(n.length===0)return ce("InvalidTag","Closing tag '"+c+"' has not been opened.",Fe(e,o));
26{const h=n.pop();if(c!==h.tagName){let p=Fe(e,h.tagStartPos);return ce("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+c+"'.",Fe(e,o))}n.length==0&&(r=!0)}}else return ce("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Fe(e,i));else{const h=pc(u,t);if(h!==!0)return ce(h.err.code,h.err.msg,Fe(e,i-u.length+h.err.line));if(r===!0)return ce("InvalidXml","Multiple possible root nodes found.",Fe(e,i));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:o}),s=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=fc(e,i);continue}else if(e[i+1]==="?"){if(i=hc(e,++i),i.err)return i}else break;else if(e[i]==="&"){const h=kg(e,i);if(h==-1)return ce("InvalidChar","char '&' is not expected.",Fe(e,i));i=h}else if(r===!0&&!lc(e[i]))return ce("InvalidXml","Extra text at the end",Fe(e,i));e[i]==="<"&&i--}}else{if(lc(e[i]))continue;return ce("InvalidChar","char '"+e[i]+"' is not expected.",Fe(e,i))}if(s){if(n.length==1)return ce("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",Fe(e,n[0].tagStartPos));if(n.length>0)return ce("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ce("InvalidXml","Start tag expected.",1);return!0}function lc(e){return e===" "||e==="	"||e===`
27`||e==="\r"}function hc(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const s=e.substr(n,t-n);if(t>5&&s==="xml")return ce("InvalidXml","XML declaration allowed only at the start of the document.",Fe(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function fc(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const vg='"',Ag="'";function Cg(e,t){let n="",s="",r=!1;for(;t<e.length;t++){if(e[t]===vg||e[t]===Ag)s===""?s=e[t]:s!==e[t]||(s="");else if(e[t]===">"&&s===""){r=!0;break}n+=e[t]}return s!==""?!1:{value:n,index:t,tagClosed:r}}const Rg=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function pc(e,t){const n=gl(e,Rg),s={};for(let r=0;r<n.length;r++){if(n[r][1].length===0)return ce("InvalidAttr","Attribute '"+n[r][2]+"' has no space in starting.",xn(n[r]));if(n[r][3]!==void 0&&n[r][4]===void 0)return ce("InvalidAttr","Attribute '"+n[r][2]+"' is without value.",xn(n[r]));if(n[r][3]===void 0&&!t.allowBooleanAttributes)return ce("InvalidAttr","boolean attribute '"+n[r][2]+"' is not allowed.",xn(n[r]));const i=n[r][2];if(!Tg(i))return ce("InvalidAttr","Attribute '"+i+"' is an invalid name.",xn(n[r]));if(!s.hasOwnProperty(i))s[i]=1;else return ce("InvalidAttr","Attribute '"+i+"' is repeated.",xn(n[r]))}return!0}function Ig(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function kg(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Ig(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function ce(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Tg(e){return io(e)}function Pg(e){return io(e)}function Fe(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function xn(e){return e.startIndex+e[1].length}const Ng={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1},Og=function(e){return Object.assign({},Ng,e)};let Ts;typeof Symbol!="function"?Ts="@@xmlMetadata":Ts=Symbol("XML Node Metadata");class Ot{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),n!==void 0&&(this.child[this.child.length-1][Ts]={startIndex:n})}static getMetaDataSymbol(){return Ts}}function Bg(e,t){const n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let s=1,r=!1,i=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(r&&Bt(e,"!ENTITY",t)){t+=7;let a,c;[a,c,t]=Mg(e,t+1),c.indexOf("&")===-1&&(n[a]={regx:RegExp(`&${a};`,"g"),val:c})}else if(r&&Bt(e,"!ELEMENT",t)){t+=8;const{index:a}=Fg(e,t+1);t=a}else if(r&&Bt(e,"!ATTLIST",t))t+=8;else if(r&&Bt(e,"!NOTATION",t)){t+=9;const{index:a}=Dg(e,t+1);t=a}else if(Bt(e,"!--",t))i=!0;else throw new Error("Invalid DOCTYPE");s++,o=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,s--):s--,s===0)break}else e[t]==="["?r=!0:o+=e[t];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}const vt=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Mg(e,t){t=vt(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t])&&e[t]!=='"'&&e[t]!=="'";)n+=e[t],t++;if(oo(n),t=vt(e,t),e.substring(t,t+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[t]==="%")throw new Error("Parameter entities are not supported");let s="";return[t,s]=us(e,t,"entity"),t--,[n,s,t]}function Dg(e,t){t=vt(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;oo(n),t=vt(e,t);const s=e.substring(t,t+6).toUpperCase();if(s!=="SYSTEM"&&s!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);t+=s.length,t=vt(e,t);let r=null,i=null;if(s==="PUBLIC")[t,r]=us(e,t,"publicIdentifier"),t=vt(e,t),(e[t]==='"'||e[t]==="'")&&([t,i]=us(e,t,"systemIdentifier"));else if(s==="SYSTEM"&&([t,i]=us(e,t,"systemIdentifier"),!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:r,systemIdentifier:i,index:--t}}
27function us(e,t,n){let s="";const r=e[t];if(r!=='"'&&r!=="'")throw new Error(`Expected quoted string, found "${r}"`);for(t++;t<e.length&&e[t]!==r;)s+=e[t],t++;if(e[t]!==r)throw new Error(`Unterminated ${n} value`);return t++,[t,s]}function Fg(e,t){t=vt(e,t);let n="";for(;t<e.length&&!/\s/.test(e[t]);)n+=e[t],t++;if(!oo(n))throw new Error(`Invalid element name: "${n}"`);t=vt(e,t);let s="";if(e[t]==="E"&&Bt(e,"MPTY",t))t+=4;else if(e[t]==="A"&&Bt(e,"NY",t))t+=2;else if(e[t]==="("){for(t++;t<e.length&&e[t]!==")";)s+=e[t],t++;if(e[t]!==")")throw new Error("Unterminated content model")}else throw new Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:n,contentModel:s.trim(),index:t}}function Bt(e,t,n){for(let s=0;s<t.length;s++)if(t[s]!==e[n+s+1])return!1;return!0}function oo(e){if(io(e))return e;throw new Error(`Invalid entity name ${e}`)}const $g=/^[-+]?0x[a-fA-F0-9]+$/,Ug=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Lg={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function jg(e,t={}){if(t=Object.assign({},Lg,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&$g.test(n))return Vg(n,16);if(n.search(/.+[eE].+/)!==-1)return zg(e,n,t);{const s=Ug.exec(n);if(s){const r=s[1]||"",i=s[2];let o=qg(s[3]);const a=r?e[i.length+1]===".":e[i.length]===".";if(!t.leadingZeros&&(i.length>1||i.length===1&&!a))return e;{const c=Number(n),d=String(c);if(c===0)return c;if(d.search(/[eE]/)!==-1)return t.eNotation?c:e;if(n.indexOf(".")!==-1)return d==="0"||d===o||d===`${r}${o}`?c:e;let u=i?o:n;return i?u===d||r+u===d?c:e:u===d||u===r+d?c:e}}else return e}}const Hg=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function zg(e,t,n){if(!n.eNotation)return e;const s=t.match(Hg);if(s){let r=s[1]||"";const i=s[3].indexOf("e")===-1?"E":"e",o=s[2],a=r?e[o.length+1]===i:e[o.length]===i;return o.length>1&&a?e:o.length===1&&(s[3].startsWith(`.${i}`)||s[3][0]===i)?Number(t):n.leadingZeros&&!a?(t=(s[1]||"")+s[3],Number(t)):e}else return e}function qg(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function Vg(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Wg(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class Kg{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,16))}},this.addExternalEntities=Gg,this.parseXml=Qg,this.parseTextData=Jg,this.resolveNameSpace=Zg,this.buildAttributesMap=Yg,this.isItStopNode=sm,this.replaceEntitiesValue=tm,this.readStopNodeData=im,this.saveTextToParentTag=nm,this.addChild=em,this.ignoreAttributesFn=Wg(this.options.ignoreAttributes)}}function Gg(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function Jg(e,t,n,s,r,i,o){if(e!==void 0&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,r,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?yi(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?yi(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Zg(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const Xg=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Yg(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const s=gl(e,Xg),r=s.length,i={};for(let o=0;o<r;o++){const a=this.resolveNameSpace(s[o][1]);if(this.ignoreAttributesFn(a,t))continue;let c=s[o][4],d=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);const u=this.options.attributeValueProcessor(a,c,t);u==null?i[d]=c:typeof u!=typeof c||u!==c?i[d]=u:i[d]=yi(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[d]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const o={};return o[this.options.attributesGroupName]=i,o}return i}}const Qg=function(e){e=e.replace(/\r\n?/g,`
28`);const t=new Ot("!xml");let n=t,s="",r="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const a=$t(e,">",i,"Closing Tag is not closed.");let c=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){const h=c.indexOf(":");h!==-1&&(c=c.substr(h+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(s=this.saveTextToParentTag(s,n,r));const d=r.substring(r.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let u=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(u=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):u=r.lastIndexOf("."),r=r.substring(0,u),n=this.tagsNodeStack.pop(),s="",i=a}else if(e[i+1]==="?"){let a=mi(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,n,r),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const c=new Ot(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,r,a.tagName)),this.addChild(n,c,r,i)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const a=$t(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const c=e.substring(i+4,a-2);s=this.saveTextToParentTag(s,n,r),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}i=a}else if(e.substr(i+1,2)==="!D"){const a=Bg(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){const a=$t(e,"]]>",i,"CDATA is not closed.")-2,c=e.substring(i+9,a);s=this.saveTextToParentTag(s,n,r);let d=this.parseTextData(c,n.tagname,r,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):n.add(this.options.textNodeName,d),i=a+2}else{let a=mi(e,i,this.options.removeNSPrefix),c=a.tagName;const d=a.rawTagName;let u=a.tagExp,h=a.attrExpPresent,p=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&s&&n.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,n,r,!1));const y=n;y&&this.options.unpairedTags.indexOf(y.tagname)!==-1&&(n=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),c!==t.tagname&&(r+=r?"."+c:c);const x=i;if(this.isItStopNode(this.options.stopNodes,r,c)){let A="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),r=r.substr(0,r.length-1),u=c):u=u.substr(0,u.length-1),i=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=a.closeIndex;else{const T=this.readStopNodeData(e,d,p+1);if(!T)throw new Error(`Unexpected end of ${d}`);i=T.i,A=T.tagContent}const _=new Ot(c);c!==u&&h&&(_[":@"]=this.buildAttributesMap(u,r,c)),A&&(A=this.parseTextData(A,c,r,!0,h,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),_.add(this.options.textNodeName,A),this.addChild(n,_,r,x)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),r=r.substr(0,r.length-1),u=c):u=u.substr(0,u.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const A=new Ot(c);c!==u&&h&&(A[":@"]=this.buildAttributesMap(u,r,c)),this.addChild(n,A,r,x),r=r.substr(0,r.lastIndexOf("."))}else{const A=new Ot(c);this.tagsNodeStack.push(n),c!==u&&h&&(A[":@"]=this.buildAttributesMap(u,r,c)),this.addChild(n,A,r,x),n=A}s="",i=p}}else s+=e[i];return t.child};function em(e,t,n,s){this.options.captureMetaData||(s=void 0);
28const r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t,s))}const tm=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function nm(e,t,n,s){return e&&(s===void 0&&(s=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,s),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function sm(e,t,n){const s="*."+n;for(const r in e){const i=e[r];if(s===i||t===i)return!0}return!1}function rm(e,t,n=">"){let s,r="";for(let i=t;i<e.length;i++){let o=e[i];if(s)o===s&&(s="");else if(o==='"'||o==="'")s=o;else if(o===n[0])if(n[1]){if(e[i+1]===n[1])return{data:r,index:i}}else return{data:r,index:i};else o==="	"&&(o=" ");r+=o}}function $t(e,t,n,s){const r=e.indexOf(t,n);if(r===-1)throw new Error(s);return r+t.length-1}function mi(e,t,n,s=">"){const r=rm(e,t+1,s);if(!r)return;let i=r.data;const o=r.index,a=i.search(/\s/);let c=i,d=!0;a!==-1&&(c=i.substring(0,a),i=i.substring(a+1).trimStart());const u=c;if(n){const h=c.indexOf(":");h!==-1&&(c=c.substr(h+1),d=c!==r.data.substr(h+1))}return{tagName:c,tagExp:i,closeIndex:o,attrExpPresent:d,rawTagName:u}}function im(e,t,n){const s=n;let r=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const i=$t(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(r--,r===0))return{tagContent:e.substring(s,n),i};n=i}else if(e[n+1]==="?")n=$t(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=$t(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=$t(e,"]]>",n,"StopNode is not closed.")-2;else{const i=mi(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&r++,n=i.closeIndex)}}function yi(e,t,n){if(t&&typeof e=="string"){const s=e.trim();return s==="true"?!0:s==="false"?!1:jg(e,n)}else return Eg(e)?e:""}const or=Ot.getMetaDataSymbol();function om(e,t){return ml(e,t)}function ml(e,t,n){let s;const r={};for(let i=0;i<e.length;i++){const o=e[i],a=am(o);let c="";if(n===void 0?c=a:c=n+"."+a,a===t.textNodeName)s===void 0?s=o[a]:s+=""+o[a];else{if(a===void 0)continue;if(o[a]){let d=ml(o[a],t,c);const u=dm(d,t);o[or]!==void 0&&(d[or]=o[or]),o[":@"]?cm(d,o[":@"],c,t):Object.keys(d).length===1&&d[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?d=d[t.textNodeName]:Object.keys(d).length===0&&(t.alwaysCreateTextNode?d[t.textNodeName]="":d=""),r[a]!==void 0&&r.hasOwnProperty(a)?(Array.isArray(r[a])||(r[a]=[r[a]]),r[a].push(d)):t.isArray(a,c,u)?r[a]=[d]:r[a]=d}}}return typeof s=="string"?s.length>0&&(r[t.textNodeName]=s):s!==void 0&&(r[t.textNodeName]=s),r}function am(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(s!==":@")return s}}function cm(e,t,n,s){if(t){const r=Object.keys(t),i=r.length;for(let o=0;o<i;o++){const a=r[o];s.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function dm(e,t){const{textNodeName:n}=t,s=Object.keys(e).length;return!!(s===0||s===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class um{constructor(t){this.externalEntities={},this.options=Og(t)}parse(t,n){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const i=_g(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const s=new Kg(this.options);s.addExternalEntities(this.externalEntities);const r=s.parseXml(t);return this.options.preserveOrder||r===void 0?r:om(r,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Ot.getMetaDataSymbol()}}const ao=(e,t)=>fl(e,t).then(n=>{if(n.length){const s=new um({attributeNamePrefix:"",htmlEntities:!0,ignoreAttributes:!1,ignoreDeclaration:!0,parseTagValue:!1,trimValues:!1,tagValueProcessor:(c,d)=>d.trim()===""&&d.includes(`
29`)?"":void 0});s.addEntity("#xD","\r"),s.addEntity("#10",`
30`);let r;try{r=s.parse(n,!0)}catch(c){throw c&&typeof c=="object"&&Object.defineProperty(c,"$responseBodyText",{value:n}),c}const i="#text",o=Object.keys(r)[0],a=r[o];return a[i]&&(a[o]=a[i],delete a[i]),ll(a)}return{}}),lm=async(e,t)=>{const n=await ao(e,t);return n.Error&&(n.Error.message=n.Error.message??n.Error.Message),n},hm=(e,t)=>{if(t?.Error?.Code!==void 0)return t.Error.Code;if(t?.Code!==void 0)return t.Code;if(e.statusCode==404)return"NotFound"},fm=/\d{12}\.ddb/;async function pm(e,t,n){if(n.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&et(e,"PROTOCOL_RPC_V2_CBOR","M"),typeof t.retryStrategy=="function"){const i=await t.retryStrategy();typeof i.acquireInitialRetryToken=="function"?i.constructor?.name?.includes("Adaptive")?et(e,"RETRY_MODE_ADAPTIVE","F"):et(e,"RETRY_MODE_STANDARD","E"):et(e,"RETRY_MODE_LEGACY","D")}if(typeof t.accountIdEndpointMode=="function"){const i=e.endpointV2;switch(String(i?.url?.hostname).match(fm)&&et(e,"ACCOUNT_ID_ENDPOINT","O"),await t.accountIdEndpointMode?.()){case"disabled":et(e,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":et(e,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":et(e,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const r=e.__smithy_context?.selectedHttpAuthScheme?.identity;if(r?.$source){const i=r;i.accountId&&et(e,"RESOLVED_ACCOUNT_ID","T");for(const[o,a]of Object.entries(i.$source??{}))et(e,o,a)}}const gc="user-agent",ar="x-amz-user-agent",mc=" ",cr="/",gm=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,mm=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,yc="-",ym=1024;function wm(e){let t="";for(const n in e){const s=e[n];if(t.length+s.length+1<=ym){t.length?t+=","+s:t+=s;continue}break}return t}const bm=e=>(t,n)=>async s=>{const{request:r}=s;if(!ve.isInstance(r))return t(s);const{headers:i}=r,o=n?.userAgent?.map(Xn)||[],a=(await e.defaultUserAgentProvider()).map(Xn);await pm(n,e,s);const c=n;a.push(`m/${wm(Object.assign({},n.__smithy_context?.features,c.__aws_sdk_context?.features))}`);const d=e?.customUserAgent?.map(Xn)||[],u=await e.userAgentAppId();u&&a.push(Xn([`app/${u}`]));const h=[].concat([...a,...o,...d]).join(mc),p=[...a.filter(y=>y.startsWith("aws-sdk-")),...d].join(mc);return e.runtime!=="browser"?(p&&(i[ar]=i[ar]?`${i[gc]} ${p}`:p),i[gc]=h):i[ar]=h,t({...s,request:r})},Xn=e=>{const t=e[0].split(cr).map(o=>o.replace(gm,yc)).join(cr),n=e[1]?.replace(mm,yc),s=t.indexOf(cr),r=t.substring(0,s);let i=t.substring(s+1);return r==="api"&&(i=i.toLowerCase()),[r,i,n].filter(o=>o&&o.length>0).reduce((o,a,c)=>{switch(c){case 0:return a;case 1:return`${o}/${a}`;default:return`${o}#${a}`}},"")},Sm={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},co=e=>({applyToStack:t=>{t.add(bm(e),Sm)}}),uo=!1,lo=!1,yl=e=>typeof e=="string"&&(e.startsWith("fips-")||e.endsWith("-fips")),wc=e=>yl(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e,ho=e=>{const{region:t,useFipsEndpoint:n}=e;if(!t)throw new Error("Region is missing");return Object.assign(e,{region:async()=>
30{if(typeof t=="string")return wc(t);const s=await t();return wc(s)},useFipsEndpoint:async()=>{const s=typeof t=="string"?t:await t();return yl(s)?!0:typeof n!="function"?Promise.resolve(!!n):n()}})},bc="content-length";function Em(e){return t=>async n=>{const s=n.request;if(ve.isInstance(s)){const{body:r,headers:i}=s;if(r&&Object.keys(i).map(o=>o.toLowerCase()).indexOf(bc)===-1)try{const o=e(r);s.headers={...s.headers,[bc]:String(o)}}catch{}}return t({...n,request:s})}}const xm={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},fo=e=>({applyToStack:t=>{t.add(Em(e.bodyLengthChecker),xm)}}),_m=async e=>{const t=e?.Bucket||"";if(typeof e.Bucket=="string"&&(e.Bucket=t.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),Im(t)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!Rm(t)||t.indexOf(".")!==-1&&!String(e.Endpoint).startsWith("http:")||t.toLowerCase()!==t||t.length<3)&&(e.ForcePathStyle=!0);return e.DisableMultiRegionAccessPoints&&(e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0),e},vm=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Am=/(\d+\.){3}\d+/,Cm=/\.\./,Rm=e=>vm.test(e)&&!Am.test(e)&&!Cm.test(e),Im=e=>{const[t,n,s,,,r]=e.split(":"),i=t==="arn"&&e.split(":").length>=6,o=!!(i&&n&&s&&r);if(i&&!o)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return o},km=(e,t,n)=>{const s=async()=>{const r=n[e]??n[t];return typeof r=="function"?r():r};return e==="credentialScope"||t==="CredentialScope"?async()=>{const r=typeof n.credentials=="function"?await n.credentials():n.credentials;return r?.credentialScope??r?.CredentialScope}:e==="accountId"||t==="AccountId"?async()=>{const r=typeof n.credentials=="function"?await n.credentials():n.credentials;return r?.accountId??r?.AccountId}:e==="endpoint"||t==="endpoint"?async()=>{if(n.isCustomEndpoint===!1)return;const r=await s();if(r&&typeof r=="object"){if("url"in r)return r.url.href;if("hostname"in r){const{protocol:i,hostname:o,port:a,path:c}=r;return`${i}//${o}${a?":"+a:""}${c}`}}return r}:s},wl=async e=>{},bl=e=>typeof e=="object"?"url"in e?dn(e.url):e:dn(e),Tm=async(e,t,n,s)=>{if(!n.isCustomEndpoint){let o;n.serviceConfiguredEndpoint?o=await n.serviceConfiguredEndpoint():o=await wl(n.serviceId),o&&(n.endpoint=()=>Promise.resolve(bl(o)),n.isCustomEndpoint=!0)}const r=await Sl(e,t,n);if(typeof n.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");return n.endpointProvider(r,s)},Sl=async(e,t,n)=>{const s={},r=t?.getEndpointParameterInstructions?.()||{};for(const[i,o]of Object.entries(r))switch(o.type){case"staticContextParams":s[i]=o.value;break;case"contextParams":s[i]=e[o.name];break;case"clientContextParams":case"builtInParams":s[i]=await km(o.name,i,n)();break;case"operationContextParams":s[i]=o.get(e);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(o))}return Object.keys(r).length===0&&Object.assign(s,n),String(n.serviceId).toLowerCase()==="s3"&&await _m(s),s},Pm=({config:e,instructions:t})=>(n,s)=>async r=>{e.isCustomEndpoint&&Gf(s,"ENDPOINT_OVERRIDE","N");const i=await Tm(r.input,{getEndpointParameterInstructions(){return t}},{...e},s);s.endpointV2=i,s.authSchemes=i.properties?.authSchemes;const o=s.authSchemes?.[0];if(o){s.signing_region=o.signingRegion,s.signing_service=o.signingName;const c=kt(s)?.selectedHttpAuthScheme?.httpAuthOption;c&&(c.signingProperties=Object.assign(c.signingProperties||{},{signing_region:o.signingRegion,signingRegion:o.signingRegion,signing_service:o.signingName,signingName:o.signingName,signingRegionSet:o.signingRegionSet},o.properties))}return n({...r})},Nm={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:ju.name},po=(e,t)=>({applyToStack:n=>{n.addRelativeTo(Pm({config:e,instructions:t}),Nm)}}),go=e=>{const t=e.tls??!0,{endpoint:n,useDualstackEndpoint:s,useFipsEndpoint:r}=e,i=n!=null?async()=>bl(await Me(n)()):void 0,a=Object.assign(e,{endpoint:i,tls:t,isCustomEndpoint:!!n,useDualstackEndpoint:Me(s??!1),useFipsEndpoint:Me(r??!1)});let c;return a.serviceConfiguredEndpoint=async()=>(e.serviceId&&!c&&(c=wl(e.serviceId)),c),a};var ln;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(ln||(ln={}));const hn=3,mo=ln.STANDARD,Om=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Bm=["TimeoutError","RequestTimeout","RequestTimeoutException"],Mm=[500,502,503,504],Dm=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],Fm=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],$m=e=>e.$metadata?.clockSkewCorrected,Um=e=>{const t=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return e&&e instanceof TypeError?t.has(e.message):!1},El=e=>e.$metadata?.httpStatusCode===429||Om.includes(e.name)||e.$retryable?.throttling==!0,yo=(e,t=0)=>$m(e)||Bm.includes(e.name)||Dm.includes(e?.code||"")||Fm.includes(e?.code||"")||Mm.includes(e.$metadata?.httpStatusCode||0)||Um(e)||e.cause!==void 0&&t<=10&&yo(e.cause,t+1),Lm=e=>{if(e.$metadata?.httpStatusCode!==void 0){const t=e.$metadata.httpStatusCode;return 500<=t&&t<=599&&!yo(e)}return!1};class Vs{constructor(t){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=t?.beta??.7,this.minCapacity=t?.minCapacity??1,this.minFillRate=t?.minFillRate??.5,this.scaleConstant=t?.scaleConstant??.4,this.smooth=t?.smooth??.8;const n=this.getCurrentTimeInSeconds();this.lastThrottleTime=n,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1e3}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(t){if(this.enabled){if(this.refillTokenBucket(),t>this.currentCapacity){const n=(t-this.currentCapacity)/this.fillRate*1e3;await new Promise(s=>Vs.setTimeoutFn(s,n))}this.currentCapacity=this.currentCapacity-t}}refillTokenBucket(){const t=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=t;return}const n=(t-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+n),this.lastTimestamp=t}updateClientSendingRate(t){let n;if(this.updateMeasuredRate(),El(t)){const r=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=r,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),n=this.cubicThrottle(r),this.enableTokenBucket()}else this.calculateTimeWindow(),n=this.cubicSuccess(this.getCurrentTimeInSeconds());const s=Math.min(n,2*this.measuredTxRate);this.updateTokenBucketRate(s)}
30calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(t){return this.getPrecise(t*this.beta)}cubicSuccess(t){return this.getPrecise(this.scaleConstant*Math.pow(t-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(t){this.refillTokenBucket(),this.fillRate=Math.max(t,this.minFillRate),this.maxCapacity=Math.max(t,this.minCapacity),this.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const t=this.getCurrentTimeInSeconds(),n=Math.floor(t*2)/2;if(this.requestCount++,n>this.lastTxRateBucket){const s=this.requestCount/(n-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(s*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=n}}getPrecise(t){return parseFloat(t.toFixed(8))}}Vs.setTimeoutFn=setTimeout;const wi=100,xl=20*1e3,jm=500,Sc=500,Hm=5,zm=10,qm=1,Vm="amz-sdk-invocation-id",Wm="amz-sdk-request",Km=()=>{let e=wi;return{computeNextBackoffDelay:s=>Math.floor(Math.min(xl,Math.random()*2**s*e)),setDelayBase:s=>{e=s}}},Ec=({retryDelay:e,retryCount:t,retryCost:n})=>({getRetryCount:()=>t,getRetryDelay:()=>Math.min(xl,e),getRetryCost:()=>n});class _l{constructor(t){this.maxAttempts=t,this.mode=ln.STANDARD,this.capacity=Sc,this.retryBackoffStrategy=Km(),this.maxAttemptsProvider=typeof t=="function"?t:async()=>t}async acquireInitialRetryToken(t){return Ec({retryDelay:wi,retryCount:0})}async refreshRetryTokenForRetry(t,n){const s=await this.getMaxAttempts();if(this.shouldRetry(t,n,s)){const r=n.errorType;this.retryBackoffStrategy.setDelayBase(r==="THROTTLING"?jm:wi);const i=this.retryBackoffStrategy.computeNextBackoffDelay(t.getRetryCount()),o=n.retryAfterHint?Math.max(n.retryAfterHint.getTime()-Date.now()||0,i):i,a=this.getCapacityCost(r);return this.capacity-=a,Ec({retryDelay:o,retryCount:t.getRetryCount()+1,retryCost:a})}throw new Error("No retry token available")}recordSuccess(t){this.capacity=Math.max(Sc,this.capacity+(t.getRetryCost()??qm))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${hn}`),hn}}shouldRetry(t,n,s){return t.getRetryCount()+1<s&&this.capacity>=this.getCapacityCost(n.errorType)&&this.isRetryableError(n.errorType)}getCapacityCost(t){return t==="TRANSIENT"?zm:Hm}isRetryableError(t){return t==="THROTTLING"||t==="TRANSIENT"}}class Gm{constructor(t,n){this.maxAttemptsProvider=t,this.mode=ln.ADAPTIVE;const{rateLimiter:s}=n??{};this.rateLimiter=s??new Vs,this.standardRetryStrategy=new _l(t)}async acquireInitialRetryToken(t){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(t)}async refreshRetryTokenForRetry(t,n){return this.rateLimiter.updateClientSendingRate(n),this.standardRetryStrategy.refreshRetryTokenForRetry(t,n)}recordSuccess(t){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(t)}}let Yn;const Jm=new Uint8Array(16);function Zm(){if(!Yn&&(Yn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Yn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Yn(Jm)}const Ae=[];for(let e=0;e<256;++e)Ae.push((e+256).toString(16).slice(1));function Xm(e,t=0){return Ae[e[t+0]]+Ae[e[t+1]]+Ae[e[t+2]]+Ae[e[t+3]]+"-"+Ae[e[t+4]]+Ae[e[t+5]]+"-"+Ae[e[t+6]]+Ae[e[t+7]]+"-"+Ae[e[t+8]]+Ae[e[t+9]]+"-"+Ae[e[t+10]]+Ae[e[t+11]]+Ae[e[t+12]]+Ae[e[t+13]]+Ae[e[t+14]]+Ae[e[t+15]]}const Ym=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),xc={randomUUID:Ym};function Qm(e,t,n){if(xc.randomUUID&&!e)return xc.randomUUID();e=e||{};const s=e.random||(e.rng||Zm)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,Xm(s)}const ey=e=>e instanceof Error?e:e instanceof Object?Object.assign(new Error,e):typeof e=="string"?new Error(e):new Error(`AWS SDK error wrapper for ${e}`),wo=e=>{const{retryStrategy:t,retryMode:n,maxAttempts:s}=e,r=Me(s??hn);return Object.assign(e,{maxAttempts:r,retryStrategy:async()=>t||(await Me(n)()===ln.ADAPTIVE?new Gm(r):new _l(r))})},ty=e=>e?.body instanceof ReadableStream,ny=e=>(t,n)=>async s=>{let r=await e.retryStrategy();const i=await e.maxAttempts();if(sy(r)){r=r;let o=await r.acquireInitialRetryToken(n.partition_id),a=new Error,c=0,d=0;const{request:u}=s,h=ve.isInstance(u);for(h&&(u.headers[Vm]=Qm());;)try{h&&(u.headers[Wm]=`attempt=${c+1}; max=${i}`);const{response:p,output:y}=await t(s);return r.recordSuccess(o),y.$metadata.attempts=c+1,y.$metadata.totalRetryDelay=d,{response:p,output:y}}catch(p){const y=ry(p);if(a=ey(p),h&&ty(u))throw(n.logger instanceof qs?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),a;try{o=await r.refreshRetryTokenForRetry(o,y)}catch{throw a.$metadata||(a.$metadata={}),a.$metadata.attempts=c+1,a.$metadata.totalRetryDelay=d,a}c=o.getRetryCount();const x=o.getRetryDelay();d+=x,await new Promise(A=>setTimeout(A,x))}}else return r=r,r?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",r.mode]]
30),r.retry(t,s)},sy=e=>typeof e.acquireInitialRetryToken<"u"&&typeof e.refreshRetryTokenForRetry<"u"&&typeof e.recordSuccess<"u",ry=e=>{const t={error:e,errorType:iy(e)},n=ay(e.$response);return n&&(t.retryAfterHint=n),t},iy=e=>El(e)?"THROTTLING":yo(e)?"TRANSIENT":Lm(e)?"SERVER_ERROR":"CLIENT_ERROR",oy={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},bo=e=>({applyToStack:t=>{t.add(ny(e),oy)}}),ay=e=>{if(!an.isInstance(e))return;const t=Object.keys(e.headers).find(i=>i.toLowerCase()==="retry-after");if(!t)return;const n=e.headers[t],s=Number(n);return Number.isNaN(s)?new Date(n):new Date(s*1e3)},cy=async(e,t,n)=>({operation:kt(t).operation,region:await Me(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function dy(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-identity",region:e.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function Qn(e){return{schemeId:"smithy.api#noAuth"}}const uy=e=>{const t=[];switch(e.operation){case"GetCredentialsForIdentity":{t.push(Qn());break}case"GetId":{t.push(Qn());break}case"GetOpenIdToken":{t.push(Qn());break}case"UnlinkIdentity":{t.push(Qn());break}default:t.push(dy(e))}return t},ly=e=>{const t=Qi(e);return Object.assign(t,{authSchemePreference:Me(e.authSchemePreference??[])})},hy=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"cognito-identity"}),Zx={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},fy="3.883.0",py={version:fy},gy=e=>new TextEncoder().encode(e);var my=typeof Buffer<"u"&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:gy;function fn(e){return e instanceof Uint8Array?e:typeof e=="string"?my(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}function bi(e){return typeof e=="string"?e.length===0:e.byteLength===0}function vl(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}var Al={name:"SHA-256"},_c={name:"HMAC",hash:Al},yy=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const wy={};function At(){return typeof window<"u"?window:typeof self<"u"?self:wy}var by=(function(){function e(t){this.toHash=new Uint8Array(0),this.secret=t,this.reset()}return e.prototype.update=function(t){if(!bi(t)){var n=fn(t),s=new Uint8Array(this.toHash.byteLength+n.byteLength);s.set(this.toHash,0),s.set(n,this.toHash.byteLength),this.toHash=s}},e.prototype.digest=function(){var t=this;return this.key?this.key.then(function(n){return At().crypto.subtle.sign(_c,n,t.toHash).then(function(s){return new Uint8Array(s)})}):bi(this.toHash)?Promise.resolve(yy):Promise.resolve().then(function(){return At().crypto.subtle.digest(Al,t.toHash)}).then(function(n){return Promise.resolve(new Uint8Array(n))})},e.prototype.reset=function(){var t=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(n,s){At().crypto.subtle.importKey("raw",fn(t.secret),_c,!1,["sign"]).then(n,s)}),this.key.catch(function(){}))},e})();function Sy(e,t,n,s){function r(i){return i instanceof n?i:new n(function(o){o(i)})}return new(n||(n=Promise))(function(i,o){function a(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?i(u.value):r(u.value).then(a,c)}d((s=s.apply(e,t||[])).next())})}function Ey(e,t){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,r,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(d){return function(u){return c([d,u])}}function c(d){if(s)throw new TypeError("Generator is already executing.");for(;o&&(o=0,d[0]&&(n=0)),n;)try{if(s=1,r&&(i=d[0]&2?r.return:d[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,d[1])).done)return i;switch(r=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,r=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){n.label=d[1];break}if(d[0]===6&&n.label<i[1]){n.label=i[1],i=d;break}if(i&&n.label<i[2]){n.label=i[2],n.ops.push(d);break}i[2]&&n.ops.pop(),n.trys.pop();continue}d=t.call(e,n)}catch(u){d=[6,u],r=0}finally{s=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function xy(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],s=0;if(n)return n.call(e);
30if(e&&typeof e.length=="number")return{next:function(){return e&&s>=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var Ye=64,_y=32,vy=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ay=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],Cy=Math.pow(2,53)-1,ls=(function(){function e(){this.state=Int32Array.from(Ay),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(t){if(this.finished)throw new Error("Attempted to update an already finished hash.");var n=0,s=t.byteLength;if(this.bytesHashed+=s,this.bytesHashed*8>Cy)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;s>0;)this.buffer[this.bufferLength++]=t[n++],s--,this.bufferLength===Ye&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var t=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),s=this.bufferLength;if(n.setUint8(this.bufferLength++,128),s%Ye>=Ye-8){for(var r=this.bufferLength;r<Ye;r++)n.setUint8(r,0);this.hashBuffer(),this.bufferLength=0}for(var r=this.bufferLength;r<Ye-8;r++)n.setUint8(r,0);n.setUint32(Ye-8,Math.floor(t/4294967296),!0),n.setUint32(Ye-4,t),this.hashBuffer(),this.finished=!0}for(var i=new Uint8Array(_y),r=0;r<8;r++)i[r*4]=this.state[r]>>>24&255,i[r*4+1]=this.state[r]>>>16&255,i[r*4+2]=this.state[r]>>>8&255,i[r*4+3]=this.state[r]>>>0&255;return i},e.prototype.hashBuffer=function(){for(var t=this,n=t.buffer,s=t.state,r=s[0],i=s[1],o=s[2],a=s[3],c=s[4],d=s[5],u=s[6],h=s[7],p=0;p<Ye;p++){if(p<16)this.temp[p]=(n[p*4]&255)<<24|(n[p*4+1]&255)<<16|(n[p*4+2]&255)<<8|n[p*4+3]&255;else{var y=this.temp[p-2],x=(y>>>17|y<<15)^(y>>>19|y<<13)^y>>>10;y=this.temp[p-15];var A=(y>>>7|y<<25)^(y>>>18|y<<14)^y>>>3;this.temp[p]=(x+this.temp[p-7]|0)+(A+this.temp[p-16]|0)}var _=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&d^~c&u)|0)+(h+(vy[p]+this.temp[p]|0)|0)|0,T=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&o^i&o)|0;h=u,u=d,d=c,c=a+_|0,a=o,o=i,i=r,r=_+T|0}s[0]+=r,s[1]+=i,s[2]+=o,s[3]+=a,s[4]+=c,s[5]+=d,s[6]+=u,s[7]+=h},e})(),Ry=(function(){function e(t){this.secret=t,this.hash=new ls,this.reset()}return e.prototype.update=function(t){if(!(bi(t)||this.error))try{this.hash.update(fn(t))}catch(n){this.error=n}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return Sy(this,void 0,void 0,function(){return Ey(this,function(t){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new ls,this.secret){this.outer=new ls;var t=Iy(this.secret),n=new Uint8Array(Ye);n.set(t);for(var s=0;s<Ye;s++)t[s]^=54,n[s]^=92;this.hash.update(t),this.outer.update(n);for(var s=0;s<t.byteLength;s++)t[s]=0}},e})();function Iy(e){var t=fn(e);if(t.byteLength>Ye){var n=new ls;n.update(t),t=n.digest()}var s=new Uint8Array(Ye);return s.set(t),s}var ky=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function Cl(e){if(Ty(e)&&typeof e.crypto.subtle=="object"){var t=e.crypto.subtle;return Py(t)}return!1}function Ty(e){if(typeof e=="object"&&typeof e.crypto=="object"){var t=e.crypto.getRandomValues;return typeof t=="function"}return!1}function Py(e){return e&&ky.every(function(t){return typeof e[t]=="function"})}
30var So=(function(){function e(t){Cl(At())?this.hash=new by(t):this.hash=new Ry(t)}return e.prototype.update=function(t,n){this.hash.update(fn(t))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e})();const Ny={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},Rl={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},ie={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv",bot:"bot"},$e={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},bt={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"};class S{static getFirstMatch(t,n){const s=n.match(t);return s&&s.length>0&&s[1]||""}static getSecondMatch(t,n){const s=n.match(t);return s&&s.length>1&&s[2]||""}static matchAndReturnConst(t,n,s){if(t.test(n))return s}
vendor: 15,519 bytes, line 30
30static getWindowsVersionName(t){switch(t){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(t){const n=t.split(".").splice(0,2).map(s=>parseInt(s,10)||0);if(n.push(0),n[0]===10)switch(n[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}}static getAndroidVersionName(t){const n=t.split(".").splice(0,2).map(s=>parseInt(s,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(t){return t.split(".").length}static compareVersions(t,n,s=!1){const r=S.getVersionPrecision(t),i=S.getVersionPrecision(n);let o=Math.max(r,i),a=0;const c=S.map([t,n],d=>{const u=o-S.getVersionPrecision(d),h=d+new Array(u+1).join(".0");return S.map(h.split("."),p=>new Array(20-p.length).join("0")+p).reverse()});for(s&&(a=o-Math.min(r,i)),o-=1;o>=a;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===a)return 0;o-=1}else if(c[0][o]<c[1][o])return-1}}static map(t,n){const s=[];let r;if(Array.prototype.map)return Array.prototype.map.call(t,n);for(r=0;r<t.length;r+=1)s.push(n(t[r]));return s}static find(t,n){let s,r;if(Array.prototype.find)return Array.prototype.find.call(t,n);for(s=0,r=t.length;s<r;s+=1){const i=t[s];if(n(i,s))return i}}static assign(t,...n){const s=t;let r,i;if(Object.assign)return Object.assign(t,...n);for(r=0,i=n.length;r<i;r+=1){const o=n[r];typeof o=="object"&&o!==null&&Object.keys(o).forEach(c=>{s[c]=o[c]})}return t}static getBrowserAlias(t){return Ny[t]}static getBrowserTypeByAlias(t){return Rl[t]||""}}const X=/version\/(\d+(\.?_?\d+)+)/i,Oy=[{test:[/googlebot/i],describe(e){const t={name:"Googlebot"},n=S.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/opera/i],describe(e){const t={name:"Opera"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opr\/|opios/i],describe(e){const t={name:"Opera"},n=S.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/SamsungBrowser/i],describe(e){const t={name:"Samsung Internet for Android"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Whale/i],describe(e){const t={name:"NAVER Whale Browser"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/PaleMoon/i],describe(e){const t={name:"Pale Moon"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MZBrowser/i],describe(e){const t={name:"MZ Browser"},n=S.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/focus/i],describe(e){const t={name:"Focus"},n=S.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/swing/i],describe(e){const t={name:"Swing"},n=S.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/coast/i],describe(e){const t={name:"Opera Coast"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(e){const t={name:"Opera Touch"},n=S.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/yabrowser/i],describe(e){const t={name:"Yandex Browser"},n=S.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/ucbrowser/i],describe(e){const t={name:"UC Browser"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/Maxthon|mxios/i],describe(e){const t={name:"Maxthon"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/epiphany/i],describe(e){const t={name:"Epiphany"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/puffin/i],describe(e){const t={name:"Puffin"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sleipnir/i],describe(e){const t={name:"Sleipnir"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/k-meleon/i],describe(e){const t={name:"K-Meleon"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/micromessenger/i],describe(e){const t={name:"WeChat"},n=S.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/qqbrowser/i],describe(e){const t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},n=S.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/msie|trident/i],describe(e){const t={name:"Internet Explorer"},n=S.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/\sedg\//i],describe(e){const t={name:"Microsoft Edge"},n=S.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/edg([ea]|ios)/i],describe(e){const t={name:"Microsoft Edge"},n=S.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/vivaldi/i],describe(e){const t={name:"Vivaldi"},n=S.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/seamonkey/i],describe(e){const t={name:"SeaMonkey"},n=S.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/sailfish/i],describe(e){const t={name:"Sailfish"},n=S.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return n&&(t.version=n),t}},{test:[/silk/i],describe(e){const t={name:"Amazon Silk"},n=S.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/phantom/i],describe(e){const t={name:"PhantomJS"},n=S.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/slimerjs/i],describe(e){const t={name:"SlimerJS"},n=S.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t={name:"BlackBerry"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(web|hpw)[o0]s/i],describe(e){const t={name:"WebOS Browser"},n=S.getFirstMatch(X,e)||S.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/bada/i],describe(e){const t={name:"Bada"},n=S.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/tizen/i],describe(e){const t={name:"Tizen"},n=S.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/qupzilla/i],describe(e){const t={name:"QupZilla"},n=S.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/firefox|iceweasel|fxios/i],describe(e){const t={name:"Firefox"},n=S.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/electron/i],describe(e){const t={name:"Electron"},n=S.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/MiuiBrowser/i],describe(e){const t={name:"Miui"},n=S.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/chromium/i],describe(e){const t={name:"Chromium"},n=S.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/chrome|crios|crmo/i],describe(e){const t={name:"Chrome"},n=S.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/GSA/i],describe(e){const t={name:"Google Search"},n=S.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t={name:"Android Browser"},n=S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/playstation 4/i],describe(e){const t={name:"PlayStation 4"},n=S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/safari|applewebkit/i],describe(e){const t={name:"Safari"},n=S.getFirstMatch(X,e);return n&&(t.version=n),t}},{test:[/.*/i],describe(e){const t=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,r=e.search("\\(")!==-1?n:t;return{name:S.getFirstMatch(r,e),version:S.getSecondMatch(r,e)}}}],By=[{test:[/Roku\/DVP/],describe(e){const t=S.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:$e.Roku,version:t}}},{test:[/windows phone/i],describe(e){const t=S.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:$e.WindowsPhone,version:t}}},{test:[/windows /i],describe(e){const t=S.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),n=S.getWindowsVersionName(t);return{name:$e.Windows,version:t,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(e){const t={name:$e.iOS},n=S.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return n&&(t.version=n),t}},{test:[/macintosh/i],describe(e){const t=S.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),n=S.getMacOSVersionName(t),s={name:$e.MacOS,version:t};return n&&(s.versionName=n),s}},{test:[/(ipod|iphone|ipad)/i],describe(e){const t=S.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:$e.iOS,version:t}}},{test(e){const t=!e.test(/like android/i),n=e.test(/android/i);return t&&n},describe(e){const t=S.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),n=S.getAndroidVersionName(t),s={name:$e.Android,version:t};return n&&(s.versionName=n),s}},{test:[/(web|hpw)[o0]s/i],describe(e){const t=S.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),n={name:$e.WebOS};return t&&t.length&&(n.version=t),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(e){const t=S.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||S.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||S.getFirstMatch(/\bbb(\d+)/i,e);return{name:$e.BlackBerry,version:t}}},{test:[/bada/i],describe(e){const t=S.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:$e.Bada,version:t}}},{test:[/tizen/i],describe(e){const t=S.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:$e.Tizen,version:t}}},{test:[/linux/i],describe(){return{name:$e.Linux}}},{test:[/CrOS/],describe(){return{name:$e.ChromeOS}}},{test:[/PlayStation 4/],describe(e){const t=S.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:$e.PlayStation4,version:t}}}],My=[{test:[/googlebot/i],describe(){return{type:ie.bot,vendor:"Google"}}},{test:[/huawei/i],describe(e){const t=S.getFirstMatch(/(can-l01)/i,e)&&"Nova",n={type:ie.mobile,vendor:"Huawei"};return t&&(n.model=t),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:ie.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:ie.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:ie.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:ie.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:ie.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:ie.tablet}}},{test(e){const t=e.test(/ipod|iphone/i),n=e.test(/like (ipod|iphone)/i);return t&&!n},describe(e){const t=S.getFirstMatch(/(ipod|iphone)/i,e);return{type:ie.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:ie.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(e){const t=S.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),n={type:ie.mobile,vendor:"Nokia"};return t&&(n.model=t),n}},{test:[/[^-]mobi/i],describe(){return{type:ie.mobile}}},{test(e){return e.getBrowserName(!0)==="blackberry"},describe(){return{type:ie.mobile,vendor:"BlackBerry"}}},{test(e){return e.getBrowserName(!0)==="bada"},describe(){return{type:ie.mobile}}},{test(e){return e.getBrowserName()==="windows phone"},describe(){return{type:ie.mobile,vendor:"Microsoft"}}},{test(e){const t=Number(String(e.getOSVersion()).split(".")[0]);return e.getOSName(!0)==="android"&&t>=3},describe(){return{type:ie.tablet}}},{test(e){return e.getOSName(!0)==="android"},describe(){return{type:ie.mobile}}},{test(e){return e.getOSName(!0)==="macos"},describe(){return{type:ie.desktop,vendor:"Apple"}}},{test(e){return e.getOSName(!0)==="windows"},describe(){return{type:ie.desktop}}},{test(e){return e.getOSName(!0)==="linux"},describe(){return{type:ie.desktop}}},{test(e){return e.getOSName(!0)==="playstation 4"},describe(){return{type:ie.tv}}},{test(e){return e.getOSName(!0)==="roku"},describe(){return{type:ie.tv}}}],Dy=[{test(e){return e.getBrowserName(!0)==="microsoft edge"},describe(e){if(/\sedg\//i.test(e))return{name:bt.Blink};const n=S.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:bt.EdgeHTML,version:n}}},{test:[/trident/i],describe(e){const t={name:bt.Trident},n=S.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){return e.test(/presto/i)},describe(e){const t={name:bt.Presto},n=S.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test(e){const t=e.test(/gecko/i),n=e.test(/like gecko/i);return t&&!n},describe(e){const t={name:bt.Gecko},n=S.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:bt.Blink}}},{test:[/(apple)?webkit/i],describe(e){const t={name:bt.WebKit},n=S.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return n&&(t.version=n),t}}];class vc{constructor(t,n=!1){if(t==null||t==="")throw new Error("UserAgent parameter can't be empty");this._ua=t,this.parsedResult={},n!==!0&&this.parse()}getUA(){return this._ua}test(t){return t.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const t=S.find(Oy,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(t){return t?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const t=S.find(By,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(s=>this.test(s));
30throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os}getOSName(t){const{name:n}=this.getOS();return t?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(t=!1){const{type:n}=this.getPlatform();return t?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const t=S.find(My,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(t){return t?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const t=S.find(Dy,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(s=>this.test(s));throw new Error("Browser's test function is not valid")});return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return S.assign({},this.parsedResult)}satisfies(t){const n={};let s=0;const r={};let i=0;if(Object.keys(t).forEach(a=>{const c=t[a];typeof c=="string"?(r[a]=c,i+=1):typeof c=="object"&&(n[a]=c,s+=1)}),s>0){const a=Object.keys(n),c=S.find(a,u=>this.isOS(u));if(c){const u=this.satisfies(n[c]);if(u!==void 0)return u}const d=S.find(a,u=>this.isPlatform(u));if(d){const u=this.satisfies(n[d]);if(u!==void 0)return u}}if(i>0){const a=Object.keys(r),c=S.find(a,d=>this.isBrowser(d,!0));if(c!==void 0)return this.compareVersion(r[c])}}isBrowser(t,n=!1){const s=this.getBrowserName().toLowerCase();let r=t.toLowerCase();const i=S.getBrowserTypeByAlias(r);return n&&i&&(r=i.toLowerCase()),r===s}compareVersion(t){let n=[0],s=t,r=!1;const i=this.getBrowserVersion();if(typeof i=="string")return t[0]===">"||t[0]==="<"?(s=t.substr(1),t[1]==="="?(r=!0,s=t.substr(2)):n=[],t[0]===">"?n.push(1):n.push(-1)):t[0]==="="?s=t.substr(1):t[0]==="~"&&(r=!0,s=t.substr(1)),n.indexOf(S.compareVersions(i,s,r))>-1}isOS(t){return this.getOSName(!0)===String(t).toLowerCase()}isPlatform(t){return this.getPlatformType(!0)===String(t).toLowerCase()}isEngine(t){return this.getEngineName(!0)===String(t).toLowerCase()}is(t,n=!1){return this.isBrowser(t,n)||this.isOS(t)||this.isPlatform(t)}some(t=[]){return t.some(n=>this.is(n))}}/*!
31 * Bowser - a browser detector
32 * https://github.com/lancedikson/bowser
33 * MIT License | (c) Dustin Diaz 2012-2015
34 * MIT License | (c) Denis Demchenko 2015-2019
35 */class Il{static getParser(t,n=!1){if(typeof t!="string")throw new Error("UserAgent should be a string");return new vc(t,n)}static parse(t){return new vc(t).getResult()}static get BROWSER_MAP(){return Rl}static get ENGINE_MAP(){return bt}static get OS_MAP(){return $e}static get PLATFORMS_MAP(){return ie}}const Eo=({serviceId:e,clientVersion:t})=>async n=>{const s=typeof window<"u"&&window?.navigator?.userAgent?Il.parse(window.navigator.userAgent):void 0,r=[["aws-sdk-js",t],["ua","2.1"],[`os/${s?.os?.name||"other"}`,s?.os?.version],["lang/js"],["md/browser",`${s?.browser?.name??"unknown"}_${s?.browser?.version??"unknown"}`]];e&&r.push([`api/${e}`,t]);const i=await n?.userAgentAppId?.();return i&&r.push([`app/${i}`]),r},xo=e=>()=>Promise.reject(e),kl="required",Ne="fn",Oe="argv",En="ref",Ac=!0,Cc="isSet",Fn="booleanEquals",Kt="error",nt="endpoint",ft="tree",_o="PartitionResult",vo="getAttr",_n="stringEquals",Rc={[kl]:!1,type:"String"},Ic={[kl]:!0,default:!1,type:"Boolean"},kc={[En]:"Endpoint"},Tl={[Ne]:Fn,[Oe]:[{[En]:"UseFIPS"},!0]},Pl={[Ne]:Fn,[Oe]:[{[En]:"UseDualStack"},!0]},fe={},Rn={[En]:"Region"},Tc={[Ne]:vo,[Oe]:[{[En]:_o},"supportsFIPS"]},Nl={[En]:_o},Pc={[Ne]:Fn,[Oe]:[!0,{[Ne]:vo,[Oe]:[Nl,"supportsDualStack"]}]},Nc=[Tl],Oc=[Pl],Bc=[Rn],Fy={parameters:{Region:Rc,UseDualStack:Ic,UseFIPS:Ic,Endpoint:Rc},rules:[{conditions:[{[Ne]:Cc,[Oe]:[kc]}],rules:[{conditions:Nc,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Kt},{conditions:Oc,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Kt},{endpoint:{url:kc,properties:fe,headers:fe},type:nt}],type:ft},{conditions:[{[Ne]:Cc,[Oe]:Bc}],rules:[{conditions:[{[Ne]:"aws.partition",[Oe]:Bc,assign:_o}],rules:[{conditions:[Tl,Pl],rules:[{conditions:[{[Ne]:Fn,[Oe]:[Ac,Tc]},Pc],rules:[{conditions:[{[Ne]:_n,[Oe]:[Rn,"us-east-1"]}],endpoint:{url:"https://cognito-identity-fips.us-east-1.amazonaws.com",properties:fe,headers:fe},type:nt},{conditions:[{[Ne]:_n,[Oe]:[Rn,"us-east-2"]}],endpoint:{url:"https://cognito-identity-fips.us-east-2.amazonaws.com",properties:fe,headers:fe},type:nt},{conditions:[{[Ne]:_n,[Oe]:[Rn,"us-west-1"]}],endpoint:{url:"https://cognito-identity-fips.us-west-1.amazonaws.com",properties:fe,headers:fe},type:nt},{conditions:[{[Ne]:_n,[Oe]:[Rn,"us-west-2"]}],endpoint:{url:"https://cognito-identity-fips.us-west-2.amazonaws.com",properties:fe,headers:fe},type:nt},{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:fe,headers:fe},type:nt}],type:ft},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Kt}],type:ft},{conditions:Nc,rules:[{conditions:[{[Ne]:Fn,[Oe]:[Tc,Ac]}],rules:[{endpoint:{url:"https://cognito-identity-fips.{Region}.{PartitionResult#dnsSuffix}",properties:fe,headers:fe},type:nt}],type:ft},{error:"FIPS is enabled but this partition does not support FIPS",type:Kt}],type:ft},{conditions:Oc,rules:[{conditions:[Pc],rules:[{conditions:[{[Ne]:_n,[Oe]:["aws",{[Ne]:vo,[Oe]:[Nl,"name"]}]}],endpoint:{url:"https://cognito-identity.{Region}.amazonaws.com",properties:fe,headers:fe},type:nt},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:fe,headers:fe},type:nt}],type:ft},{error:"DualStack is enabled but this partition does not support DualStack",type:Kt}],type:ft},{endpoint:{url:"https://cognito-identity.{Region}.{PartitionResult#dnsSuffix}",properties:fe,headers:fe},type:nt}],type:ft}],type:ft},{error:"Invalid Configuration: Missing Region",type:Kt}]},$y=Fy,Uy=new Ki({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Ly=(e,t={})=>Uy.get(e,()=>Zi($y,{endpointParams:e,logger:t.logger}));cn.aws=js;const jy=e=>({apiVersion:"2014-06-30",base64Decoder:e?.base64Decoder??Un,base64Encoder:e?.base64Encoder??Ln,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Ly,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??uy,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvi
35der:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Hs},{schemeId:"smithy.api#noAuth",identityProvider:t=>t.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new Jf}],logger:e?.logger??new qs,serviceId:e?.serviceId??"Cognito Identity",urlParser:e?.urlParser??dn,utf8Decoder:e?.utf8Decoder??pt,utf8Encoder:e?.utf8Encoder??wn}),Hy=["in-region","cross-region","mobile","standard","legacy"],Ao=({defaultsMode:e}={})=>Tp(async()=>{const t=typeof e=="function"?await e():e;switch(t?.toLowerCase()){case"auto":return Promise.resolve(zy()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(t?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Hy.join(", ")}, got ${t}`)}}),zy=()=>{const t=(typeof window<"u"&&window?.navigator?.userAgent?Il.parse(window.navigator.userAgent):void 0)?.platform?.type;return t==="tablet"||t==="mobile"},qy=e=>{const t=Ao(e),n=()=>t().then(no),s=jy(e);return{...s,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??eo,credentialDefaultProvider:e?.credentialDefaultProvider??(r=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??Eo({serviceId:s.serviceId,clientVersion:py.version}),maxAttempts:e?.maxAttempts??hn,region:e?.region??xo("Region is missing"),requestHandler:jn.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||mo),sha256:e?.sha256??So,streamCollector:e?.streamCollector??$s,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(uo)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(lo))}},Co=e=>({setRegion(t){e.region=t},region(){return e.region}}),Ro=e=>({region:e.region()}),Vy=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,s=e.credentials;return{setHttpAuthScheme(r){const i=t.findIndex(o=>o.schemeId===r.schemeId);i===-1?t.push(r):t.splice(i,1,r)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(r){n=r},httpAuthSchemeProvider(){return n},setCredentials(r){s=r},credentials(){return s}}},Wy=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),Ky=(e,t)=>{const n=Object.assign(Co(e),so(e),Oi(e),Vy(e));return t.forEach(s=>s.configure(n)),Object.assign(e,Ro(n),ro(n),Bi(n),Wy(n))};class Gy extends to{config;constructor(...[t]){const n=qy(t||{});super(n),this.initConfig=n;const s=hy(n),r=Wi(s),i=wo(r),o=ho(i),a=o,c=go(a),d=ly(c),u=Ky(d,t?.extensions||[]);this.config=u,this.middlewareStack.use(co(this.config)),this.middlewareStack.use(bo(this.config)),this.middlewareStack.use(fo(this.config)),this.middlewareStack.use(Mi(this.config)),this.middlewareStack.use(Di(this.config)),this.middlewareStack.use(Fi(this.config)),this.middlewareStack.use($i(this.config,{httpAuthSchemeParametersProvider:cy,identityProviderConfigProvider:async h=>new Vi({"aws.auth#sigv4":h.credentials})})),this.middlewareStack.use(Li(this.config))}destroy(){super.destroy()}}function Ol(e){return Promise.all(Object.keys(e).reduce((t,n)=>{const s=e[n];return typeof s=="string"?t.push([n,s]):t.push(s().then(r=>[n,r])),t},[])).then(t=>t.reduce((n,[s,r])=>(n[s]=r,n),{}))}function Jy(e){return async t=>{e.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");const{GetCredentialsForIdentityCommand:n,CognitoIdentityClient:s}=await $u(async()=>{const{GetCredentialsForIdentityCommand:d,CognitoIdentityClient:u}=await import("./C-Ujnt9t.js");return{GetCredentialsForIdentityCommand:d,CognitoIdentityClient:u}},[],import.meta.url),r=d=>e.clientConfig?.[d]??e.parentClientConfig?.[d]??t?.callerClientConfig?.[d],{Credentials:{AccessKeyId:i=Zy(e.logger),Expiration:o,SecretKey:a=Yy(e.logger),SessionToken:c}=Xy(e.logger)}=await(e.client??new s(Object.assign({},e.clientConfig??{},{region:r("region"),profile:r("profile")}))).send(new n({CustomRoleArn:e.customRoleArn,IdentityId:e.identityId,Logins:e.logins?await Ol(e.logins):void 0}));return{identityId:e.identityId,accessKeyId:i,secretAccessKey:a,sessionToken:c,expiration:o}}}function Zy(e){throw new Sn("Response from Amazon Cognito contained no access key ID",{logger:e})}function Xy(e){throw new Sn("Response from Amazon Cognito contained no credentials",{logger:e})}function Yy(e){throw new Sn("Response from Amazon Cognito contained no secret key",{logger:e})}const dr="IdentityIds";class Qy{dbName;constructor(t="aws:cognito-identity-ids"){this.dbName=t}getItem(t){return this.withObjectStore("readonly",n=>{const s=n.get(t);return new Promise(r=>{s.onerror=()=>r(null),s.onsuccess=()=>r(s.result?s.result.value:null)})}).catch(()=>null)}removeItem(t){return this.withObjectStore("readwrite",n=>{const s=n.delete(t);return new Promise((r,i)=>{s.onerror=()=>i(s.error),s.onsuccess=()=>r()})})}setItem(t,n){return this.withObjectStore("readwrite",s=>{const r=s.put({id:t,value:n});return new Promise((i,o)=>{r.onerror=()=>o(r.error),r.onsuccess=()=>i()})})}getDb(){const t=self.indexedDB.open(this.dbName,1);return new Promise((n,s)=>{t.onsuccess=()=>{n(t.result)},t.onerror=()=>{s(t.error)},t.onblocked=()=>{s(new Error("Unable to access DB"))},t.onupgradeneeded=()=>{const r=t.result;r.onerror=()=>{s(new Error("Failed to create object store"))},r.createObjectStore(dr,{keyPath:"id"})}})}withObjectStore(t,n){return this.getDb().then(s=>{const r=s.transaction(dr,t);return r.oncomplete=()=>s.close(),new Promise((i,o)=>{r.onerror=()=>o(r.error),i(n(r.objectStore(dr)))}).catch(i=>{throw s.close(),i})})}}class ew{store;constructor(t={}){this.store=t}getItem(t){return t in this.store?this.store[t]:null}removeItem(t){delete this.store[t]}setItem(t,n){this.store[t]=n}}const tw=new ew;function nw(){return typeof self=="object"&&self.indexedDB?new Qy:typeof window=="object"&&window.localStorage?window.localStorage:tw}
35function sw({accountId:e,cache:t=nw(),client:n,clientConfig:s,customRoleArn:r,identityPoolId:i,logins:o,userIdentifier:a=!o||Object.keys(o).length===0?"ANONYMOUS":void 0,logger:c,parentClientConfig:d}){c?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");const u=a?`aws:cognito-identity-credentials:${i}:${a}`:void 0;let h=async p=>{const{GetIdCommand:y,CognitoIdentityClient:x}=await $u(async()=>{const{GetIdCommand:P,CognitoIdentityClient:Z}=await import("./C-Ujnt9t.js");return{GetIdCommand:P,CognitoIdentityClient:Z}},[],import.meta.url),A=P=>s?.[P]??d?.[P]??p?.callerClientConfig?.[P],_=n??new x(Object.assign({},s??{},{region:A("region"),profile:A("profile")}));let T=u&&await t.getItem(u);if(!T){const{IdentityId:P=rw(c)}=await _.send(new y({AccountId:e,IdentityPoolId:i,Logins:o?await Ol(o):void 0}));T=P,u&&Promise.resolve(t.setItem(u,T)).catch(()=>{})}return h=Jy({client:_,customRoleArn:r,logins:o,identityId:T}),h(p)};return p=>h(p).catch(async y=>{throw u&&Promise.resolve(t.removeItem(u)).catch(()=>{}),y})}function rw(e){throw new Sn("Response from Amazon Cognito contained no identity ID",{logger:e})}const Bl="preferred",iw=["disabled","preferred","required"];function ow(e){return iw.includes(e)}const aw=e=>{const{accountIdEndpointMode:t}=e,n=Me(t??Bl);return Object.assign(e,{accountIdEndpointMode:async()=>{const s=await n();if(!ow(s))throw new Error(`Invalid value for accountIdEndpointMode: ${s}. Valid values are: "required", "preferred", "disabled".`);return s}})};function cw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ur,Mc;function dw(){if(Mc)return ur;Mc=1;function e(t){Object.defineProperty(this,"_next",{writable:!1,enumerable:!1,value:t}),this.done=!1}return e.prototype.next=function(){if(this.done)return{done:!0};var t=this._next();return t.done&&(this.done=!0),t},typeof Symbol<"u"&&(e.prototype[Symbol.iterator]=function(){return this}),e.of=function(){var t=arguments,n=t.length,s=0;return new e(function(){return s>=n?{done:!0}:{done:!1,value:t[s++]}})},e.empty=function(){var t=new e(null);return t.done=!0,t},e.is=function(t){return t instanceof e?!0:typeof t=="object"&&t!==null&&typeof t.next=="function"},ur=e,ur}var lr,Dc;function Ml(){if(Dc)return lr;Dc=1;var e=typeof ArrayBuffer<"u",t=typeof Symbol<"u";function n(s,r){var i,o,a,c,d;if(!s)throw new Error("obliterator/forEach: invalid iterable.");if(typeof r!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(s)||e&&ArrayBuffer.isView(s)||typeof s=="string"||s.toString()==="[object Arguments]"){for(a=0,c=s.length;a<c;a++)r(s[a],a);return}if(typeof s.forEach=="function"){s.forEach(r);return}if(t&&Symbol.iterator in s&&typeof s.next!="function"&&(s=s[Symbol.iterator]()),typeof s.next=="function"){for(i=s,a=0;d=i.next(),d.done!==!0;)r(d.value,a),a++;return}for(o in s)s.hasOwnProperty(o)&&r(s[o],o)}return n.forEachWithNullKeys=function(s,r){var i,o,a,c,d;if(!s)throw new Error("obliterator/forEachWithNullKeys: invalid iterable.");if(typeof r!="function")throw new Error("obliterator/forEachWithNullKeys: expecting a callback.");if(Array.isArray(s)||e&&ArrayBuffer.isView(s)||typeof s=="string"||s.toString()==="[object Arguments]"){for(a=0,c=s.length;a<c;a++)r(s[a],null);return}if(s instanceof Set){s.forEach(function(u){r(u,null)});return}if(typeof s.forEach=="function"){s.forEach(r);return}if(t&&Symbol.iterator in s&&typeof s.next!="function"&&(s=s[Symbol.iterator]()),typeof s.next=="function"){for(i=s,a=0;d=i.next(),d.done!==!0;)r(d.value,null),a++;return}for(o in s)s.hasOwnProperty(o)&&r(s[o],o)},lr=n,lr}var hr={},Fc;function Dl(){return Fc||(Fc=1,(function(e){var t=Math.pow(2,8)-1,n=Math.pow(2,16)-1,s=Math.pow(2,32)-1,r=Math.pow(2,7)-1,i=Math.pow(2,15)-1,o=Math.pow(2,31)-1;e.getPointerArray=function(c){var d=c-1;return d<=t?Uint8Array:d<=n?Uint16Array:d<=s?Uint32Array:Float64Array},e.getSignedPointerArray=function(c){var d=c-1;return d<=r?Int8Array:d<=i?Int16Array:d<=o?Int32Array:Float64Array},e.getNumberType=function(c){return c===(c|0)?Math.sign(c)===-1?c<=127&&c>=-128?Int8Array:c<=32767&&c>=-32768?Int16Array:Int32Array:c<=255?Uint8Array:c<=65535?Uint16Array:Uint32Array:Float64Array};var a={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};e.getMinimalRepresentation=function(c,d){var u=null,h=0,p,y,x,A,_;for(A=0,_=c.length;A<_;A++)x=d?d(c[A]):c[A],y=e.getNumberType(x),p=a[y.name],p>h&&(h=p,u=y);return u},e.isTypedArray=function(c){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(c)},e.concat=function(){var c=0,d,u,h;for(d=0,h=arguments.length;d<h;d++)c+=arguments[d].length;var p=new arguments[0].constructor(c);for(d=0,u=0;d<h;d++)p.set(arguments[d],u),u+=arguments[d].length;return p},e.indices=function(c){for(var d=e.getPointerArray(c),u=new d(c),h=0;h<c;h++)u[h]=h;return u}})(hr)),hr}var Gt={},$c;function uw(){if($c)return Gt;$c=1;var e=Ml(),t=Dl();function n(o){return Array.isArray(o)||t.isTypedArray(o)}function s(o){if(typeof o.length=="number")return o.length;if(typeof o.size=="number")return o.size}function r(o){var a=s(o),c=typeof a=="number"?new Array(a):[],d=0;return e(o,function(u){c[d++]=u}),c}function i(o){var a=s(o),c=typeof a=="number"?t.getPointerArray(a):Array,d=typeof a=="number"?new Array(a):[],u=typeof a=="number"?new c(a):[],h=0;return e(o,function(p){d[h]=p,u[h]=h++}),[d,u]}return Gt.isArrayLike=n,Gt.guessLength=s,Gt.toArray=r,Gt.toArrayWithIndices=i,Gt}var fr,Uc;function lw(){if(Uc)return fr;Uc=1;var e=dw(),t=Ml(),n=Dl(),s=uw();function r(i,o,a){if(arguments.length<2&&(a=i,i=null,o=null),this.capacity=a,typeof this.capacity!="number"||this.capacity<=0)throw new Error("mnemonist/lru-cache: capacity should be positive number.");var c=n.getPointerArray(a);this.forward=new c(a),this.backward=new c(a),this.K=typeof i=="function"?new i(a):new Array(a),this.V=typeof o=="function"?new o(a):new Array(a),this.size=0,this.head=0,this.tail=0,this.items={}}return r.prototype.clear=function(){this.size=0,this.head=0,this.tail=0,this.items={}},r.prototype.splayOnTop=function(i){var o=this.head;if(this.head===i)return this;var a=this.backward[i],c=this.forward[i];return this.tail===i?this.tail=a:this.backward[c]=a,this.forward[a]=c,this.backward[o]=i,this.head=i,this.forward[i]=o,this},r.prototype.set=function(i,o){var a=this.items[i];if(typeof a<"u"){this.splayOnTop(a),this.V[a]=o;return}this.size<this.capacity?a=this.size++:(a=this.tail,this.tail=this.backward[a],delete this.items[this.K[a]]),this.items[i]=a,this.K[a]=i,this.V[a]=o,this.forward[a]=this.head,this.backward[this.head]=a,this.head=a},r.prototype.setpop=function(i,o){var a=null,c=null,d=this.items[i];return typeof d<"u"?(this.splayOnTop(d),a=this.V[d],this.V[d]=o,{evicted:!1,key:i,value:a}):(this.size<this.capacity?d=this.size++:(d=this.tail,this.tail=this.backward[d],a=this.V[d],c=this.K[d],delete this.items[this.K[d]]),this.items[i]=d,this.K[d]=i,this.V[d]=o,this.forward[d]=this.head,this.backward[this.head]=d,this.head=d,c?{evicted:!0,key:c,value:a}:null)},r.prototype.has=function(i){return i in this.items},r.prototype.get=function(i){var o=this.items[i];if(!(typeof o>"u"))return this.splayOnTop(o),this.V[o]},r.prototype.peek=function(i){var o=this.items[i];if(!(typeof o>"u"))return this.V[o]},r.prototype.forEach=function(i,o){o=arguments.length>1?o:this;for(var a=0,c=this.size,d=this.head,u=this.K,h=this.V,p=this.forward;a<c;)i.call(o,h[d],u[d],this),d=p[d],a++},r.prototype.keys=function(){var i=0,o=this.size,a=this.head,c=this.K,d=this.forward;return new e(function(){if(i>=o)return{done:!0};var u=c[a];return i++,i<o&&(a=d[a]),{done:!1,value:u}})},r.prototype.values=function(){var i=0,o=this.size,a=this.head,c=this.V,d=this.forward;return new e(function(){if(i>=o)return{done:!0};var u=c[a];return i++,i<o&&(a=d[a]),{done:!1,value:u}})},r.prototype.entries=function(){var i=0,o=this.size,a=this.head,c=this.K,d=this.V,u=this.forward;return new e(function(){if(i>=o)return{done:!0};var h=c[a],p=d[a];return i++,i<o&&(a=u[a]),{done:!1,value:[h,p]}})},typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=r.prototype.entries),r.prototype.inspect=function(){for(var i=new Map,o=this.entries(),a;a=o.next(),!a.done;)i.set(a.value[0],a.value[1]);return Object.defineProperty(i,"constructor",{value:r,enumerable:!1}),i},typeof Symbol<"u"&&(r.prototype[Symbol.for("nodejs.util.inspect.custom")]=r.prototype.inspect),r.from=function(i,o,a,c){if(arguments.length<2){if(c=s.guessLength(i),typeof c!="number")throw new Error("mnemonist/lru-cache.from: could not guess iterable length. Please provide desired capacity as last argument.")}else arguments.length===2&&(c=o,o=null,a=null);var d=new r(o,a,c);return t(i,function(u,h){d.set(h,u)}),d},fr=r,fr}var hw=lw();const fw=cw(hw);class pw{cache;constructor(t){this.cache=new fw(t)}getEndpoint(t){const n=this.get(t);if(!n||n.length===0)return;const s=n.map(r=>r.Address);return s[Math.floor(Math.random()*s.length)]}get(t){if(!this.has(t))return;const n=this.cache.get(t);if(!n)return;const s=Date.now(),r=n.filter(i=>s<i.Expires);if(r.length===0){this.delete(t);return}return r}set(t,n){const s=Date.now();this.cache.set(t,n.map(({Address:r,CachePeriodInMinutes:i})=>({Address:r,Expires:s+i*60*1e3})))}delete(t){this.cache.set(t,[])}has(t){if(!this.cache.has(t))return!1;const n=this.cache.peek(t);return n?n.length>0:!1}clear(){this.cache.clear()}}const gw=(e,{endpointDiscoveryCommandCtor:t})=>{const{endpointCacheSize:n,endpointDiscoveryEnabled:s,endpointDiscoveryEnabledProvider:r}=e;return Object.assign(e,{endpointDiscoveryCommandCtor:t,endpointCache:new pw(n??1e3),endpointDiscoveryEnabled:s!==void 0?()=>Promise.resolve(s):r,isClientEndpointDiscoveryEnabled:s!==void 0})},mw=async(e,t,n)=>({operation:kt(t).operation,region:await Me(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function yw(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"dynamodb",region:e.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}const ww=e=>{const t=[];switch(e.operation){default:t.push(yw(e))}return t},bw=e=>{const t=Qi(e);return Object.assign(t,{authSchemePreference:Me(e.authSchemePreference??[])})},Sw=e=>Object.assign(e,{useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"dynamodb"}),Fl={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},AccountId:{type:"builtInParams",name:"accountId"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"},AccountIdEndpointMode:{type:"builtInParams",name:"accountIdEndpointMode"}};class L extends Ft{constructor(t){super(t),Object.setPrototypeOf(this,L.prototype)}}class Io extends L{name="BackupInUseException";$fault="client";constructor(t){super({name:"BackupInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,Io.prototype)}}class ko extends L{name="BackupNotFoundException";$fault="client";constructor(t){super({name:"BackupNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,ko.prototype)}}class To extends L{name="InternalServerError";$fault="server";constructor(t){super({name:"InternalServerError",$fault:"server",...t}),Object.setPrototypeOf(this,To.prototype)}}class Po extends L{name="RequestLimitExceeded";$fault="client";ThrottlingReasons;constructor(t){super({name:"RequestLimitExceeded",$fault:"client",...t}),Object.setPrototypeOf(this,Po.prototype),this.ThrottlingReasons=t.ThrottlingReasons}}class No extends L{name="ThrottlingException";$fault="client";throttlingReasons;constructor(t){super({name:"ThrottlingException",$fault:"client",...t}),Object.setPrototypeOf(this,No.prototype),this.throttlingReasons=t.throttlingReasons}}class Oo extends L{name="InvalidEndpointException";$fault="client";Message;constructor(t){super({name:"InvalidEndpointException",$fault:"client",...t}),Object.setPrototypeOf(this,Oo.prototype),this.Message=t.Message}}class Bo extends L{name="ProvisionedThroughputExceededException";$fault="client";ThrottlingReasons;constructor(t){super({name:"ProvisionedThroughputExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,Bo.prototype),this.ThrottlingReasons=t.ThrottlingReasons}}class Mo extends L{name="ResourceNotFoundException";$fault="client";constructor(t){super({name:"ResourceNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,Mo.prototype)}}class Do extends L{name="ItemCollectionSizeLimitExceededException";$fault="client";constructor(t){super({name:"ItemCollectionSizeLimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,Do.prototype)}}class Fo extends L{name="ReplicatedWriteConflictException";$fault="client";$retryable={};constructor(t){super({name:"ReplicatedWriteConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,Fo.prototype)}}class $o extends L{name="ContinuousBackupsUnavailableException";$fault="client";constructor(t){super({name:"ContinuousBackupsUnavailableException",$fault:"client",...t}),Object.setPrototypeOf(this,$o.prototype)}}class Uo extends L{name="LimitExceededException";$fault="client";constructor(t){super({name:"LimitExceededException",$fault:"client",...t}),Object.setPrototypeOf(this,Uo.prototype)}}class Lo extends L{name="TableInUseException";$fault="client";constructor(t){super({name:"TableInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,Lo.prototype)}}class jo extends L{name="TableNotFoundException";$fault="client";constructor(t){super({name:"TableNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,jo.prototype)}}class Ho extends L{name="GlobalTableAlreadyExistsException";$fault="client";constructor(t){super({name:"GlobalTableAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,Ho.prototype)}}class zo extends L{name="ResourceInUseException";$fault="client";constructor(t){super({name:"ResourceInUseException",$fault:"client",...t}),Object.setPrototypeOf(this,zo.prototype)}}const Xx={UPDATED_NEW:"UPDATED_NEW"};class qo extends L{name="TransactionConflictException";$fault="client";constructor(t){super({name:"TransactionConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,qo.prototype)}}class Vo extends L{name="PolicyNotFoundException";$fault="client";constructor(t){super({name:"PolicyNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,Vo.prototype)}}class Wo extends L{name="ExportNotFoundException";$fault="client";constructor(t){super({name:"ExportNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,Wo.prototype)}}class Ko extends L{name="GlobalTableNotFoundException";$fault="client";constructor(t){super({name:"GlobalTableNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,Ko.prototype)}}class Go extends L{name="ImportNotFoundException";$fault="client";constructor(t){super({name:"ImportNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,Go.prototype)}}class Jo extends L{name="DuplicateItemException";$fault="client";constructor(t){super({name:"DuplicateItemException",$fault:"client",...t}),Object.setPrototypeOf(this,Jo.prototype)}}class Zo extends L{name="IdempotentParameterMismatchException";$fault="client";Message;constructor(t){super({name:"IdempotentParameterMismatchException",$fault:"client",...t}),Object.setPrototypeOf(this,Zo.prototype),this.Message=t.Message}}class Xo extends L{name="TransactionInProgressException";$fault="client";Message;constructor(t){super({name:"TransactionInProgressException",$fault:"client",...t}),Object.setPrototypeOf(this,Xo.prototype),this.Message=t.Message}}class Yo extends L{name="ExportConflictException";$fault="client";constructor(t){super({name:"ExportConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,Yo.prototype)}}class Qo extends L{name="InvalidExportTimeException";$fault="client";constructor(t){super({name:"InvalidExportTimeException",$fault:"client",...t}),Object.setPrototypeOf(this,Qo.prototype)}}class ea extends L{name="PointInTimeRecoveryUnavailableException";$fault="client";constructor(t){super({name:"PointInTimeRecoveryUnavailableException",$fault:"client",...t}),Object.setPrototypeOf(this,ea.prototype)}}class ta extends L{name="ImportConflictException";$fault="clien
35t";constructor(t){super({name:"ImportConflictException",$fault:"client",...t}),Object.setPrototypeOf(this,ta.prototype)}}class na extends L{name="TableAlreadyExistsException";$fault="client";constructor(t){super({name:"TableAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,na.prototype)}}class sa extends L{name="InvalidRestoreTimeException";$fault="client";constructor(t){super({name:"InvalidRestoreTimeException",$fault:"client",...t}),Object.setPrototypeOf(this,sa.prototype)}}class ra extends L{name="ReplicaAlreadyExistsException";$fault="client";constructor(t){super({name:"ReplicaAlreadyExistsException",$fault:"client",...t}),Object.setPrototypeOf(this,ra.prototype)}}class ia extends L{name="ReplicaNotFoundException";$fault="client";constructor(t){super({name:"ReplicaNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,ia.prototype)}}class oa extends L{name="IndexNotFoundException";$fault="client";constructor(t){super({name:"IndexNotFoundException",$fault:"client",...t}),Object.setPrototypeOf(this,oa.prototype)}}var Si;(function(e){e.visit=(t,n)=>t.S!==void 0?n.S(t.S):t.N!==void 0?n.N(t.N):t.B!==void 0?n.B(t.B):t.SS!==void 0?n.SS(t.SS):t.NS!==void 0?n.NS(t.NS):t.BS!==void 0?n.BS(t.BS):t.M!==void 0?n.M(t.M):t.L!==void 0?n.L(t.L):t.NULL!==void 0?n.NULL(t.NULL):t.BOOL!==void 0?n.BOOL(t.BOOL):n._(t.$unknown[0],t.$unknown[1])})(Si||(Si={}));class aa extends L{name="ConditionalCheckFailedException";$fault="client";Item;constructor(t){super({name:"ConditionalCheckFailedException",$fault:"client",...t}),Object.setPrototypeOf(this,aa.prototype),this.Item=t.Item}}class ca extends L{name="TransactionCanceledException";$fault="client";Message;CancellationReasons;constructor(t){super({name:"TransactionCanceledException",$fault:"client",...t}),Object.setPrototypeOf(this,ca.prototype),this.Message=t.Message,this.CancellationReasons=t.CancellationReasons}}const Ew=async(e,t)=>{const n=Gs("DescribeEndpoints");let s;return s=JSON.stringify(B(e)),Ks(t,n,"/",void 0,s)},Yx=async(e,t)=>{const n=Gs("GetItem");let s;return s=JSON.stringify(fb(e,t)),Ks(t,n,"/",void 0,s)},Qx=async(e,t)=>{const n=Gs("Scan");let s;return s=JSON.stringify(mb(e,t)),Ks(t,n,"/",void 0,s)},xw=async(e,t)=>{const n=Gs("UpdateItem");let s;return s=JSON.stringify(yb(e,t)),Ks(t,n,"/",void 0,s)},_w=async(e,t)=>{if(e.statusCode>=300)return Ws(e,t);const n=await zn(e.body,t);let s={};return s=B(n),{$metadata:U(e),...s}},e_=async(e,t)=>{if(e.statusCode>=300)return Ws(e,t);const n=await zn(e.body,t);let s={};return s=xb(n,t),{$metadata:U(e),...s}},t_=async(e,t)=>{if(e.statusCode>=300)return Ws(e,t);const n=await zn(e.body,t);let s={};return s=Tb(n,t),{$metadata:U(e),...s}},vw=async(e,t)=>{if(e.statusCode>=300)return Ws(e,t);const n=await zn(e.body,t);let s={};return s=Nb(n,t),{$metadata:U(e),...s}},Ws=async(e,t)=>{const n={...e,body:await mg(e.body,t)},s=yg(e,n.body);switch(s){case"InternalServerError":case"com.amazonaws.dynamodb#InternalServerError":throw await $w(n);case"RequestLimitExceeded":case"com.amazonaws.dynamodb#RequestLimitExceeded":throw await Zw(n);case"ThrottlingException":case"com.amazonaws.dynamodb#ThrottlingException":throw await nb(n);case"InvalidEndpointException":case"com.amazonaws.dynamodb#InvalidEndpointException":throw await Uw(n);case"ProvisionedThroughputExceededException":case"com.amazonaws.dynamodb#ProvisionedThroughputExceededException":throw await Ww(n);case"ResourceNotFoundException":case"com.amazonaws.dynamodb#ResourceNotFoundException":throw await Yw(n);case"ItemCollectionSizeLimitExceededException":case"com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException":throw await Hw(n);case"ReplicatedWriteConflictException":case"com.amazonaws.dynamodb#ReplicatedWriteConflictException":throw await Jw(n);case"BackupInUseException":case"com.amazonaws.dynamodb#BackupInUseException":throw await Aw(n);case"ContinuousBackupsUnavailableException":case"com.amazonaws.dynamodb#ContinuousBackupsUnavailableException":throw await Iw(n);case"LimitExceededException":case"com.amazonaws.dynamodb#LimitExceededException":throw await zw(n);case"TableInUseException":case"com.amazonaws.dynamodb#TableInUseException":throw await eb(n);case"TableNotFoundException":case"com.amazonaws.dynamodb#TableNotFoundException":throw await tb(n);case"GlobalTableAlreadyExistsException":case"com.amazonaws.dynamodb#GlobalTableAlreadyExistsException":throw await Nw(n);case"ResourceInUseException":case"com.amazonaws.dynamodb#ResourceInUseException":throw await Xw(n);case"BackupNotFoundException":case"com.amazonaws.dynamodb#BackupNotFoundException":throw await Cw(n);case"ConditionalCheckFailedException":case"com.amazonaws.dynamodb#ConditionalCheckFailedException":throw await Rw(n,t);case"TransactionConflictException":case"com.amazonaws.dynamodb#TransactionConflictException":throw await rb(n);case"PolicyNotFoundException":case"com.amazonaws.dynamodb#PolicyNotFoundException":throw await Vw(n);case"ExportNotFoundException":case"com.amazonaws.dynamodb#ExportNotFoundException":throw await Pw(n);case"GlobalTableNotFoundException":case"com.amazonaws.dynamodb#GlobalTableNotFoundException":throw await Ow(n);case"ImportNotFoundException":case"com.amazonaws.dynamodb#ImportNotFoundException":throw await Dw(n);case"DuplicateItemException":case"com.amazonaws.dynamodb#DuplicateItemException":throw await kw(n);case"IdempotentParameterMismatchException":case"com.amazonaws.dynamodb#IdempotentParameterMismatchException":throw await Bw(n);case"TransactionCanceledException":case"com.amazonaws.dynamodb#TransactionCanceledException":throw await sb(n,t);case"TransactionInProgressException":case"com.amazonaws.dynamodb#TransactionInProgressException":throw await ib(n);case"ExportConflictException":case"com.amazonaws.dynamodb#ExportConflictException":throw await Tw(n);case"InvalidExportTimeException":case"com.amazonaws.dynamodb#InvalidExportTimeException":throw await Lw(n);case"PointInTimeRecoveryUnavailableException":case"com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException":throw await qw(n);case"ImportConflictException":case"com.amazonaws.dynamodb#ImportConflictException":throw await Mw(n);case"TableAlreadyExistsException":case"com.amazonaws.dynamodb#TableAlreadyExistsException":throw await Qw(n);case"InvalidRestoreTimeException":case"com.amazonaws.dynamodb#InvalidRestoreTimeException":throw await jw(n);case"ReplicaAlreadyExistsException":case"com.amazonaws.dynamodb#ReplicaAlreadyExistsException":throw await Kw(n);case"ReplicaNotFoundException":case"com.amazonaws.dynamodb#ReplicaNotFoundException":throw await Gw(n);case"IndexNotFoundException":case"com.amazonaws.dynamodb#IndexNotFoundException":throw await Fw(n);default:const r=n.body;return Ob({output:e,parsedBody:r,errorCode:s})}},Aw=async(e,t)=>{const n=e.body,s=B(n),r=new Io({$metadata:U(e),...s});return N(r,n)},Cw=async(e,t)=>{const n=e.body,s=B(n),r=new ko({$metadata:U(e),...s});return N(r,n)},Rw=async(e,t)=>{const n=e.body,s=Eb(n,t),r=new aa({$metadata:U(e),...s});return N(r,n)},Iw=async(e,t)=>{const n=e.body,s=B(n),r=new $o({$metadata:U(e),...s});return N(r,n)},kw=async(e,t)=>{const n=e.body,s=B(n),r=new Jo({$metadata:U(e),...s});return N(r,n)},Tw=async(e,t)=>{const n=e.body,s=B(n),r=new Yo({$metadata:U(e),...s});return N(r,n)},Pw=async(e,t)=>{const n=e.body,s=B(n),r=new Wo({$metadata:U(e),...s});return N(r,n)},Nw=async(e,t)=>{const n=e.body,s=B(n),r=new Ho({$metadata:U(e),...s});return N(r,n)},Ow=async(e,t)=>{const n=e.body,s=B(n),r=new Ko({$metadata:U(e),...s});return N(r,n)},Bw=async(e,t)=>{const n=e.body,s=B(n),r=new Zo({$metadata:U(e),...s});return N(r,n)},Mw=async(e,t)=>{const n=e.body,s=B(n),r=new ta({$metadata:U(e),...s});return N(r,n)},Dw=async(e,t)=>{const n=e.body,s=B(n),r=new Go({$metadata:U(e),...s});return N(r,n)},Fw=async(e,t)=>{const n=e.body,s=B(n),r=new oa({$metadata:U(e),...s});return N(r,n)},$w=async(e,t)=>{const n=e.body,s=B(n),r=new To({$metadata:U(e),...s});return N(r,n)},Uw=async(e,t)=>{const n=e.body,s=B(n),r=new Oo({$metadata:U(e),...s});return N(r,n)},Lw=async(e,t)=>{const n=e.body,s=B(n),r=new Qo({$metadata:U(e),...s});return N(r,n)},jw=async(e,t)=>{const n=e.body,s=B(n),r=new sa({$metadata:U(e),...s});return N(r,n)},Hw=async(e,t)=>{const n=e.body,s=B(n),r=new Do({$metadata:U(e),...s});return N(r,n)},zw=async(e,t)=>
35{const n=e.body,s=B(n),r=new Uo({$metadata:U(e),...s});return N(r,n)},qw=async(e,t)=>{const n=e.body,s=B(n),r=new ea({$metadata:U(e),...s});return N(r,n)},Vw=async(e,t)=>{const n=e.body,s=B(n),r=new Vo({$metadata:U(e),...s});return N(r,n)},Ww=async(e,t)=>{const n=e.body,s=B(n),r=new Bo({$metadata:U(e),...s});return N(r,n)},Kw=async(e,t)=>{const n=e.body,s=B(n),r=new ra({$metadata:U(e),...s});return N(r,n)},Gw=async(e,t)=>{const n=e.body,s=B(n),r=new ia({$metadata:U(e),...s});return N(r,n)},Jw=async(e,t)=>{const n=e.body,s=B(n),r=new Fo({$metadata:U(e),...s});return N(r,n)},Zw=async(e,t)=>{const n=e.body,s=B(n),r=new Po({$metadata:U(e),...s});return N(r,n)},Xw=async(e,t)=>{const n=e.body,s=B(n),r=new zo({$metadata:U(e),...s});return N(r,n)},Yw=async(e,t)=>{const n=e.body,s=B(n),r=new Mo({$metadata:U(e),...s});return N(r,n)},Qw=async(e,t)=>{const n=e.body,s=B(n),r=new na({$metadata:U(e),...s});return N(r,n)},eb=async(e,t)=>{const n=e.body,s=B(n),r=new Lo({$metadata:U(e),...s});return N(r,n)},tb=async(e,t)=>{const n=e.body,s=B(n),r=new jo({$metadata:U(e),...s});return N(r,n)},nb=async(e,t)=>{const n=e.body,s=B(n),r=new No({$metadata:U(e),...s});return N(r,n)},sb=async(e,t)=>{const n=e.body,s=Pb(n,t),r=new ca({$metadata:U(e),...s});return N(r,n)},rb=async(e,t)=>{const n=e.body,s=B(n),r=new qo({$metadata:U(e),...s});return N(r,n)},ib=async(e,t)=>{const n=e.body,s=B(n),r=new Xo({$metadata:U(e),...s});return N(r,n)},ob=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=ab(r,t)),n),{}),Vt=(e,t)=>Si.visit(e,{B:n=>({B:t.base64Encoder(n)}),BOOL:n=>({BOOL:n}),BS:n=>({BS:cb(n,t)}),L:n=>({L:pb(n,t)}),M:n=>({M:gb(n,t)}),N:n=>({N:n}),NS:n=>({NS:B(n)}),NULL:n=>({NULL:n}),S:n=>({S:n}),SS:n=>({SS:B(n)}),_:(n,s)=>({[n]:s})}),$l=(e,t)=>e.filter(n=>n!=null).map(n=>Vt(n,t)),ab=(e,t)=>je(e,{Action:[],Value:n=>Vt(n,t)}),cb=(e,t)=>e.filter(n=>n!=null).map(n=>t.base64Encoder(n)),db=(e,t)=>je(e,{AttributeValueList:n=>$l(n,t),ComparisonOperator:[]}),ub=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=lb(r,t)),n),{}),lb=(e,t)=>je(e,{AttributeValueList:n=>$l(n,t),ComparisonOperator:[],Exists:[],Value:n=>Vt(n,t)}),Ul=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=Vt(r,t)),n),{}),hb=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=db(r,t)),n),{}),fb=(e,t)=>je(e,{AttributesToGet:B,ConsistentRead:[],ExpressionAttributeNames:B,Key:n=>da(n,t),ProjectionExpression:[],ReturnConsumedCapacity:[],TableName:[]}),da=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=Vt(r,t)),n),{}),pb=(e,t)=>e.filter(n=>n!=null).map(n=>Vt(n,t)),gb=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=Vt(r,t)),n),{}),mb=(e,t)=>je(e,{AttributesToGet:B,ConditionalOperator:[],ConsistentRead:[],ExclusiveStartKey:n=>da(n,t),ExpressionAttributeNames:B,ExpressionAttributeValues:n=>Ul(n,t),FilterExpression:[],IndexName:[],Limit:[],ProjectionExpression:[],ReturnConsumedCapacity:[],ScanFilter:n=>hb(n,t),Segment:[],Select:[],TableName:[],TotalSegments:[]}),yb=(e,t)=>je(e,{AttributeUpdates:n=>ob(n,t),ConditionExpression:[],ConditionalOperator:[],Expected:n=>ub(n,t),ExpressionAttributeNames:B,ExpressionAttributeValues:n=>Ul(n,t),Key:n=>da(n,t),ReturnConsumedCapacity:[],ReturnItemCollectionMetrics:[],ReturnValues:[],ReturnValuesOnConditionCheckFailure:[],TableName:[],UpdateExpression:[]}),Vn=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=Wn(qn(r),t)),n),{}),Wn=(e,t)=>e.B!=null?{B:t.base64Decoder(e.B)}:Jn(e.BOOL)!==void 0?{BOOL:Jn(e.BOOL)}:e.BS!=null?{BS:wb(e.BS,t)}:e.L!=null?{L:Ib(e.L,t)}:e.M!=null?{M:kb(e.M,t)}:J(e.N)!==void 0?{N:J(e.N)}:e.NS!=null?{NS:B(e.NS)}:Jn(e.NULL)!==void 0?{NULL:Jn(e.NULL)}:J(e.S)!==void 0?{S:J(e.S)}:e.SS!=null?{SS:B(e.SS)}:{$unknown:Object.entries(e)[0]},wb=(e,t)=>(e||[]).filter(s=>s!=null).map(s=>t.base64Decoder(s)),bb=(e,t)=>je(e,{Code:J,Item:n=>Vn(n,t),Message:J}),Sb=(e,t)=>(e||[]).filter(s=>s!=null).map(s=>bb(s,t)),Ll=(e,t)=>je(e,{CapacityUnits:Ht,ReadCapacityUnits:Ht,WriteCapacityUnits:Ht}),Eb=(e,t)=>je(e,{Item:n=>Vn(n,t),message:J}),ua=(e,t)=>je(e,{CapacityUnits:Ht,GlobalSecondaryIndexes:n=>Lc(n),LocalSecondaryIndexes:n=>Lc(n),ReadCapacityUnits:Ht,Table:n=>Ll(n),TableName:J,WriteCapacityUnits:Ht}),xb=(e,t)=>
35je(e,{ConsumedCapacity:n=>ua(n),Item:n=>Vn(n,t)}),_b=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=Wn(qn(r),t)),n),{}),vb=(e,t)=>je(e,{ItemCollectionKey:n=>_b(n,t),SizeEstimateRangeGB:n=>Ab(n)}),Ab=(e,t)=>(e||[]).filter(s=>s!=null).map(s=>Ht(s)),Cb=(e,t)=>(e||[]).filter(s=>s!=null).map(s=>Vn(s,t)),Rb=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=Wn(qn(r),t)),n),{}),Ib=(e,t)=>(e||[]).filter(s=>s!=null).map(s=>Wn(qn(s),t)),kb=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=Wn(qn(r),t)),n),{}),Tb=(e,t)=>je(e,{ConsumedCapacity:n=>ua(n),Count:As,Items:n=>Cb(n,t),LastEvaluatedKey:n=>Rb(n,t),ScannedCount:As}),Lc=(e,t)=>Object.entries(e).reduce((n,[s,r])=>(r===null||(n[s]=Ll(r)),n),{}),Pb=(e,t)=>je(e,{CancellationReasons:n=>Sb(n,t),Message:J}),Nb=(e,t)=>je(e,{Attributes:n=>Vn(n,t),ConsumedCapacity:n=>ua(n),ItemCollectionMetrics:n=>vb(n,t)}),U=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),Ob=ul(L),Ks=async(e,t,n,s,r)=>{const{hostname:i,protocol:o="https",port:a,path:c}=await e.endpoint(),d={protocol:o,hostname:i,port:a,method:"POST",path:c.endsWith("/")?c.slice(0,-1)+n:c+n,headers:t};return r!==void 0&&(d.body=r),new ve(d)};function Gs(e){return{"content-type":"application/x-amz-json-1.0","x-amz-target":`DynamoDB_20120810.${e}`}}class Bb extends zs.classBuilder().ep(Fl).m(function(t,n,s,r){return[Ui(s,this.serialize,this.deserialize),po(s,t.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","DescribeEndpoints",{}).n("DynamoDBClient","DescribeEndpointsCommand").f(void 0,void 0).ser(Ew).de(_w).build(){}const Mb="3.883.0",Db={version:Mb},la="required",O="type",z="fn",q="argv",ye="ref",Et="properties",xt="headers",jc=!1,Mt="isSet",Ce="error",ct="endpoint",ge="tree",Js="PartitionResult",It="stringEquals",jl="dynamodb",Tt="getAttr",Hc="aws.parseArn",pn="ParsedArn",ha="isValidHostLabel",zc="FirstArn",vn={[la]:!1,[O]:"String"},qc={[la]:!0,default:!1,[O]:"Boolean"},fa={[z]:"booleanEquals",[q]:[{[ye]:"UseFIPS"},!0]},pa={[z]:"booleanEquals",[q]:[{[ye]:"UseDualStack"},!0]},Qe={},Hl={[ye]:"Region"},Vc={[z]:"booleanEquals",[q]:[{[z]:Tt,[q]:[{[ye]:Js},"supportsFIPS"]},!0]},Wc={[z]:"booleanEquals",[q]:[{[z]:Tt,[q]:[{[ye]:Js},"supportsDualStack"]},!0]},pr={conditions:[{[z]:Mt,[q]:[{[ye]:"AccountIdEndpointMode"}]},{[z]:It,[q]:[{[ye]:"AccountIdEndpointMode"},"required"]}],rules:[{[Ce]:"Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported",[O]:Ce}],[O]:ge},hs={[z]:Mt,[q]:[{[ye]:"AccountIdEndpointMode"}]},Kc={[Ce]:"Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported",[O]:Ce},zl={[z]:Tt,[q]:[{[ye]:Js},"name"]},Gc={[ct]:{url:"https://dynamodb.{Region}.{PartitionResult#dnsSuffix}",[Et]:{},[xt]:{}},[O]:ct},fs={[z]:"not",[q]:[fa]},Jc={[Ce]:"Invalid Configuration: AccountIdEndpointMode is required and DualStack is enabled, but DualStack account endpoints are not supported",[O]:Ce},gr={[z]:"not",[q]:[{[z]:It,[q]:[{[ye]:"AccountIdEndpointMode"},"disabled"]}]},es={[z]:It,[q]:[zl,"aws"]},ts={[z]:"not",[q]:[pa]},Zc={[z]:It,[q]:[{[z]:Tt,[q]:[{[ye]:pn},"service"]},jl]},Xc={[z]:ha,[q]:[{[z]:Tt,[q]:[{[ye]:pn},"region"]},!1]},Yc={[z]:It,[q]:[{[z]:Tt,[q]:[{[ye]:pn},"region"]},"{Region}"]},Qc={[z]:ha,[q]:[{[z]:Tt,[q]:[{[ye]:pn},"accountId"]},!1]},ed={url:"https://{ParsedArn#accountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",[Et]:{},[xt]:{}},td={[ye]:"ResourceArnList"},nd={[ye]:"AccountId"},mr=[fa],yr=[pa],sd=[Hl],rd=[hs,{[z]:It,[q]:[{[ye]:"AccountIdEndpointMode"},"required"]}],id=[fs],od=[{[ye]:"ResourceArn"}],Fb={parameters:{Region:vn,UseDualStack:qc,UseFIPS:qc,Endpoint:vn,AccountId:vn,AccountIdEndpointMode:vn,ResourceArn:vn,ResourceArnList:{[la]:jc,[O]:"stringArray"}},rules:[{conditions:[{[z]:Mt,[q]:[{[ye]:"Endpoint"}]}],rules:[{conditions:mr,error:"Invalid Configuration: FIPS and custom endpoint are not supported",[O]:Ce},{conditions:yr,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",[O]:Ce},{endpoint:{url:"{Endpoint}",[Et]:Qe,[xt]:Qe},[O]:ct}],[O]:ge},{conditions:[{[z]:Mt,[q]:sd}],rules:[{conditions:[{[z]:"aws.partition",[q]:sd,assign:Js}],rules:[{conditions:[{[z]:It,[q]:[Hl,"local"]}],rules:[{conditions:mr,error:"Invalid Configuration: FIPS and local endpoint are not supported",[O]:Ce},{conditions:yr,error:"Invalid Configuration: Dualstack and local endpoint are not supported",[O]:Ce},{endpoint:{url:"http://localhost:8000",[Et]:{authSchemes:[{name:"sigv4",signingName:jl,signingRegion:"us-east-1"}]},[xt]:Qe},[O]:ct}],[O]:ge},{conditions:[fa,pa],rules:[{conditions:[Vc,Wc],rules:[pr,{endpoint:{url:"https://dynamodb-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",[Et]:Qe,[xt]:Qe},[O]:ct}],[O]:ge},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",[O]:Ce}],[O]:ge},{conditions:mr,rules:[{conditions:[Vc],rules:[{conditions:[{[z]:It,[q]:[zl,"aws-us-gov"]}],rules:[pr,Gc],[O]:ge},pr,{endpoint:{url:"https://dynamodb-fips.{Region}.{PartitionResult#dnsSuffix}",[Et]:Qe,[xt]:Qe},[O]:ct}],[O]:ge},{error:"FIPS is enabled but this partition does not support FIPS",[O]:Ce}],[O]:ge},{conditions:yr,rules:[{conditions:[Wc],rules:[{conditions:rd,rules:[{conditions:id,rules:[Jc],[O]:ge},Kc],[O]:ge},{endpoint:{url:"https://dynamodb.{Region}.{PartitionResult#dualStackDnsSuffix}",[Et]:Qe,[xt]:Qe},[O]:ct}],[O]:ge},{error:"DualStack is enabled but this partition does not support DualStack",[O]:Ce}],[O]:ge},{conditions:[hs,gr,es,fs,ts,{[z]:Mt,[q]:od},{[z]:Hc,[q]:od,assign:pn},Zc,Xc,Yc,Qc],endpoint:ed,[O]:ct},{conditions:[hs,gr,es,fs,ts,{[z]:Mt,[q]:[td]},{[z]:Tt,[q]:[td,"[0]"],assign:zc},{[z]:Hc,[q]:[{[ye]:zc}],assign:pn},Zc,Xc,Yc,Qc],endpoint:ed,[O]:ct},{conditions:[hs,gr,es,fs,ts,{[z]:Mt,[q]:[nd]}],rules:[{conditions:[{[z]:ha,[q]:[nd,jc]}],rules:[{endpoint:{url:"https://{AccountId}.ddb.{Region}.{PartitionResult#dnsSuffix}",[Et]:Qe,[xt]:Qe},[O]:ct}],[O]:ge}
35,{error:"Credentials-sourced account ID parameter is invalid",[O]:Ce}],[O]:ge},{conditions:rd,rules:[{conditions:id,rules:[{conditions:[ts],rules:[{conditions:[es],rules:[{error:"AccountIdEndpointMode is required but no AccountID was provided or able to be loaded",[O]:Ce}],[O]:ge},{error:"Invalid Configuration: AccountIdEndpointMode is required but account endpoints are not supported in this partition",[O]:Ce}],[O]:ge},Jc],[O]:ge},Kc],[O]:ge},Gc],[O]:ge}],[O]:ge},{error:"Invalid Configuration: Missing Region",[O]:Ce}]},$b=Fb,Ub=new Ki({size:50,params:["AccountId","AccountIdEndpointMode","Endpoint","Region","ResourceArn","ResourceArnList","UseDualStack","UseFIPS"]}),Lb=(e,t={})=>Ub.get(e,()=>Zi($b,{endpointParams:e,logger:t.logger}));cn.aws=js;const jb=e=>({apiVersion:"2012-08-10",base64Decoder:e?.base64Decoder??Un,base64Encoder:e?.base64Encoder??Ln,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Lb,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??ww,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Hs}],logger:e?.logger??new qs,serviceId:e?.serviceId??"DynamoDB",urlParser:e?.urlParser??dn,utf8Decoder:e?.utf8Decoder??pt,utf8Encoder:e?.utf8Encoder??wn}),Hb=e=>{const t=Ao(e),n=()=>t().then(no),s=jb(e);return{...s,...e,runtime:"browser",defaultsMode:t,accountIdEndpointMode:e?.accountIdEndpointMode??(()=>Promise.resolve(Bl)),bodyLengthChecker:e?.bodyLengthChecker??eo,credentialDefaultProvider:e?.credentialDefaultProvider??(r=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??Eo({serviceId:s.serviceId,clientVersion:Db.version}),endpointDiscoveryEnabledProvider:e?.endpointDiscoveryEnabledProvider??(()=>Promise.resolve(void 0)),maxAttempts:e?.maxAttempts??hn,region:e?.region??xo("Region is missing"),requestHandler:jn.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||mo),sha256:e?.sha256??So,streamCollector:e?.streamCollector??$s,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(uo)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(lo))}},zb=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,s=e.credentials;return{setHttpAuthScheme(r){const i=t.findIndex(o=>o.schemeId===r.schemeId);i===-1?t.push(r):t.splice(i,1,r)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(r){n=r},httpAuthSchemeProvider(){return n},setCredentials(r){s=r},credentials(){return s}}},qb=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),Vb=(e,t)=>{const n=Object.assign(Co(e),so(e),Oi(e),zb(e));return t.forEach(s=>s.configure(n)),Object.assign(e,Ro(n),ro(n),Bi(n),qb(n))};class Wb extends to{config;constructor(...[t]){const n=Hb(t||{});super(n),this.initConfig=n;const s=Sw(n),r=aw(s),i=Wi(r),o=wo(i),a=ho(o),c=a,d=go(c),u=bw(d),h=gw(u,{endpointDiscoveryCommandCtor:Bb}),p=Vb(h,t?.extensions||[]);this.config=p,this.middlewareStack.use(co(this.config)),this.middlewareStack.use(bo(this.config)),this.middlewareStack.use(fo(this.config)),this.middlewareStack.use(Mi(this.config)),this.middlewareStack.use(Di(this.config)),this.middlewareStack.use(Fi(this.config)),this.middlewareStack.use($i(this.config,{httpAuthSchemeParametersProvider:mw,identityProviderConfigProvider:async y=>new Vi({"aws.auth#sigv4":y.credentials})})),this.middlewareStack.use(Li(this.config))}destroy(){super.destroy()}}class Kb extends zs.classBuilder().ep({...Fl,ResourceArn:{type:"contextParams",name:"TableName"}}).m(function(t,n,s,r){return[Ui(s,this.serialize,this.deserialize),po(s,t.getEndpointParameterInstructions())]}).s("DynamoDB_20120810","UpdateItem",{}).n("DynamoDBClient","UpdateItemCommand").f(void 0,void 0).ser(xw).de(vw).build(){}function Gb(e){return t=>async n=>{const{request:s}=n;return ve.isInstance(s)&&s.body&&e.runtime==="node"&&e.requestHandler?.constructor?.name!=="FetchHttpHandler"&&(s.headers={...s.headers,Expect:"100-continue"}),t({...n,request:s})}}const Jb={step:"build",tags:["SET_EXPECT_HEADER","EXPECT_HEADER"],name:"addExpectContinueMiddleware",override:!0},Zb=e=>({applyToStack:t=>{t.add(Gb(e),Jb)}}),ql={WHEN_SUPPORTED:"WHEN_SUPPORTED"},Xb=ql.WHEN_SUPPORTED,Yb=ql.WHEN_SUPPORTED;var We;(function(e){e.MD5="MD5",e.CRC32="CRC32",e.CRC32C="CRC32C",e.CRC64NVME="CRC64NVME",e.SHA1="SHA1",e.SHA256="SHA256"})(We||(We={}));var ad;(function(e){e.HEADER="header",e.TRAILER="trailer"})(ad||(ad={}));We.CRC32;var cd;(function(e){e.ENV="env",e.CONFIG="shared config entry"})(cd||(cd={}));We.CRC32,We.CRC32C,We.CRC64NVME,We.SHA1,We.SHA256;We.SHA256,We.SHA1,We.CRC32,We.CRC32C,We.CRC64NVME;var Qb=[0,4067132163,3778769143,324072436,3348797215,904991772,648144872,3570033899,2329499855,2024987596,1809983544,2575936315,1296289744,3207089363,2893594407,1578318884,274646895,3795141740,4049975192,51262619,3619967088,632279923,922689671,3298075524,2592579488,1760304291,2075979607,2312596564,1562183871,2943781820,3156637768,1313733451,549293790,3537243613,3246849577,871202090,3878099393,357341890,102525238,4101499445,2858735121,147
357399826,1264559846,3107202533,1845379342,2677391885,2361733625,2125378298,820201905,3263744690,3520608582,598981189,4151959214,85089709,373468761,3827903834,3124367742,1213305469,1526817161,2842354314,2107672161,2412447074,2627466902,1861252501,1098587580,3004210879,2688576843,1378610760,2262928035,1955203488,1742404180,2511436119,3416409459,969524848,714683780,3639785095,205050476,4266873199,3976438427,526918040,1361435347,2739821008,2954799652,1114974503,2529119692,1691668175,2005155131,2247081528,3690758684,697762079,986182379,3366744552,476452099,3993867776,4250756596,255256311,1640403810,2477592673,2164122517,1922457750,2791048317,1412925310,1197962378,3037525897,3944729517,427051182,170179418,4165941337,746937522,3740196785,3451792453,1070968646,1905808397,2213795598,2426610938,1657317369,3053634322,1147748369,1463399397,2773627110,4215344322,153784257,444234805,3893493558,1021025245,3467647198,3722505002,797665321,2197175160,1889384571,1674398607,2443626636,1164749927,3070701412,2757221520,1446797203,137323447,4198817972,3910406976,461344835,3484808360,1037989803,781091935,3705997148,2460548119,1623424788,1939049696,2180517859,1429367560,2807687179,3020495871,1180866812,410100952,3927582683,4182430767,186734380,3756733383,763408580,1053836080,3434856499,2722870694,1344288421,1131464017,2971354706,1708204729,2545590714,2229949006,1988219213,680717673,3673779818,3383336350,1002577565,4010310262,493091189,238226049,4233660802,2987750089,1082061258,1395524158,2705686845,1972364758,2279892693,2494862625,1725896226,952904198,3399985413,3656866545,731699698,4283874585,222117402,510512622,3959836397,3280807620,837199303,582374963,3504198960,68661723,4135334616,3844915500,390545967,1230274059,3141532936,2825850620,1510247935,2395924756,2091215383,1878366691,2644384480,3553878443,565732008,854102364,3229815391,340358836,3861050807,4117890627,119113024,1493875044,2875275879,3090270611,1247431312,2660249211,1828433272,2141937292,2378227087,3811616794,291187481,34330861,4032846830,615137029,3603020806,3314634738,939183345,1776939221,2609017814,2295496738,2058945313,2926798794,1545135305,1330124605,3173225534,4084100981,17165430,307568514,3762199681,888469610,3332340585,3587147933,665062302,2042050490,2346497209,2559330125,1793573966,3190661285,1279665062,1595330642,2910671697];vl(Qb);var Vl=(function(){function e(){this.checksum=4294967295}return e.prototype.update=function(t){var n,s;try{for(var r=xy(t),i=r.next();!i.done;i=r.next()){var o=i.value;this.checksum=this.checksum>>>8^tS[(this.checksum^o)&255]}}catch(a){n={error:a}}finally{try{i&&!i.done&&(s=r.return)&&s.call(r)}finally{if(n)throw n.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e})(),eS=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],tS=vl(eS);const nS=e=>{const{requestChecksumCalculation:t,responseChecksumValidation:n,requestStreamBufferSize:s}=e;return Object.assign(e,{requestChecksumCalculation:Me(t??Xb),responseChecksumValidation:Me(n??Yb),requestStreamBufferSize:Number(s??0)})},sS=e=>(t,n)=>async s=>
35{const r=await e.region(),i=e.region;let o=()=>{};n.__s3RegionRedirect&&(Object.defineProperty(e,"region",{writable:!1,value:async()=>n.__s3RegionRedirect}),o=()=>Object.defineProperty(e,"region",{writable:!0,value:i}));try{const a=await t(s);if(n.__s3RegionRedirect){o();const c=await e.region();if(r!==c)throw new Error("Region was not restored following S3 region redirect.")}return a}catch(a){throw o(),a}},rS={tags:["REGION_REDIRECT","S3"],name:"regionRedirectEndpointMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"};function iS(e){return(t,n)=>async s=>{try{return await t(s)}catch(r){if(e.followRegionRedirects){const i=r?.$metadata?.httpStatusCode,o=n.commandName==="HeadBucketCommand",a=r?.$response?.headers?.["x-amz-bucket-region"];if(a&&(i===301||i===400&&(r?.name==="IllegalLocationConstraintException"||o))){try{const c=a;n.logger?.debug(`Redirecting from ${await e.region()} to ${c}`),n.__s3RegionRedirect=c}catch(c){throw new Error("Region redirect failed: "+c)}return t(s)}}throw r}}}const oS={step:"initialize",tags:["REGION_REDIRECT","S3"],name:"regionRedirectMiddleware",override:!0},aS=e=>({applyToStack:t=>{t.add(iS(e),oS),t.addRelativeTo(sS(e),rS)}});class ga{data;lastPurgeTime=Date.now();static EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS=3e4;constructor(t={}){this.data=t}get(t){const n=this.data[t];if(n)return n}set(t,n){return this.data[t]=n,n}delete(t){delete this.data[t]}async purgeExpired(){const t=Date.now();if(!(this.lastPurgeTime+ga.EXPIRED_CREDENTIAL_PURGE_INTERVAL_MS>t))for(const n in this.data){const s=this.data[n];if(!s.isRefreshing){const r=await s.identity;r.expiration&&r.expiration.getTime()<t&&delete this.data[n]}}}}class wr{_identity;isRefreshing;accessed;constructor(t,n=!1,s=Date.now()){this._identity=t,this.isRefreshing=n,this.accessed=s}get identity(){return this.accessed=Date.now(),this._identity}}class ma{createSessionFn;cache;static REFRESH_WINDOW_MS=6e4;constructor(t,n=new ga){this.createSessionFn=t,this.cache=n}async getS3ExpressIdentity(t,n){const s=n.Bucket,{cache:r}=this,i=r.get(s);return i?i.identity.then(o=>(o.expiration?.getTime()??0)<Date.now()?r.set(s,new wr(this.getIdentity(s))).identity:((o.expiration?.getTime()??0)<Date.now()+ma.REFRESH_WINDOW_MS&&!i.isRefreshing&&(i.isRefreshing=!0,this.getIdentity(s).then(d=>{r.set(s,new wr(Promise.resolve(d)))})),o)):r.set(s,new wr(this.getIdentity(s))).identity}async getIdentity(t){await this.cache.purgeExpired().catch(r=>{console.warn(`Error while clearing expired entries in S3ExpressIdentityCache: 
36`+r)});const n=await this.createSessionFn(t);if(!n.Credentials?.AccessKeyId||!n.Credentials?.SecretAccessKey)throw new Error("s3#createSession response credential missing AccessKeyId or SecretAccessKey.");return{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken,expiration:n.Credentials.Expiration?new Date(n.Credentials.Expiration):void 0}}}const cS="Directory",dS="S3Express",uS="sigv4-s3express",Ei="X-Amz-S3session-Token",xi=Ei.toLowerCase();class lS extends fi{async signWithCredentials(t,n,s){const r=dd(n);t.headers[xi]=n.sessionToken;const i=this;return ud(i,r),i.signRequest(t,s??{})}async presignWithCredentials(t,n,s){const r=dd(n);return delete t.headers[xi],t.headers[Ei]=n.sessionToken,t.query=t.query??{},t.query[Ei]=n.sessionToken,ud(this,r),this.presign(t,s)}}function dd(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,expiration:e.expiration}}function ud(e,t){const n=setTimeout(()=>{throw new Error("SignatureV4S3Express credential override was created but not called.")},10),s=e.credentialProvider,r=()=>(clearTimeout(n),e.credentialProvider=s,Promise.resolve(t));e.credentialProvider=r}const hS=e=>(t,n)=>async s=>{if(n.endpointV2){const r=n.endpointV2,i=r.properties?.authSchemes?.[0]?.name===uS;if((r.properties?.backend===dS||r.properties?.bucketType===cS)&&(et(n,"S3_EXPRESS_BUCKET","J"),n.isS3ExpressBucket=!0),i){const a=s.input.Bucket;if(a){const c=await e.s3ExpressIdentityProvider.getS3ExpressIdentity(await e.credentials(),{Bucket:a});n.s3ExpressIdentity=c,ve.isInstance(s.request)&&c.sessionToken&&(s.request.headers[xi]=c.sessionToken)}}}return t(s)}
36,fS={name:"s3ExpressMiddleware",step:"build",tags:["S3","S3_EXPRESS"],override:!0},pS=e=>({applyToStack:t=>{t.add(hS(e),fS)}}),gS=async(e,t,n,s)=>{const r=await s.signWithCredentials(n,e,{});if(r.headers["X-Amz-Security-Token"]||r.headers["x-amz-security-token"])throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");return r},mS=e=>t=>{throw t},yS=(e,t)=>{},wS=e=>(t,n)=>async s=>{if(!ve.isInstance(s.request))return t(s);const i=kt(n).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:o={}},identity:a,signer:c}=i;let d;n.s3ExpressIdentity?d=await gS(n.s3ExpressIdentity,o,s.request,await e.signer()):d=await c.sign(s.request,a,o);const u=await t({...s,request:d}).catch((c.errorHandler||mS)(o));return(c.successHandler||yS)(u.response,o),u},bS=e=>({applyToStack:t=>{t.addRelativeTo(wS(e),Hu)}}),SS=(e,{session:t})=>{const[n,s]=t,{forcePathStyle:r,useAccelerateEndpoint:i,disableMultiregionAccessPoints:o,followRegionRedirects:a,s3ExpressIdentityProvider:c,bucketEndpoint:d}=e;return Object.assign(e,{forcePathStyle:r??!1,useAccelerateEndpoint:i??!1,disableMultiregionAccessPoints:o??!1,followRegionRedirects:a??!1,s3ExpressIdentityProvider:c??new ma(async u=>n().send(new s({Bucket:u}))),bucketEndpoint:d??!1})},ES={CopyObjectCommand:!0,UploadPartCopyCommand:!0,CompleteMultipartUploadCommand:!0},xS=3e3,_S=e=>(t,n)=>async s=>{const r=await t(s),{response:i}=r;if(!an.isInstance(i))return r;const{statusCode:o,body:a}=i;if(o<200||o>=300||!(typeof a?.stream=="function"||typeof a?.pipe=="function"||typeof a?.tee=="function"))return r;let d=a,u=a;a&&typeof a=="object"&&!(a instanceof Uint8Array)&&([d,u]=await Af(a)),i.body=u;const h=await vS(d,{streamCollector:async y=>yf(y,xS)});typeof d?.destroy=="function"&&d.destroy();const p=e.utf8Encoder(h.subarray(h.length-16));if(h.length===0&&ES[n.commandName]){const y=new Error("S3 aborted request");throw y.name="InternalError",y}return p&&p.endsWith("</Error>")&&(i.statusCode=400),r},vS=(e=new Uint8Array,t)=>e instanceof Uint8Array?Promise.resolve(e):t.streamCollector(e)||Promise.resolve(new Uint8Array),AS={relation:"after",toMiddleware:"deserializerMiddleware",tags:["THROW_200_EXCEPTIONS","S3"],name:"throw200ExceptionsMiddleware",override:!0},CS=e=>({applyToStack:t=>{t.addRelativeTo(_S(e),AS)}}),RS=e=>typeof e=="string"&&e.indexOf("arn:")===0&&e.split(":").length>=6;function IS(e){return(t,n)=>async s=>{if(e.bucketEndpoint){const r=n.endpointV2;if(r){const i=s.input.Bucket;if(typeof i=="string")try{const o=new URL(i);n.endpointV2={...r,url:o}}catch(o){const a=`@aws-sdk/middleware-sdk-s3: bucketEndpoint=true was set but Bucket=${i} could not be parsed as URL.`;throw n.logger?.constructor?.name==="NoOpLogger"?console.warn(a):n.logger?.warn?.(a),o}}}return t(s)}}const kS={name:"bucketEndpointMiddleware",override:!0,relation:"after",toMiddleware:"endpointV2Middleware"};function TS({bucketEndpoint:e}){return t=>async n=>{const{input:{Bucket:s}}=n;if(!e&&typeof s=="string"&&!RS(s)&&s.indexOf("/")>=0){const r=new Error(`Bucket name shouldn't contain '/', received '${s}'`);throw r.name="InvalidBucketName",r}return t({...n})}}const PS={step:"initialize",tags:["VALIDATE_BUCKET_NAME"],name:"validateBucketNameMiddleware",override:!0},NS=e=>({applyToStack:t=>{t.add(TS(e),PS),t.addRelativeTo(IS(e),kS)}}),OS=e=>Object.assign(e,{eventStreamMarshaller:e.eventStreamSerdeProvider(e)});class Wl{sigv4aSigner;sigv4Signer;signerOptions;static sigv4aDependency(){return"none"}constructor(t){this.sigv4Signer=new lS(t),this.signerOptions=t}async sign(t,n={}){return n.signingRegion==="*"?this.getSigv4aSigner().sign(t,n):this.sigv4Signer.sign(t,n)}async signWithCredentials(t,n,s={}){if(s.signingRegion==="*")throw this.getSigv4aSigner(),new Error(`signWithCredentials with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`);return this.sigv4Signer.signWithCredentials(t,n,s)}
36async presign(t,n={}){if(n.signingRegion==="*")throw this.getSigv4aSigner(),new Error(`presign with signingRegion '*' is only supported when using the CRT dependency @aws-sdk/signature-v4-crt. Please check whether you have installed the "@aws-sdk/signature-v4-crt" package explicitly. You must also register the package by calling [require("@aws-sdk/signature-v4-crt");] or an ESM equivalent such as [import "@aws-sdk/signature-v4-crt";]. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt`);return this.sigv4Signer.presign(t,n)}async presignWithCredentials(t,n,s={}){if(s.signingRegion==="*")throw new Error("Method presignWithCredentials is not supported for [signingRegion=*].");return this.sigv4Signer.presignWithCredentials(t,n,s)}getSigv4aSigner(){if(!this.sigv4aSigner)throw this.signerOptions.runtime==="node"?new Error("Neither CRT nor JS SigV4a implementation is available. Please load either @aws-sdk/signature-v4-crt or @aws-sdk/signature-v4a. For more information please go to https://github.com/aws/aws-sdk-js-v3#functionality-requiring-aws-common-runtime-crt"):new Error("JS SigV4a implementation is not available or not a valid constructor. Please check whether you have installed the @aws-sdk/signature-v4a package explicitly. The CRT implementation is not available for browsers. You must also register the package by calling [require('@aws-sdk/signature-v4a');] or an ESM equivalent such as [import '@aws-sdk/signature-v4a';]. For more information please go to https://github.com/aws/aws-sdk-js-v3#using-javascript-non-crt-implementation-of-sigv4a");return this.sigv4aSigner}}const ya="required",l="type",w="rules",f="conditions",g="fn",m="argv",k="ref",F="assign",C="url",R="properties",Ut="backend",Be="authSchemes",xe="disableDoubleEncoding",_e="signingName",Le="signingRegion",I="headers",wa="signingRegionSet",BS=6,MS=!1,st=!0,Ke="isSet",ue="booleanEquals",v="error",Ps="aws.partition",K="stringEquals",oe="getAttr",de="name",ee="substring",ld="bucketSuffix",ba="parseURL",E="endpoint",b="tree",Ns="aws.isVirtualHostableS3Bucket",Os="{url#scheme}://{Bucket}.{url#authority}{url#path}",lt="not",hd="accessPointSuffix",ps="{url#scheme}://{url#authority}{url#path}",Kl="hardwareType",Gl="regionPrefix",fd="bucketAliasSuffix",_i="outpostId",Wt="isValidHostLabel",Sa="sigv4a",$n="s3-outposts",gn="s3",Jl="{url#scheme}://{url#authority}{url#normalizedPath}{Bucket}",Zl="https://{Bucket}.s3-accelerate.{partitionResult#dnsSuffix}",pd="https://{Bucket}.s3.{partitionResult#dnsSuffix}",Xl="aws.parseArn",Yl="bucketArn",Ql="arnType",Bs="",Ea="s3-object-lambda",eh="accesspoint",xa="accessPointName",gd="{url#scheme}://{accessPointName}-{bucketArn#accountId}.{url#authority}{url#path}",md="mrapPartition",yd="outpostType",wd="arnPrefix",th="{url#scheme}://{url#authority}{url#normalizedPath}{uri_encoded_bucket}",bd="https://s3.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",Sd="https://s3.{partitionResult#dnsSuffix}",Jt={[ya]:!1,[l]:"String"},Zt={[ya]:!0,default:!1,[l]:"Boolean"},An={[ya]:!1,[l]:"Boolean"},Xe={[g]:ue,[m]:[{[k]:"Accelerate"},!0]},ne={[g]:ue,[m]:[{[k]:"UseFIPS"},!0]},Q={[g]:ue,[m]:[{[k]:"UseDualStack"},!0]},ae={[g]:Ke,[m]:[{[k]:"Endpoint"}]},nh={[g]:Ps,[m]:[{[k]:"Region"}],[F]:"partitionResult"},Ed={[g]:K,[m]:[{[g]:oe,[m]:[{[k]:"partitionResult"},de]},"aws-cn"]},Nn={[g]:Ke,[m]:[{[k]:"Bucket"}]},V={[k]:"Bucket"},xd={[f]:[Q],[v]:"S3Express does not support Dual-stack.",[l]:v},_d={[f]:[Xe],[v]:"S3Express does not support S3 Accelerate.",[l]:v},vd={[f]:[ae,{[g]:ba,[m]:[{[k]:"Endpoint"}],[F]:"url"}],[w]:[{[f]:[{[g]:Ke,[m]:[{[k]:"DisableS3ExpressSessionAuth"}]},{[g]:ue,[m]:[{[k]:"DisableS3ExpressSessionAuth"},!0]}],[w]:[{[f]:[{[g]:ue,[m]:[{[g]:oe,[m]:[{[k]:"url"},"isIp"]},!0]}],[w]:[{[f]:[{[g]:"uriEncode",[m]:[V],[F]:"uri_encoded_bucket"}],[w]:[{[E]:{[C]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",[R]:{[Ut]:"S3Express",[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:"s3express",[Le]:"{Region}"}]},[I]:{}},[l]:E}],[l]:b}],[l]:b},{[f]:[{[g]:Ns,[m]:[V,!1]}],[w]:[{[E]:{[C]:Os,[R]:{[Ut]:"S3Express",[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:"s3express",[Le]:"{Region}"}]},[I]:{}},[l]:E}],[l]:b},{[v]:"S3Express bucket name is not a valid virtual hostable name.",[l]:v}],[l]:b},{[f]:[{[g]:ue,[m]:[{[g]:oe,[m]:[{[k]:"url"},"isIp"]},!0]}],[w]:[{[f]:[{[g]:"uriEncode",[m]:[V],[F]:"uri_encoded_bucket"}],[w]:[{[E]:{[C]:"{url#scheme}://{url#authority}/{uri_encoded_bucket}{url#path}",[R]:{[Ut]:"S3Express",[Be]:[{[xe]:!0,[de]:"sigv4-s3express",[_e]:"s3express",[Le]:"{Region}"}]},[I]:{}},[l]:E}],[l]:b}],[l]:b},{[f]:[{[g]:Ns,[m]:[V,!1]}],[w]:[{[E]:{[C]:Os,[R]:{[Ut]:"S3Express",[Be]:[{[xe]:!0,[de]:"sigv4-s3express",[_e]:"s3express",[Le]:"{Region}"}]},[I]:{}},[l]:E}],[l]:b},{[v]:"S3Express bucket name is not a valid virtual hostable name.",[l]:v}],[l]:b},Ue={[g]:ba,[m]:[{[k]:"Endpoint"}],[F]:"url"},br={[g]:ue,[m]:[{[g]:oe,[m]:[{[k]:"url"},"isIp"]},!0]},sh={[k]:"url"},rh={[g]:"uriEncode",[m]:[V],[F]:"uri_encoded_bucket"},Dt={[Ut]:"S3Express",[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:"s3express",[Le]:"{Region}"}]},M={},ih={[g]:Ns,[m]:[V,!1]},Ad={[v]:"S3Express bucket name is not a valid virtual hostable name.",[l]:v},Cd={[g]:Ke,[m]:[{[k]:"UseS3ExpressControlEndpoint"}]},Rd={[g]:ue,[m]:[{[k]:"UseS3ExpressControlEndpoint"},!0]},D={[g]:lt,[m]:[ae]},ns={[v]:"Unrecognized S3Express bucket name format.",[l]:v},Id={[g]:lt,[m]:[Nn]},kd={[k]:Kl},Td={[f]:[D],[v]:"Expected a endpoint to be specified but no endpoint was found",[l]:v},ss={[Be]:[{[xe]:!0,[de]:Sa,[_e]:$n,[wa]:["*"]},{[xe]:!0,[de]:"sigv4",[_e]:$n,[Le]:"{Region}"}]},Sr={[g]:ue,[m]:[{[k]:"ForcePathStyle"},!1]},DS={[k]:"ForcePathStyle"},pe={[g]:ue,[m]:[{[k]:"Accelerate"},!1]},we={[g]:K,[m]:[{[k]:"Region"},"aws-global"]},be={[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:gn,[Le]:"us-east-1"}]},H={[g]:lt,[m]:[we]},Se={[g]:ue,[m]:[{[k]:"UseGlobalEndpoint"},!0]},Pd={[C]:"https://{Bucket}.s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",[R]:{[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:gn,[Le]:"{Region}"}]},[I]:{}},me={[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:gn,[Le]:"{Region}"}]},Ee={[g]:ue,[m]:[{[k]:"UseGlobalEndpoint"},!1]},j={[g]:ue,[m]:[{[k]:"UseDualStack"},!1]},Nd={[C]:"https://{Bucket}.s3-fips.{Region}.{partitionResult#dnsSuffix}",[R]:me,[I]:{}},$={[g]:ue,[m]:[{[k]:"UseFIPS"}
36,!1]},Od={[C]:"https://{Bucket}.s3-accelerate.dualstack.{partitionResult#dnsSuffix}",[R]:me,[I]:{}},Bd={[C]:"https://{Bucket}.s3.dualstack.{Region}.{partitionResult#dnsSuffix}",[R]:me,[I]:{}},Er={[g]:ue,[m]:[{[g]:oe,[m]:[sh,"isIp"]},!1]},xr={[C]:Jl,[R]:me,[I]:{}},vi={[C]:Os,[R]:me,[I]:{}},Md={[E]:vi,[l]:E},_r={[C]:Zl,[R]:me,[I]:{}},Dd={[C]:"https://{Bucket}.s3.{Region}.{partitionResult#dnsSuffix}",[R]:me,[I]:{}},rs={[v]:"Invalid region: region was not a valid DNS name.",[l]:v},qe={[k]:Yl},oh={[k]:Ql},vr={[g]:oe,[m]:[qe,"service"]},_a={[k]:xa},Fd={[f]:[Q],[v]:"S3 Object Lambda does not support Dual-stack",[l]:v},$d={[f]:[Xe],[v]:"S3 Object Lambda does not support S3 Accelerate",[l]:v},Ud={[f]:[{[g]:Ke,[m]:[{[k]:"DisableAccessPoints"}]},{[g]:ue,[m]:[{[k]:"DisableAccessPoints"},!0]}],[v]:"Access points are not supported for this operation",[l]:v},Ar={[f]:[{[g]:Ke,[m]:[{[k]:"UseArnRegion"}]},{[g]:ue,[m]:[{[k]:"UseArnRegion"},!1]},{[g]:lt,[m]:[{[g]:K,[m]:[{[g]:oe,[m]:[qe,"region"]},"{Region}"]}]}],[v]:"Invalid configuration: region from ARN `{bucketArn#region}` does not match client region `{Region}` and UseArnRegion is `false`",[l]:v},ah={[g]:oe,[m]:[{[k]:"bucketPartition"},de]},ch={[g]:oe,[m]:[qe,"accountId"]},Cr={[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:Ea,[Le]:"{bucketArn#region}"}]},Ld={[v]:"Invalid ARN: The access point name may only contain a-z, A-Z, 0-9 and `-`. Found: `{accessPointName}`",[l]:v},Rr={[v]:"Invalid ARN: The account id may only contain a-z, A-Z, 0-9 and `-`. Found: `{bucketArn#accountId}`",[l]:v},Ir={[v]:"Invalid region in ARN: `{bucketArn#region}` (invalid DNS name)",[l]:v},kr={[v]:"Client was configured for partition `{partitionResult#name}` but ARN (`{Bucket}`) has `{bucketPartition#name}`",[l]:v},jd={[v]:"Invalid ARN: The ARN may only contain a single resource component after `accesspoint`.",[l]:v},Hd={[v]:"Invalid ARN: Expected a resource of the format `accesspoint:<accesspoint name>` but no name was provided",[l]:v},Cn={[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:gn,[Le]:"{bucketArn#region}"}]},zd={[Be]:[{[xe]:!0,[de]:Sa,[_e]:$n,[wa]:["*"]},{[xe]:!0,[de]:"sigv4",[_e]:$n,[Le]:"{bucketArn#region}"}]},qd={[g]:Xl,[m]:[V]},Vd={[C]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:me,[I]:{}},Wd={[C]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:me,[I]:{}},Kd={[C]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:me,[I]:{}},Tr={[C]:th,[R]:me,[I]:{}},Gd={[C]:"https://s3.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:me,[I]:{}},Jd={[k]:"UseObjectLambdaEndpoint"},Pr={[Be]:[{[xe]:!0,[de]:"sigv4",[_e]:Ea,[Le]:"{Region}"}]},Zd={[C]:"https://s3-fips.dualstack.{Region}.{partitionResult#dnsSuffix}",[R]:me,[I]:{}},Xd={[C]:"https://s3-fips.{Region}.{partitionResult#dnsSuffix}",[R]:me,[I]:{}},Yd={[C]:"https://s3.dualstack.{Region}.{partitionResult#dnsSuffix}",[R]:me,[I]:{}},Nr={[C]:ps,[R]:me,[I]:{}},Qd={[C]:"https://s3.{Region}.{partitionResult#dnsSuffix}",[R]:me,[I]:{}},Or=[{[k]:"Region"}],FS=[{[k]:"Endpoint"}],$S=[V],eu=[Q],Br=[Xe],Xt=[ae,Ue],tu=[{[g]:Ke,[m]:[{[k]:"DisableS3ExpressSessionAuth"}]},{[g]:ue,[m]:[{[k]:"DisableS3ExpressSessionAuth"},!0]}],US=[rh],nu=[ih],Ze=[nh],Yt=[ne],su=[{[g]:ee,[m]:[V,6,14,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,14,16,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],rt=[{[f]:[ne],[E]:{[C]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[R]:Dt,[I]:{}},[l]:E},{[E]:{[C]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[R]:Dt,[I]:{}},[l]:E}],ru=[{[g]:ee,[m]:[V,6,15,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,15,17,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],iu=[{[g]:ee,[m]:[V,6,19,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,19,21,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],ou=[{[g]:ee,[m]:[V,6,20,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,20,22,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"}
36,"--"]}],au=[{[g]:ee,[m]:[V,6,26,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,26,28,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],it=[{[f]:[ne],[E]:{[C]:"https://{Bucket}.s3express-fips-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[R]:{[Ut]:"S3Express",[Be]:[{[xe]:!0,[de]:"sigv4-s3express",[_e]:"s3express",[Le]:"{Region}"}]},[I]:{}},[l]:E},{[E]:{[C]:"https://{Bucket}.s3express-{s3expressAvailabilityZoneId}.{Region}.{partitionResult#dnsSuffix}",[R]:{[Ut]:"S3Express",[Be]:[{[xe]:!0,[de]:"sigv4-s3express",[_e]:"s3express",[Le]:"{Region}"}]},[I]:{}},[l]:E}],cu=[V,0,7,!0],du=[{[g]:ee,[m]:[V,7,15,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,15,17,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],uu=[{[g]:ee,[m]:[V,7,16,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,16,18,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],lu=[{[g]:ee,[m]:[V,7,20,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,20,22,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],hu=[{[g]:ee,[m]:[V,7,21,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,21,23,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],fu=[{[g]:ee,[m]:[V,7,27,!0],[F]:"s3expressAvailabilityZoneId"},{[g]:ee,[m]:[V,27,29,!0],[F]:"s3expressAvailabilityZoneDelim"},{[g]:K,[m]:[{[k]:"s3expressAvailabilityZoneDelim"},"--"]}],LS=[Nn],pu=[{[g]:Wt,[m]:[{[k]:_i},!1]}],gu=[{[g]:K,[m]:[{[k]:Gl},"beta"]}],jS=["*"],mu=[{[g]:Wt,[m]:[{[k]:"Region"},!1]}],yt=[{[g]:K,[m]:[{[k]:"Region"},"us-east-1"]}],Mr=[{[g]:K,[m]:[oh,eh]}],yu=[{[g]:oe,[m]:[qe,"resourceId[1]"],[F]:xa},{[g]:lt,[m]:[{[g]:K,[m]:[_a,Bs]}]}],HS=[qe,"resourceId[1]"],Dr=[{[g]:lt,[m]:[{[g]:K,[m]:[{[g]:oe,[m]:[qe,"region"]},Bs]}]}],wu=[{[g]:lt,[m]:[{[g]:Ke,[m]:[{[g]:oe,[m]:[qe,"resourceId[2]"]}]}]}],zS=[qe,"resourceId[2]"],Fr=[{[g]:Ps,[m]:[{[g]:oe,[m]:[qe,"region"]}],[F]:"bucketPartition"}],bu=[{[g]:K,[m]:[ah,{[g]:oe,[m]:[{[k]:"partitionResult"},de]}]}],$r=[{[g]:Wt,[m]:[{[g]:oe,[m]:[qe,"region"]},!0]}],Ur=[{[g]:Wt,[m]:[ch,!1]}],Su=[{[g]:Wt,[m]:[_a,!1]}],Eu=[{[g]:Wt,[m]:[{[k]:"Region"},!0]}],qS={parameters:{Bucket:Jt,Region:Jt,UseFIPS:Zt,UseDualStack:Zt,Endpoint:Jt,ForcePathStyle:Zt,Accelerate:Zt,UseGlobalEndpoint:Zt,UseObjectLambdaEndpoint:An,Key:Jt,Prefix:Jt,CopySource:Jt,DisableAccessPoints:An,DisableMultiRegionAccessPoints:Zt,UseArnRegion:An,UseS3ExpressControlEndpoint:An,DisableS3ExpressSessionAuth:An},[w]:[{[f]:[{[g]:Ke,[m]:Or}],[w]:[{[f]:[Xe,ne],error:"Accelerate cannot be used with FIPS",[l]:v},{[f]:[Q,ae],error:"Cannot set dual-stack in combination with a custom endpoint.",[l]:v},{[f]:[ae,ne],error:"A custom endpoint cannot be combined with FIPS",[l]:v},{[f]:[ae,Xe],error:"A custom endpoint cannot be combined with S3 Accelerate",[l]:v},{[f]:[ne,nh,Ed],error:"Partition does not support FIPS",[l]:v},{[f]:[Nn,{[g]:ee,[m]:[V,0,BS,st],[F]:ld},{[g]:K,[m]:[{[k]:ld},"--x-s3"]}],[w]:[xd,_d,vd,{[f]:[Cd,Rd],[w]:[{[f]:Ze,[w]:[{[f]:[rh,D],[w]:[{[f]:Yt,endpoint:{[C]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:Dt,[I]:M},[l]:E},{endpoint:{[C]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:Dt,[I]:M},[l]:E}],[l]:b}],[l]:b}],[l]:b},{[f]:nu,[w]:[{[f]:Ze,[w]:[{[f]:tu,[w]:[{[f]:su,[w]:rt,[l]:b},{[f]:ru,[w]:rt,[l]:b},{[f]:iu,[w]:rt,[l]:b},{[f]:ou,[w]:rt,[l]:b},{[f]:au,[w]:rt,[l]:b},ns],[l]:b},{[f]:su,[w]:it,[l]:b},{[f]:ru,[w]:it,[l]:b},{[f]:iu,[w]:it,[l]:b},{[f]:ou,[w]:it,[l]:b},{[f]:au,[w]:it,[l]:b},ns],[l]:b}],[l]:b},Ad],[l]:b},{[f]:[Nn,{[g]:ee,[m]:cu,[F]:hd},{[g]:K,[m]:[{[k]:hd},"--xa-s3"]}],[w]:[xd,_d,vd,{[f]:nu,[w]:[{[f]:Ze,[w]:[{[f]:tu,[w]:[{[f]:du,[w]:rt,[l]:b},{[f]:uu,[w]:rt,[l]:b},{[f]:lu,[w]:rt,[l]:b},{[f]:hu,[w]:rt,[l]:b},{[f]:fu,[w]:rt,[l]:b},ns],[l]:b},{[f]:du,[w]:it,[l]:b},{[f]:uu,[w]:it,[l]:b},{[f]:lu,[w]:it,[l]:b},{[f]:hu,[w]:it,[l]:b},{[f]:fu,[w]:it,[l]:b},ns],[l]:b}],[l]:b},Ad],[l]:b}
36,{[f]:[Id,Cd,Rd],[w]:[{[f]:Ze,[w]:[{[f]:Xt,endpoint:{[C]:ps,[R]:Dt,[I]:M},[l]:E},{[f]:Yt,endpoint:{[C]:"https://s3express-control-fips.{Region}.{partitionResult#dnsSuffix}",[R]:Dt,[I]:M},[l]:E},{endpoint:{[C]:"https://s3express-control.{Region}.{partitionResult#dnsSuffix}",[R]:Dt,[I]:M},[l]:E}],[l]:b}],[l]:b},{[f]:[Nn,{[g]:ee,[m]:[V,49,50,st],[F]:Kl},{[g]:ee,[m]:[V,8,12,st],[F]:Gl},{[g]:ee,[m]:cu,[F]:fd},{[g]:ee,[m]:[V,32,49,st],[F]:_i},{[g]:Ps,[m]:Or,[F]:"regionPartition"},{[g]:K,[m]:[{[k]:fd},"--op-s3"]}],[w]:[{[f]:pu,[w]:[{[f]:[{[g]:K,[m]:[kd,"e"]}],[w]:[{[f]:gu,[w]:[Td,{[f]:Xt,endpoint:{[C]:"https://{Bucket}.ec2.{url#authority}",[R]:ss,[I]:M},[l]:E}],[l]:b},{endpoint:{[C]:"https://{Bucket}.ec2.s3-outposts.{Region}.{regionPartition#dnsSuffix}",[R]:ss,[I]:M},[l]:E}],[l]:b},{[f]:[{[g]:K,[m]:[kd,"o"]}],[w]:[{[f]:gu,[w]:[Td,{[f]:Xt,endpoint:{[C]:"https://{Bucket}.op-{outpostId}.{url#authority}",[R]:ss,[I]:M},[l]:E}],[l]:b},{endpoint:{[C]:"https://{Bucket}.op-{outpostId}.s3-outposts.{Region}.{regionPartition#dnsSuffix}",[R]:ss,[I]:M},[l]:E}],[l]:b},{error:'Unrecognized hardware type: "Expected hardware type o or e but got {hardwareType}"',[l]:v}],[l]:b},{error:"Invalid ARN: The outpost Id must only contain a-z, A-Z, 0-9 and `-`.",[l]:v}],[l]:b},{[f]:LS,[w]:[{[f]:[ae,{[g]:lt,[m]:[{[g]:Ke,[m]:[{[g]:ba,[m]:FS}]}]}],error:"Custom endpoint `{Endpoint}` was not a valid URI",[l]:v},{[f]:[Sr,ih],[w]:[{[f]:Ze,[w]:[{[f]:mu,[w]:[{[f]:[Xe,Ed],error:"S3 Accelerate cannot be used in this region",[l]:v},{[f]:[Q,ne,pe,D,we],endpoint:{[C]:"https://{Bucket}.s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",[R]:be,[I]:M},[l]:E},{[f]:[Q,ne,pe,D,H,Se],[w]:[{endpoint:Pd,[l]:E}],[l]:b},{[f]:[Q,ne,pe,D,H,Ee],endpoint:Pd,[l]:E},{[f]:[j,ne,pe,D,we],endpoint:{[C]:"https://{Bucket}.s3-fips.us-east-1.{partitionResult#dnsSuffix}",[R]:be,[I]:M},[l]:E},{[f]:[j,ne,pe,D,H,Se],[w]:[{endpoint:Nd,[l]:E}],[l]:b},{[f]:[j,ne,pe,D,H,Ee],endpoint:Nd,[l]:E},{[f]:[Q,$,Xe,D,we],endpoint:{[C]:"https://{Bucket}.s3-accelerate.dualstack.us-east-1.{partitionResult#dnsSuffix}",[R]:be,[I]:M},[l]:E},{[f]:[Q,$,Xe,D,H,Se],[w]:[{endpoint:Od,[l]:E}],[l]:b},{[f]:[Q,$,Xe,D,H,Ee],endpoint:Od,[l]:E},{[f]:[Q,$,pe,D,we],endpoint:{[C]:"https://{Bucket}.s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",[R]:be,[I]:M},[l]:E},{[f]:[Q,$,pe,D,H,Se],[w]:[{endpoint:Bd,[l]:E}],[l]:b},{[f]:[Q,$,pe,D,H,Ee],endpoint:Bd,[l]:E},{[f]:[j,$,pe,ae,Ue,br,we],endpoint:{[C]:Jl,[R]:be,[I]:M},[l]:E},{[f]:[j,$,pe,ae,Ue,Er,we],endpoint:{[C]:Os,[R]:be,[I]:M},[l]:E},{[f]:[j,$,pe,ae,Ue,br,H,Se],[w]:[{[f]:yt,endpoint:xr,[l]:E},{endpoint:xr,[l]:E}],[l]:b},{[f]:[j,$,pe,ae,Ue,Er,H,Se],[w]:[{[f]:yt,endpoint:vi,[l]:E},Md],[l]:b},{[f]:[j,$,pe,ae,Ue,br,H,Ee],endpoint:xr,[l]:E},{[f]:[j,$,pe,ae,Ue,Er,H,Ee],endpoint:vi,[l]:E},{[f]:[j,$,Xe,D,we],endpoint:{[C]:Zl,[R]:be,[I]:M},[l]:E},{[f]:[j,$,Xe,D,H,Se],[w]:[{[f]:yt,endpoint:_r,[l]:E},{endpoint:_r,[l]:E}],[l]:b},{[f]:[j,$,Xe,D,H,Ee],endpoint:_r,[l]:E},{[f]:[j,$,pe,D,we],endpoint:{[C]:pd,[R]:be,[I]:M},[l]:E},{[f]:[j,$,pe,D,H,Se],[w]:[{[f]:yt,endpoint:{[C]:pd,[R]:me,[I]:M},[l]:E},{endpoint:Dd,[l]:E}],[l]:b},{[f]:[j,$,pe,D,H,Ee],endpoint:Dd,[l]:E}],[l]:b},rs],[l]:b}],[l]:b},{[f]:[ae,Ue,{[g]:K,[m]:[{[g]:oe,[m]:[sh,"scheme"]},"http"]},{[g]:Ns,[m]:[V,st]},Sr,$,j,pe],[w]:[{[f]:Ze,[w]:[{[f]:mu,[w]:[Md],[l]:b},rs],[l]:b}],[l]:b},{[f]:[Sr,{[g]:Xl,[m]:$S,[F]:Yl}],[w]:[{[f]:[{[g]:oe,[m]:[qe,"resourceId[0]"],[F]:Ql},{[g]:lt,[m]:[{[g]:K,[m]:[oh,Bs]}]}],[w]:[{[f]:[{[g]:K,[m]:[vr,Ea]}],[w]:[{[f]:Mr,[w]:[{[f]:yu,[w]:[Fd,$d,{[f]:Dr,[w]:[Ud,{[f]:wu,[w]:[Ar,{[f]:Fr,[w]:[{[f]:Ze,[w]:[{[f]:bu,[w]:[{[f]:$r,[w]:[{[f]:[{[g]:K,[m]:[ch,Bs]}],error:"Invalid ARN: Missing account id",[l]:v},{[f]:Ur,[w]:[{[f]:Su,[w]:[{[f]:Xt,endpoint:{[C]:gd,[R]:Cr,[I]:M},[l]:E},{[f]:Yt,endpoint:{[C]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",[R]:Cr,[I]:M},[l]:E},{endpoint:{[C]:"https://{accessPointName}-{bucketArn#accountId}.s3-object-lambda.{bucketArn#region}.{bucketPartition#dnsSuffix}",[R]:Cr,[I]:M},[l]:E}],[l]:b},Ld],[l]:b},Rr],[l]:b},Ir],[l]:b},kr],[l]:b}],[l]:b}],[l]:b},jd],[l]:b}
36,{error:"Invalid ARN: bucket ARN is missing a region",[l]:v}],[l]:b},Hd],[l]:b},{error:"Invalid ARN: Object Lambda ARNs only support `accesspoint` arn types, but found: `{arnType}`",[l]:v}],[l]:b},{[f]:Mr,[w]:[{[f]:yu,[w]:[{[f]:Dr,[w]:[{[f]:Mr,[w]:[{[f]:Dr,[w]:[Ud,{[f]:wu,[w]:[Ar,{[f]:Fr,[w]:[{[f]:Ze,[w]:[{[f]:[{[g]:K,[m]:[ah,"{partitionResult#name}"]}],[w]:[{[f]:$r,[w]:[{[f]:[{[g]:K,[m]:[vr,gn]}],[w]:[{[f]:Ur,[w]:[{[f]:Su,[w]:[{[f]:Br,error:"Access Points do not support S3 Accelerate",[l]:v},{[f]:[ne,Q],endpoint:{[C]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",[R]:Cn,[I]:M},[l]:E},{[f]:[ne,j],endpoint:{[C]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint-fips.{bucketArn#region}.{bucketPartition#dnsSuffix}",[R]:Cn,[I]:M},[l]:E},{[f]:[$,Q],endpoint:{[C]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.dualstack.{bucketArn#region}.{bucketPartition#dnsSuffix}",[R]:Cn,[I]:M},[l]:E},{[f]:[$,j,ae,Ue],endpoint:{[C]:gd,[R]:Cn,[I]:M},[l]:E},{[f]:[$,j],endpoint:{[C]:"https://{accessPointName}-{bucketArn#accountId}.s3-accesspoint.{bucketArn#region}.{bucketPartition#dnsSuffix}",[R]:Cn,[I]:M},[l]:E}],[l]:b},Ld],[l]:b},Rr],[l]:b},{error:"Invalid ARN: The ARN was not for the S3 service, found: {bucketArn#service}",[l]:v}],[l]:b},Ir],[l]:b},kr],[l]:b}],[l]:b}],[l]:b},jd],[l]:b}],[l]:b}],[l]:b},{[f]:[{[g]:Wt,[m]:[_a,st]}],[w]:[{[f]:eu,error:"S3 MRAP does not support dual-stack",[l]:v},{[f]:Yt,error:"S3 MRAP does not support FIPS",[l]:v},{[f]:Br,error:"S3 MRAP does not support S3 Accelerate",[l]:v},{[f]:[{[g]:ue,[m]:[{[k]:"DisableMultiRegionAccessPoints"},st]}],error:"Invalid configuration: Multi-Region Access Point ARNs are disabled.",[l]:v},{[f]:[{[g]:Ps,[m]:Or,[F]:md}],[w]:[{[f]:[{[g]:K,[m]:[{[g]:oe,[m]:[{[k]:md},de]},{[g]:oe,[m]:[qe,"partition"]}]}],[w]:[{endpoint:{[C]:"https://{accessPointName}.accesspoint.s3-global.{mrapPartition#dnsSuffix}",[R]:{[Be]:[{[xe]:st,name:Sa,[_e]:gn,[wa]:jS}]},[I]:M},[l]:E}],[l]:b},{error:"Client was configured for partition `{mrapPartition#name}` but bucket referred to partition `{bucketArn#partition}`",[l]:v}],[l]:b}],[l]:b},{error:"Invalid Access Point Name",[l]:v}],[l]:b},Hd],[l]:b},{[f]:[{[g]:K,[m]:[vr,$n]}],[w]:[{[f]:eu,error:"S3 Outposts does not support Dual-stack",[l]:v},{[f]:Yt,error:"S3 Outposts does not support FIPS",[l]:v},{[f]:Br,error:"S3 Outposts does not support S3 Accelerate",[l]:v},{[f]:[{[g]:Ke,[m]:[{[g]:oe,[m]:[qe,"resourceId[4]"]}]}],error:"Invalid Arn: Outpost Access Point ARN contains sub resources",[l]:v},{[f]:[{[g]:oe,[m]:HS,[F]:_i}],[w]:[{[f]:pu,[w]:[Ar,{[f]:Fr,[w]:[{[f]:Ze,[w]:[{[f]:bu,[w]:[{[f]:$r,[w]:[{[f]:Ur,[w]:[{[f]:[{[g]:oe,[m]:zS,[F]:yd}],[w]:[{[f]:[{[g]:oe,[m]:[qe,"resourceId[3]"],[F]:xa}],[w]:[{[f]:[{[g]:K,[m]:[{[k]:yd},eh]}],[w]:[{[f]:Xt,endpoint:{[C]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.{url#authority}",[R]:zd,[I]:M},[l]:E},{endpoint:{[C]:"https://{accessPointName}-{bucketArn#accountId}.{outpostId}.s3-outposts.{bucketArn#region}.{bucketPartition#dnsSuffix}",[R]:zd,[I]:M},[l]:E}],[l]:b},{error:"Expected an outpost type `accesspoint`, found {outpostType}",[l]:v}],[l]:b},{error:"Invalid ARN: expected an access point name",[l]:v}],[l]:b},{error:"Invalid ARN: Expected a 4-component resource",[l]:v}],[l]:b},Rr],[l]:b},Ir],[l]:b},kr],[l]:b}],[l]:b}],[l]:b},{error:"Invalid ARN: The outpost Id may only contain a-z, A-Z, 0-9 and `-`. Found: `{outpostId}`",[l]:v}],[l]:b},{error:"Invalid ARN: The Outpost Id was not set",[l]:v}],[l]:b},{error:"Invalid ARN: Unrecognized format: {Bucket} (type: {arnType})",[l]:v}],[l]:b},{error:"Invalid ARN: No ARN type specified",[l]:v}],[l]:b},{[f]:[{[g]:ee,[m]:[V,0,4,MS],[F]:wd},{[g]:K,[m]:[{[k]:wd},"arn:"]},{[g]:lt,[m]:[{[g]:Ke,[m]:[qd]}]}],error:"Invalid ARN: `{Bucket}` was not a valid ARN",[l]:v},{[f]:[{[g]:ue,[m]:[DS,st]},qd],error:"Path-style addressing cannot be used with ARN buckets",[l]:v},{[f]:US,[w]:[{[f]:Ze,[w]:[{[f]:[pe],[w]:[{[f]:[Q,D,ne,we],endpoint:{[C]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:be,[I]:M},[l]:E},{[f]:[Q,D,ne,H,Se],[w]:[{endpoint:Vd,[l]:E}],[l]:b},{[f]:[Q,D,ne,H,Ee],endpoint:Vd,[l]:E},{[f]:[j,D,ne,we],endpoint:{[C]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:be,[I]:M},[l]:E},{[f]:[j,D,ne,H,Se],[w]:[{endpoint:Wd,[l]:E}],[l]:b},{[f]:[j,D,ne,H,Ee],endpoint:Wd,[l]:E},{[f]:[Q,D,$,we],endpoint:{[C]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}/{uri_encoded_bucket}",[R]:be,[I]:M},[l]:E},{[f]:[Q,D,$,H,Se],[w]:[{endpoint:Kd,[l]:E}],[l]:b},{[f]:[Q,D,$,H,Ee],endpoint:Kd,[l]:E},{[f]:[j,ae,Ue,$,we],endpoint:{[C]:th,[R]:be,[I]:M},[l]:E},{[f]:[j,ae,Ue,$,H,Se],[w]:[{[f]:yt,endpoint:Tr,[l]:E},{endpoint:Tr,[l]:E}],[l]:b},{[f]:[j,ae,Ue,$,H,Ee],endpoint:Tr,[l]:E},{[f]:[j,D,$,we],endpoint:{[C]:bd,[R]:be,[I]:M},[l]:E},{[f]:[j,D,$,H,Se],[w]:[{[f]:yt,endpoint:{[C]:bd,[R]:me,[I]:M},[l]:E},{endpoint:Gd,[l]:E}],[l]:b},{[f]:[j,D,$,H,Ee],endpoint:Gd,[l]:E}],[l]:b},{error:"Path-style addressing cannot be used with S3 Accelerate",[l]:v}],[l]:b}],[l]:b}],[l]:b},{[f]:[{[g]:Ke,[m]:[Jd]},{[g]:ue,[m]:[Jd,st]}],[w]:[{[f]:Ze,[w]:[{[f]:Eu,[w]:[Fd,$d,{[f]:Xt,endpoint:{[C]:ps,[R]:Pr,[I]:M},[l]:E},{[f]:Yt,endpoint:{[C]:"https://s3-object-lambda-fips.{Region}.{partitionResult#dnsSuffix}",[R]:Pr,[I]:M},[l]:E},{endpoint:{[C]:"https://s3-object-lambda.{Region}.{partitionResult#dnsSuffix}",[R]:Pr,[I]:M},[l]:E}],[l]:b},rs],[l]:b}],[l]:b},{[f]:[Id],[w]:[{[f]:Ze,[w]:[{[f]:Eu,[w]:[{[f]:[ne,Q,D,we],endpoint:{[C]:"https://s3-fips.dualstack.us-east-1.{partitionResult#dnsSuffix}",[R]:be,[I]:M},[l]:E},{[f]:[ne,Q,D,H,Se],[w]:[{endpoint:Zd,[l]:E}],[l]:b},{[f]:[ne,Q,D,H,Ee],endpoint:Zd,[l]:E},{[f]:[ne,j,D,we],endpoint:{[C]:"https://s3-fips.us-east-1.{partitionResult#dnsSuffix}",[R]:be,[I]:M},[l]:E},{[f]:[ne,j,D,H,Se],[w]:[{endpoint:Xd,[l]:E}],[l]:b},{[f]:[ne,j,D,H,Ee],endpoint:Xd,[l]:E},{[f]:[$,Q,D,we],endpoint:{[C]:"https://s3.dualstack.us-east-1.{partitionResult#dnsSuffix}",[R]:be,[I]:M},[l]:E},{[f]:[$,Q,D,H,Se],[w]:[{endpoint:Yd,[l]:E}],[l]:b},{[f]:[$,Q,D,H,Ee],endpoint:Yd,[l]:E},{[f]:[$,j,ae,Ue,we],endpoint:{[C]:ps,[R]:be,[I]:M},[l]:E},{[f]:[$,j,ae,Ue,H,Se],[w]:[{[f]:yt,endpoint:Nr,[l]:E},{endpoint:Nr,[l]:E}],[l]:b},{[f]:[$,j,ae,Ue,H,Ee],endpoint:Nr,[l]:E},{[f]:[$,j,D,we],endpoint:{[C]:Sd,[R]:be,[I]:M},[l]:E},{[f]:[$,j,D,H,Se],[w]:[{[f]:yt,endpoint:{[C]:Sd,[R]:me,[I]:M},[l]:E},{endpoint:Qd,[l]:E}],[l]:b},{[f]:[$,j,D,H,Ee],endpoint:Qd,[l]:E}],[l]:b},rs],[l]:b}],[l]:b}],[l]:b},{error:"A region must be set when sending requests to S3.",[l]:v}]},VS=qS,WS=new Ki({size:50,params:["Accelerate","Bucket","DisableAccessPoints","DisableMultiRegionAccessPoints","DisableS3ExpressSessionAuth","Endpoint","ForcePathStyle","Region","UseArnRegion","UseDualStack","UseFIPS","UseGlobalEndpoint","UseObjectLambdaEndpoint","UseS3ExpressControlEndpoint"]}),dh=(e,t={})=>WS.get(e,()=>Zi(VS,{endpointParams:e,logger:t.logger}));cn.aws=js;const KS=e=>async(t,n,s)=>{if(!s)throw new Error("Could not find `input` for `defaultEndpointRuleSetHttpAuthSchemeParametersProvider`");const r=await e(t,n,s),i=kt(n)?.commandInstance?.constructor?.getEndpointParameterInstru
36ctions;if(!i)throw new Error(`getEndpointParameterInstructions() is not defined on \`${n.commandName}\``);const o=await Sl(s,{getEndpointParameterInstructions:i},t);return Object.assign(r,o)},GS=async(e,t,n)=>({operation:kt(t).operation,region:await Me(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}),JS=KS(GS);function uh(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}function lh(e){return{schemeId:"aws.auth#sigv4a",signingProperties:{name:"s3",region:e.region},propertiesExtractor:(t,n)=>({signingProperties:{config:t,context:n}})}}const ZS=(e,t,n)=>r=>{const o=e(r).properties?.authSchemes;if(!o)return t(r);const a=[];for(const c of o){const{name:d,properties:u={},...h}=c,p=d.toLowerCase();d!==p&&console.warn(`HttpAuthScheme has been normalized with lowercasing: \`${d}\` to \`${p}\``);let y;if(p==="sigv4a"){y="aws.auth#sigv4a";const _=o.find(T=>{const P=T.name.toLowerCase();return P!=="sigv4a"&&P.startsWith("sigv4")});if(Wl.sigv4aDependency()==="none"&&_)continue}else if(p.startsWith("sigv4"))y="aws.auth#sigv4";else throw new Error(`Unknown HttpAuthScheme found in \`@smithy.rules#endpointRuleSet\`: \`${p}\``);const x=n[y];if(!x)throw new Error(`Could not find HttpAuthOption create function for \`${y}\``);const A=x(r);A.schemeId=y,A.signingProperties={...A.signingProperties||{},...h,...u},a.push(A)}return a},XS=e=>{const t=[];switch(e.operation){default:t.push(uh(e)),t.push(lh(e))}return t},YS=ZS(dh,XS,{"aws.auth#sigv4":uh,"aws.auth#sigv4a":lh}),QS=e=>{const t=Qi(e),n=Pp(t);return Object.assign(n,{authSchemePreference:Me(e.authSchemePreference??[])})},e0=e=>Object.assign(e,{useFipsEndpoint:e.useFipsEndpoint??!1,useDualstackEndpoint:e.useDualstackEndpoint??!1,forcePathStyle:e.forcePathStyle??!1,useAccelerateEndpoint:e.useAccelerateEndpoint??!1,useGlobalEndpoint:e.useGlobalEndpoint??!1,disableMultiregionAccessPoints:e.disableMultiregionAccessPoints??!1,defaultSigningName:"s3"}),t0={ForcePathStyle:{type:"clientContextParams",name:"forcePathStyle"},UseArnRegion:{type:"clientContextParams",name:"useArnRegion"},DisableMultiRegionAccessPoints:{type:"clientContextParams",name:"disableMultiregionAccessPoints"},Accelerate:{type:"clientContextParams",name:"useAccelerateEndpoint"},DisableS3ExpressSessionAuth:{type:"clientContextParams",name:"disableS3ExpressSessionAuth"},UseGlobalEndpoint:{type:"builtInParams",name:"useGlobalEndpoint"},UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};class Re extends Ft{constructor(t){super(t),Object.setPrototypeOf(this,Re.prototype)}}class va extends Re{name="NoSuchUpload";$fault="client";constructor(t){super({name:"NoSuchUpload",$fault:"client",...t}),Object.setPrototypeOf(this,va.prototype)}}class Aa extends Re{name="ObjectNotInActiveTierError";$fault="client";constructor(t){super({name:"ObjectNotInActiveTierError",$fault:"client",...t}),Object.setPrototypeOf(this,Aa.prototype)}}class Ca extends Re{name="BucketAlreadyExists";$fault="client";constructor(t){super({name:"BucketAlreadyExists",$fault:"client",...t}),Object.setPrototypeOf(this,Ca.prototype)}}class Ra extends Re{name="BucketAlreadyOwnedByYou";$fault="client";constructor(t){super({name:"BucketAlreadyOwnedByYou",$fault:"client",...t}),Object.setPrototypeOf(this,Ra.prototype)}}class Ia extends Re{name="NoSuchBucket";$fault="client";constructor(t){super({name:"NoSuchBucket",$fault:"client",...t}),Object.setPrototypeOf(this,Ia.prototype)}}var xu;(function(e){e.visit=(t,n)=>t.Prefix!==void 0?n.Prefix(t.Prefix):t.Tag!==void 0?n.Tag(t.Tag):t.And!==void 0?n.And(t.And):n._(t.$unknown[0],t.$unknown[1])})(xu||(xu={}));var _u;(function(e){e.visit=(t,n)=>t.Prefix!==void 0?n.Prefix(t.Prefix):t.Tag!==void 0?n.Tag(t.Tag):t.AccessPointArn!==void 0?n.AccessPointArn(t.AccessPointArn):t.And!==void 0?n.And(t.And):n._(t.$unknown[0],t.$unknown[1])})(_u||(_u={}));class ka extends Re{name="InvalidObjectState";$fault="client";StorageClass;AccessTier;constructor(t){super({name:"InvalidObjectState",$fault:"client",...t}),Object.setPrototypeOf(this,ka.prototype),this.StorageClass=t.StorageClass,this.AccessTier=t.AccessTier}}class Ta extends Re{name="NoSuchKey";$fault="client";constructor(t){super({name:"NoSuchKey",$fault:"client",...t}),Object.setPrototypeOf(this,Ta.prototype)}}class Pa extends Re{name="NotFound";$fault="client";constructor(t){super({name:"NotFound",$fault:"client",...t}),Object.setPrototypeOf(this,Pa.prototype)}}const n0=e=>({...e,...e.SecretAccessKey&&{SecretAccessKey:un},...e.SessionToken&&{SessionToken:un}}),s0=e=>({...e,...e.SSEKMSKeyId&&{SSEKMSKeyId:un},...e.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:un},...e.Credentials&&{Credentials:n0(e.Credentials)}}),r0=e=>({...e,...e.SSEKMSKeyId&&{SSEKMSKeyId:un},...e.SSEKMSEncryptionContext&&{SSEKMSEncryptionContext:un}});class Na extends Re{name="EncryptionTypeMismatch";$fault="client";constructor(t){super({name:"EncryptionTypeMismatch",$fault:"client",...t}),Object.setPrototypeOf(this,Na.prototype)}}class Oa extends Re{name="InvalidRequest";$fault="client";constructor(t){super({name:"InvalidRequest",$fault:"client",...t}),Object.setPrototypeOf(this,Oa.prototype)}}class Ba extends Re{name="InvalidWriteOffset";$fault="client";constructor(t){super({name:"InvalidWriteOffset",$fault:"client",...t}),Object.setPrototypeOf(this,Ba.prototype)}}class Ma extends Re{name="TooManyParts";$fault="client";constructor(t){super({name:"TooManyParts",$fault:"client",...t}),Object.setPrototypeOf(this,Ma.prototype)}}class Da extends Re{name="IdempotencyParameterMismatch";$fault="client";constructor(t){super({name:"IdempotencyParameterMismatch",$fault:"client",...t}),Object.setPrototypeOf(this,Da.prototype)}}class Fa extends Re{name="ObjectAlreadyInActiveTierError";$fault="client";constructor(t){super({name:"ObjectAlreadyInActiveTierError",$fault:"client",...t}),Object.setPrototypeOf(this,Fa.prototype)}}var vu;
36(function(e){e.visit=(t,n)=>t.Records!==void 0?n.Records(t.Records):t.Stats!==void 0?n.Stats(t.Stats):t.Progress!==void 0?n.Progress(t.Progress):t.Cont!==void 0?n.Cont(t.Cont):t.End!==void 0?n.End(t.End):n._(t.$unknown[0],t.$unknown[1])})(vu||(vu={}));const i0=async(e,t)=>{const n=Wu(e,t),s=le({},ks,{[q0]:e[B0],[mh]:e[fh],[yh]:e[gh],[wh]:e[ph],[Ci]:[()=>ks(e[Ai]),()=>e[Ai].toString()]});n.bp("/"),n.p("Bucket",()=>e.Bucket,"{Bucket}",!1);const r=le({[H0]:[,""]});return n.m("GET").h(s).q(r).b(void 0),n.build()},n_=async(e,t)=>{const n=Wu(e,t),s=le({},ks,{[G0]:e[O0],[V0]:e[T0],[W0]:[()=>ks(e[Au]),()=>(e[Au]||[]).map(Vf).join(", ")]});n.bp("/"),n.p("Bucket",()=>e.Bucket,"{Bucket}",!1);const r=le({[U0]:[,"2"],[D0]:[,e[ms]],[F0]:[,e[ys]],[L0]:[()=>e.MaxKeys!==void 0,()=>e[ws].toString()],[j0]:[,e[zt]],[M0]:[,e[gs]],[$0]:[()=>e.FetchOwner!==void 0,()=>e[P0].toString()],[z0]:[,e[bs]]});return n.m("GET").h(s).q(r).b(void 0),n.build()},o0=async(e,t)=>{if(e.statusCode!==200&&e.statusCode>=300)return hh(e,t);const n=le({$metadata:De(e),[fh]:[,e.headers[mh]],[gh]:[,e.headers[yh]],[ph]:[,e.headers[wh]],[Ai]:[()=>e.headers[Ci]!==void 0,()=>ji(e.headers[Ci])]}),s=Hn(zi(await ao(e.body,t)),"body");return s[Hr]!=null&&(n[Hr]=k0(s[Hr])),n},s_=async(e,t)=>{if(e.statusCode!==200&&e.statusCode>=300)return hh(e,t);const n=le({$metadata:De(e),[N0]:[,e.headers[K0]]}),s=Hn(zi(await ao(e.body,t)),"body");return s.CommonPrefixes===""?n[os]=[]:s[os]!=null&&(n[os]=v0(gi(s[os]))),s.Contents===""?n[as]=[]:s[as]!=null&&(n[as]=C0(gi(s[as]))),s[gs]!=null&&(n[gs]=J(s[gs])),s[ms]!=null&&(n[ms]=J(s[ms])),s[ys]!=null&&(n[ys]=J(s[ys])),s[Jr]!=null&&(n[Jr]=ji(s[Jr])),s[Xr]!=null&&(n[Xr]=Qa(s[Xr])),s[ws]!=null&&(n[ws]=Qa(s[ws])),s[Qr]!=null&&(n[Qr]=J(s[Qr])),s[ei]!=null&&(n[ei]=J(s[ei])),s[zt]!=null&&(n[zt]=J(s[zt])),s[bs]!=null&&(n[bs]=J(s[bs])),n},hh=async(e,t)=>{const n={...e,body:await lm(e.body,t)},s=hm(e,n.body);switch(s){case"NoSuchUpload":case"com.amazonaws.s3#NoSuchUpload":throw await y0(n);case"ObjectNotInActiveTierError":case"com.amazonaws.s3#ObjectNotInActiveTierError":throw await S0(n);case"BucketAlreadyExists":case"com.amazonaws.s3#BucketAlreadyExists":throw await c0(n);case"BucketAlreadyOwnedByYou":case"com.amazonaws.s3#BucketAlreadyOwnedByYou":throw await d0(n);case"NoSuchBucket":case"com.amazonaws.s3#NoSuchBucket":throw await g0(n);case"InvalidObjectState":case"com.amazonaws.s3#InvalidObjectState":throw await h0(n);case"NoSuchKey":case"com.amazonaws.s3#NoSuchKey":throw await m0(n);case"NotFound":case"com.amazonaws.s3#NotFound":throw await w0(n);case"EncryptionTypeMismatch":case"com.amazonaws.s3#EncryptionTypeMismatch":throw await u0(n);case"InvalidRequest":case"com.amazonaws.s3#InvalidRequest":throw await f0(n);case"InvalidWriteOffset":case"com.amazonaws.s3#InvalidWriteOffset":throw await p0(n);case"TooManyParts":case"com.amazonaws.s3#TooManyParts":throw await E0(n);case"IdempotencyParameterMismatch":case"com.amazonaws.s3#IdempotencyParameterMismatch":throw await l0(n);case"ObjectAlreadyInActiveTierError":case"com.amazonaws.s3#ObjectAlreadyInActiveTierError":throw await b0(n);default:const r=n.body;return a0({output:e,parsedBody:r,errorCode:s})}},a0=ul(Re),c0=async(e,t)=>{const n=le({});e.body;const s=new Ca({$metadata:De(e),...n});return N(s,e.body)},d0=async(e,t)=>{const n=le({});e.body;const s=new Ra({$metadata:De(e),...n});return N(s,e.body)},u0=async(e,t)=>{const n=le({});e.body;const s=new Na({$metadata:De(e),...n});return N(s,e.body)},l0=async(e,t)=>{const n=le({});e.body;const s=new Da({$metadata:De(e),...n});return N(s,e.body)},h0=async(e,t)=>{const n=le({}),s=e.body;s[jr]!=null&&(n[jr]=J(s[jr])),s[on]!=null&&(n[on]=J(s[on]));const r=new ka({$metadata:De(e),...n});return N(r,e.body)},f0=async(e,t)=>{const n=le({});e.body;const s=new Oa({$metadata:De(e),...n});return N(s,e.body)},p0=async(e,t)=>{const n=le({});e.body;const s=new Ba({$metadata:De(e),...n});return N(s,e.body)},g0=async(e,t)=>{const n=le({});e.body;const s=new Ia({$metadata:De(e),...n});return N(s,e.body)},m0=async(e,t)=>{const n=le({});e.body;const s=new Ta({$metadata:De(e),...n});return N(s,e.body)},y0=async(e,t)=>{const n=le({});e.body;const s=new va({$metadata:De(e),...n});return N(s,e.body)},w0=async(e,t)=>{const n=le({});e.body;const s=new Pa({$metadata:De(e),...n});return N(s,e.body)},b0=async(e,t)=>{const n=le({});e.body;const s=new Fa({$metadata:De(e),...n});return N(s,e.body)},S0=async(e,t)=>{const n=le({});e.body;const s=new Aa({$metadata:De(e),...n});return N(s,e.body)},E0=async(e,t)=>{const n=le({});e.body;const s=new Ma({$metadata:De(e),...n});return N(s,e.body)},x0=(e,t)=>(e||[]).filter(n=>n!=null).map(n=>J(n)),_0=(e,t)=>{const n={};return e[zt]!=null&&(n[zt]=J(e[zt])),n},v0=(e,t)=>(e||[]).filter(n=>n!=null).map(n=>_0(n)),A0=(e,t)=>{const n={};return e[Zr]!=null&&(n[Zr]=J(e[Zr])),e[Yr]!=null&&(n[Yr]=Hn(qi(e[Yr]))),e[Vr]!=null&&(n[Vr]=J(e[Vr])),e.ChecksumAlgorithm===""?n[is]=[]:e[is]!=null&&(n[is]=x0(gi(e[is]))),e[zr]!=null&&(n[zr]=J(e[zr])),e[oi]!=null&&(n[oi]=Bf(e[oi])),e[on]!=null&&(n[on]=J(e[on])),e[ti]!=null&&(n[ti]=R0(e[ti])),e[si]!=null&&(n[si]=I0(e[si])),n},C0=(e,t)=>(e||[]).filter(n=>n!=null).map(n=>A0(n)),R0=(e,t)=>{const n={};return e[qr]!=null&&(n[qr]=J(e[qr])),e[Kr]!=null&&(n[Kr]=J(e[Kr])),n},I0=(e,t)=>{const n={};return e[Gr]!=null&&(n[Gr]=ji(e[Gr])),e[ni]!=null&&(n[ni]=Hn(qi(e[ni]))),n},k0=(e,t)=>{const n={};return e[Lr]!=null&&(n[Lr]=J(e[Lr])),e[ri]!=null&&(n[ri]=J(e[ri])),e[ii]!=null&&(n[ii]=J(e[ii])),e[Wr]!=null&&(n[Wr]=Hn(qi(e[Wr]))),n},De=e=>({httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}),Lr="AccessKeyId",jr="AccessTier",Ai="BucketKeyEnabled",Hr="Credentials",is="ChecksumAlgorithm",os="CommonPrefixes",zr="ChecksumType",gs="ContinuationToken",as="Contents",ms="Delimiter",qr="DisplayName",T0="E
36xpectedBucketOwner",ys="EncodingType",Vr="ETag",Wr="Expiration",P0="FetchOwner",Kr="ID",Gr="IsRestoreInProgress",Jr="IsTruncated",Zr="Key",Xr="KeyCount",Yr="LastModified",ws="MaxKeys",Qr="Name",ei="NextContinuationToken",ti="Owner",Au="OptionalObjectAttributes",zt="Prefix",N0="RequestCharged",ni="RestoreExpiryDate",O0="RequestPayer",si="RestoreStatus",bs="StartAfter",ri="SecretAccessKey",on="StorageClass",B0="SessionMode",fh="ServerSideEncryption",ph="SSEKMSEncryptionContext",gh="SSEKMSKeyId",ii="SessionToken",oi="Size",M0="continuation-token",D0="delimiter",F0="encoding-type",$0="fetch-owner",U0="list-type",L0="max-keys",j0="prefix",H0="session",z0="start-after",q0="x-amz-create-session-mode",V0="x-amz-expected-bucket-owner",W0="x-amz-optional-object-attributes",K0="x-amz-request-charged",G0="x-amz-request-payer",mh="x-amz-server-side-encryption",yh="x-amz-server-side-encryption-aws-kms-key-id",Ci="x-amz-server-side-encryption-bucket-key-enabled",wh="x-amz-server-side-encryption-context";class J0 extends zs.classBuilder().ep({...t0,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function(t,n,s,r){return[Ui(s,this.serialize,this.deserialize),po(s,t.getEndpointParameterInstructions()),CS(s)]}).s("AmazonS3","CreateSession",{}).n("S3Client","CreateSessionCommand").f(r0,s0).ser(i0).de(o0).build(){}const Z0="3.883.0",X0={version:Z0},Y0=e=>new TextEncoder().encode(e);function Cu(e){return typeof e=="string"?e.length===0:e.byteLength===0}var bh={name:"SHA-1"},Ru={name:"HMAC",hash:bh},Q0=new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]),eE=(function(){function e(t){this.toHash=new Uint8Array(0),t!==void 0&&(this.key=new Promise(function(n,s){At().crypto.subtle.importKey("raw",Iu(t),Ru,!1,["sign"]).then(n,s)}),this.key.catch(function(){}))}return e.prototype.update=function(t){if(!Cu(t)){var n=Iu(t),s=new Uint8Array(this.toHash.byteLength+n.byteLength);s.set(this.toHash,0),s.set(n,this.toHash.byteLength),this.toHash=s}},e.prototype.digest=function(){var t=this;return this.key?this.key.then(function(n){return At().crypto.subtle.sign(Ru,n,t.toHash).then(function(s){return new Uint8Array(s)})}):Cu(this.toHash)?Promise.resolve(Q0):Promise.resolve().then(function(){return At().crypto.subtle.digest(bh,t.toHash)}).then(function(n){return Promise.resolve(new Uint8Array(n))})},e.prototype.reset=function(){this.toHash=new Uint8Array(0)},e})();function Iu(e){return typeof e=="string"?Y0(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}var tE=(function(){function e(t){if(Cl(At()))this.hash=new eE(t);else throw new Error("SHA1 not supported")}return e.prototype.update=function(t,n){this.hash.update(fn(t))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e})();class On{constructor(t){if(this.bytes=t,t.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(t){if(t>9223372036854776e3||t<-9223372036854776e3)throw new Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);const n=new Uint8Array(8);for(let s=7,r=Math.abs(Math.round(t));s>-1&&r>0;s--,r/=256)n[s]=r;return t<0&&ku(n),new On(n)}valueOf(){const t=this.bytes.slice(0),n=t[0]&128;return n&&ku(t),parseInt(ze(t),16)*(n?-1:1)}toString(){return String(this.valueOf())}}function ku(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}class nE{constructor(t,n){this.toUtf8=t,this.fromUtf8=n}format(t){const n=[];for(const i of Object.keys(t)){const o=this.fromUtf8(i);n.push(Uint8Array.from([o.byteLength]),o,this.formatHeaderValue(t[i]))}const s=new Uint8Array(n.reduce((i,o)=>i+o.byteLength,0));let r=0;for(const i of n)s.set(i,r),r+=i.byteLength;return s}formatHeaderValue(t){switch(t.type){case"boolean":return Uint8Array.from([t.value?0:1]);case"byte":return Uint8Array.from([2,t.value]);case"short":const n=new DataView(new ArrayBuffer(3));return n.setUint8(0,3),n.setInt16(1,t.value,!1),new Uint8Array(n.buffer);case"integer":const s=new DataView(new ArrayBuffer(5));return s.setUint8(0,4),s.setInt32(1,t.value,!1),new Uint8Array(s.buffer);
36case"long":const r=new Uint8Array(9);return r[0]=5,r.set(t.value.bytes,1),r;case"binary":const i=new DataView(new ArrayBuffer(3+t.value.byteLength));i.setUint8(0,6),i.setUint16(1,t.value.byteLength,!1);const o=new Uint8Array(i.buffer);return o.set(t.value,3),o;case"string":const a=this.fromUtf8(t.value),c=new DataView(new ArrayBuffer(3+a.byteLength));c.setUint8(0,7),c.setUint16(1,a.byteLength,!1);const d=new Uint8Array(c.buffer);return d.set(a,3),d;case"timestamp":const u=new Uint8Array(9);return u[0]=8,u.set(On.fromNumber(t.value.valueOf()).bytes,1),u;case"uuid":if(!lE.test(t.value))throw new Error(`Invalid UUID received: ${t.value}`);const h=new Uint8Array(17);return h[0]=9,h.set(qu(t.value.replace(/\-/g,"")),1),h}}parse(t){const n={};let s=0;for(;s<t.byteLength;){const r=t.getUint8(s++),i=this.toUtf8(new Uint8Array(t.buffer,t.byteOffset+s,r));switch(s+=r,t.getUint8(s++)){case 0:n[i]={type:Pu,value:!0};break;case 1:n[i]={type:Pu,value:!1};break;case 2:n[i]={type:sE,value:t.getInt8(s++)};break;case 3:n[i]={type:rE,value:t.getInt16(s,!1)},s+=2;break;case 4:n[i]={type:iE,value:t.getInt32(s,!1)},s+=4;break;case 5:n[i]={type:oE,value:new On(new Uint8Array(t.buffer,t.byteOffset+s,8))},s+=8;break;case 6:const o=t.getUint16(s,!1);s+=2,n[i]={type:aE,value:new Uint8Array(t.buffer,t.byteOffset+s,o)},s+=o;break;case 7:const a=t.getUint16(s,!1);s+=2,n[i]={type:cE,value:this.toUtf8(new Uint8Array(t.buffer,t.byteOffset+s,a))},s+=a;break;case 8:n[i]={type:dE,value:new Date(new On(new Uint8Array(t.buffer,t.byteOffset+s,8)).valueOf())},s+=8;break;case 9:const c=new Uint8Array(t.buffer,t.byteOffset+s,16);s+=16,n[i]={type:uE,value:`${ze(c.subarray(0,4))}-${ze(c.subarray(4,6))}-${ze(c.subarray(6,8))}-${ze(c.subarray(8,10))}-${ze(c.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return n}}var Tu;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(Tu||(Tu={}));const Pu="boolean",sE="byte",rE="short",iE="integer",oE="long",aE="binary",cE="string",dE="timestamp",uE="uuid",lE=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Sh=4,St=Sh*2,Nt=4,hE=St+Nt*2;function fE({byteLength:e,byteOffset:t,buffer:n}){if(e<hE)throw new Error("Provided message too short to accommodate event stream message overhead");const s=new DataView(n,t,e),r=s.getUint32(0,!1);if(e!==r)throw new Error("Reported message length does not match received message length");const i=s.getUint32(Sh,!1),o=s.getUint32(St,!1),a=s.getUint32(e-Nt,!1),c=new Vl().update(new Uint8Array(n,t,St));if(o!==c.digest())throw new Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(n,t+St,e-(St+Nt))),a!==c.digest())throw new Error(`The message checksum (${c.digest()}) did not match the expected value of ${a}`);return{headers:new DataView(n,t+St+Nt,i),body:new Uint8Array(n,t+St+Nt+i,r-i-(St+Nt+Nt))}}class pE{constructor(t,n){this.headerMarshaller=new nE(t,n),this.messageBuffer=[],this.isEndOfStream=!1}feed(t){this.messageBuffer.push(this.decode(t))}endOfStream(){this.isEndOfStream=!0}getMessage(){const t=this.messageBuffer.pop(),n=this.isEndOfStream;return{getMessage(){return t},isEndOfStream(){return n}}}getAvailableMessages(){const t=this.messageBuffer;this.messageBuffer=[];const n=this.isEndOfStream;return{getMessages(){return t},isEndOfStream(){return n}}}encode({headers:t,body:n}){const s=this.headerMarshaller.format(t),r=s.byteLength+n.byteLength+16,i=new Uint8Array(r),o=new DataView(i.buffer,i.byteOffset,i.byteLength),a=new Vl;return o.setUint32(0,r,!1),o.setUint32(4,s.byteLength,!1),o.setUint32(8,a.update(i.subarray(0,8)).digest(),!1),i.set(s,12),i.set(n,s.byteLength+12),o.setUint32(r-4,a.update(i.subarray(8,r-4)).digest(),!1),i}decode(t){const{headers:n,body:s}=fE(t);return{headers:this.headerMarshaller.parse(n),body:s}}formatHeaders(t){return this.headerMarshaller.format(t)}}class gE{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const t of this.options.inputStream)yield this.options.decoder.decode(t)}}class mE{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const t of this.options.messageStream)yield this.options.encoder.encode(t);this.options.includeEndFrame&&(yield new Uint8Array(0))}}class yE{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const t of this.options.messageStream){const n=await this.options.deserializer(t);n!==void 0&&(yield n)}}}class wE{constructor(t){this.options=t}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(const t of this.options.inputStream)yield this.options.serializer(t)}}function bE(e){let t=0,n=0,s=null,r=null;const i=a=>
36{if(typeof a!="number")throw new Error("Attempted to allocate an event message where size was not a number: "+a);t=a,n=4,s=new Uint8Array(a),new DataView(s.buffer).setUint32(0,a,!1)},o=async function*(){const a=e[Symbol.asyncIterator]();for(;;){const{value:c,done:d}=await a.next();if(d){if(t)if(t===n)yield s;else throw new Error("Truncated event message received.");else return;return}const u=c.length;let h=0;for(;h<u;){if(!s){const y=u-h;r||(r=new Uint8Array(4));const x=Math.min(4-n,y);if(r.set(c.slice(h,h+x),n),n+=x,h+=x,n<4)break;i(new DataView(r.buffer).getUint32(0,!1)),r=null}const p=Math.min(t-n,u-h);s.set(c.slice(h,h+p),n),n+=p,h+=p,t&&t===n&&(yield s,s=null,t=0,n=0)}}};return{[Symbol.asyncIterator]:o}}function SE(e,t){return async function(n){const{value:s}=n.headers[":message-type"];if(s==="error"){const r=new Error(n.headers[":error-message"].value||"UnknownError");throw r.name=n.headers[":error-code"].value,r}else if(s==="exception"){const r=n.headers[":exception-type"].value,i={[r]:n},o=await e(i);if(o.$unknown){const a=new Error(t(n.body));throw a.name=r,a}throw o[r]}else if(s==="event"){const r={[n.headers[":event-type"].value]:n},i=await e(r);return i.$unknown?void 0:i}else throw Error(`Unrecognizable event type: ${n.headers[":event-type"].value}`)}}let EE=class{constructor({utf8Encoder:t,utf8Decoder:n}){this.eventStreamCodec=new pE(t,n),this.utfEncoder=t}deserialize(t,n){const s=bE(t);return new yE({messageStream:new gE({inputStream:s,decoder:this.eventStreamCodec}),deserializer:SE(n,this.utfEncoder)})}serialize(t,n){return new mE({messageStream:new wE({inputStream:t,serializer:n}),encoder:this.eventStreamCodec,includeEndFrame:!0})}};const xE=e=>({[Symbol.asyncIterator]:async function*(){const t=e.getReader();try{for(;;){const{done:n,value:s}=await t.read();if(n)return;yield s}}finally{t.releaseLock()}}}),_E=e=>{const t=e[Symbol.asyncIterator]();return new ReadableStream({async pull(n){const{done:s,value:r}=await t.next();if(s)return n.close();n.enqueue(r)}})};class vE{constructor({utf8Encoder:t,utf8Decoder:n}){this.universalMarshaller=new EE({utf8Decoder:n,utf8Encoder:t})}deserialize(t,n){const s=AE(t)?xE(t):t;return this.universalMarshaller.deserialize(s,n)}serialize(t,n){const s=this.universalMarshaller.serialize(t,n);return typeof ReadableStream=="function"?_E(s):s}}const AE=e=>typeof ReadableStream=="function"&&e instanceof ReadableStream,CE=e=>new vE(e);async function RE(e,t,n=1024*1024){const s=e.size;let r=0;for(;r<s;){const i=e.slice(r,Math.min(s,r+n));t(new Uint8Array(await i.arrayBuffer())),r+=i.size}}const IE=async function(t,n){const s=new t;return await RE(n,r=>{s.update(r)}),s.digest()},wt=64,kE=16,TE=[1732584193,4023233417,2562383102,271733878];class PE{constructor(){this.reset()}update(t){if(NE(t))return;if(this.finished)throw new Error("Attempted to update an already finished hash.");const n=OE(t);let s=0,{byteLength:r}=n;for(this.bytesHashed+=r;r>0;)this.buffer.setUint8(this.bufferLength++,n[s++]),r--,this.bufferLength===wt&&(this.hashBuffer(),this.bufferLength=0)}async digest(){if(!this.finished){const{buffer:n,bufferLength:s,bytesHashed:r}=this,i=r*8;if(n.setUint8(this.bufferLength++,128),s%wt>=wt-8){for(let o=this.bufferLength;o<wt;o++)n.setUint8(o,0);this.hashBuffer(),this.bufferLength=0}for(let o=this.bufferLength;o<wt-8;o++)n.setUint8(o,0);n.setUint32(wt-8,i>>>0,!0),n.setUint32(wt-4,Math.floor(i/4294967296),!0),this.hashBuffer(),this.finished=!0}const t=new DataView(new ArrayBuffer(kE));for(let n=0;n<4;n++)t.setUint32(n*4,this.state[n],!0);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}hashBuffer(){const{buffer:t,state:n}=this;let s=n[0],r=n[1],i=n[2],o=n[3];s=Ie(s,r,i,o,t.getUint32(0,!0),7,3614090360),o=Ie(o,s,r,i,t.getUint32(4,!0),12,3905402710),i=Ie(i,o,s,r,t.getUint32(8,!0),17,606105819),r=Ie(r,i,o,s,t.getUint32(12,!0),22,3250441966),s=Ie(s,r,i,o,t.getUint32(16,!0),7,4118548399),o=Ie(o,s,r,i,t.getUint32(20,!0),12,1200080426),i=Ie(i,o,s,r,t.getUint32(24,!0),17,2821735955),r=Ie(r,i,o,s,t.getUint32(28,!0),22,4249261313),s=Ie(s,r,i,o,t.getUint32(32,!0),7,1770035416),o=Ie(o,s,r,i,t.getUint32(36,!0),12,2336552879),i=Ie(i,o,s,r,t.getUint32(40,!0),17,4294925233),r=Ie(r,i,o,s,t.getUint32(44,!0),22,2304563134),s=Ie(s,r,i,o,t.getUint32(48,!0),7,1804603682),o=Ie(o,s,r,i,t.getUint32(52,!0),12,4254626195),i=Ie(i,o,s,r,t.getUint32(56,!0),17,2792965006),r=Ie(r,i,o,s,t.getUint32(60,!0),22,1236535329),s=ke(s,r,i,o,t.getUint32(4,!0),5,4129170786),o=ke(o,s,r,i,t.getUint32(24,!0),9,3225465664),i=ke(i,o,s,r,t.getUint32(44,!0),14,643717713),r=ke(r,i,o,s,t.getUint32(0,!0),20,3921069994),s=ke(s,r,i,o,t.getUint32(20,!0),5,3593408605),o=ke(o,s,r,i,t.getUint32(40,!0),9,38016083),i=ke(i,o,s,r,t.getUint32(60,!0),14,3634488961),r=ke(r,i,o,s,t.getUint32(16,!0),20,3889429448),s=ke(s,r,i,o,t.getUint32(36,!0),5,568446438),o=ke(o,s,r,i,t.getUint32(56,!0),9,327
365163606),i=ke(i,o,s,r,t.getUint32(12,!0),14,4107603335),r=ke(r,i,o,s,t.getUint32(32,!0),20,1163531501),s=ke(s,r,i,o,t.getUint32(52,!0),5,2850285829),o=ke(o,s,r,i,t.getUint32(8,!0),9,4243563512),i=ke(i,o,s,r,t.getUint32(28,!0),14,1735328473),r=ke(r,i,o,s,t.getUint32(48,!0),20,2368359562),s=Te(s,r,i,o,t.getUint32(20,!0),4,4294588738),o=Te(o,s,r,i,t.getUint32(32,!0),11,2272392833),i=Te(i,o,s,r,t.getUint32(44,!0),16,1839030562),r=Te(r,i,o,s,t.getUint32(56,!0),23,4259657740),s=Te(s,r,i,o,t.getUint32(4,!0),4,2763975236),o=Te(o,s,r,i,t.getUint32(16,!0),11,1272893353),i=Te(i,o,s,r,t.getUint32(28,!0),16,4139469664),r=Te(r,i,o,s,t.getUint32(40,!0),23,3200236656),s=Te(s,r,i,o,t.getUint32(52,!0),4,681279174),o=Te(o,s,r,i,t.getUint32(0,!0),11,3936430074),i=Te(i,o,s,r,t.getUint32(12,!0),16,3572445317),r=Te(r,i,o,s,t.getUint32(24,!0),23,76029189),s=Te(s,r,i,o,t.getUint32(36,!0),4,3654602809),o=Te(o,s,r,i,t.getUint32(48,!0),11,3873151461),i=Te(i,o,s,r,t.getUint32(60,!0),16,530742520),r=Te(r,i,o,s,t.getUint32(8,!0),23,3299628645),s=Pe(s,r,i,o,t.getUint32(0,!0),6,4096336452),o=Pe(o,s,r,i,t.getUint32(28,!0),10,1126891415),i=Pe(i,o,s,r,t.getUint32(56,!0),15,2878612391),r=Pe(r,i,o,s,t.getUint32(20,!0),21,4237533241),s=Pe(s,r,i,o,t.getUint32(48,!0),6,1700485571),o=Pe(o,s,r,i,t.getUint32(12,!0),10,2399980690),i=Pe(i,o,s,r,t.getUint32(40,!0),15,4293915773),r=Pe(r,i,o,s,t.getUint32(4,!0),21,2240044497),s=Pe(s,r,i,o,t.getUint32(32,!0),6,1873313359),o=Pe(o,s,r,i,t.getUint32(60,!0),10,4264355552),i=Pe(i,o,s,r,t.getUint32(24,!0),15,2734768916),r=Pe(r,i,o,s,t.getUint32(52,!0),21,1309151649),s=Pe(s,r,i,o,t.getUint32(16,!0),6,4149444226),o=Pe(o,s,r,i,t.getUint32(44,!0),10,3174756917),i=Pe(i,o,s,r,t.getUint32(8,!0),15,718787259),r=Pe(r,i,o,s,t.getUint32(36,!0),21,3951481745),n[0]=s+n[0]&4294967295,n[1]=r+n[1]&4294967295,n[2]=i+n[2]&4294967295,n[3]=o+n[3]&4294967295}reset(){this.state=Uint32Array.from(TE),this.buffer=new DataView(new ArrayBuffer(wt)),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}}function Zs(e,t,n,s,r,i){return t=(t+e&4294967295)+(s+i&4294967295)&4294967295,(t<<r|t>>>32-r)+n&4294967295}function Ie(e,t,n,s,r,i,o){return Zs(t&n|~t&s,e,t,r,i,o)}function ke(e,t,n,s,r,i,o){return Zs(t&s|n&~s,e,t,r,i,o)}function Te(e,t,n,s,r,i,o){return Zs(t^n^s,e,t,r,i,o)}function Pe(e,t,n,s,r,i,o){return Zs(n^(t|~s),e,t,r,i,o)}function NE(e){return typeof e=="string"?e.length===0:e.byteLength===0}function OE(e){return typeof e=="string"?pt(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}const BE=e=>({apiVersion:"2006-03-01",base64Decoder:e?.base64Decoder??Un,base64Encoder:e?.base64Encoder??Ln,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??dh,extensions:e?.extensions??[],getAwsChunkedEncodingStream:e?.getAwsChunkedEncodingStream??mf,httpAuthSchemeProvider:e?.httpAuthSchemeProvider??YS,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4"),signer:new Hs},{schemeId:"aws.auth#sigv4a",identityProvider:t=>t.getIdentityProvider("aws.auth#sigv4a"),signer:new kp}],logger:e?.logger??new qs,sdkStreamMixin:e?.sdkStreamMixin??vf,serviceId:e?.serviceId??"S3",signerConstructor:e?.signerConstructor??Wl,signingEscapePath:e?.signingEscapePath??!1,urlParser:e?.urlParser??dn,useArnRegion:e?.useArnRegion??void 0,utf8Decoder:e?.utf8Decoder??pt,utf8Encoder:e?.utf8Encoder??wn}),ME=e=>{const t=Ao(e),n=()=>t().then(no),s=BE(e);return{...s,...e,runtime:"browser",defaultsMode:t,bodyLengthChecker:e?.bodyLengthChecker??eo,credentialDefaultProvider:e?.credentialDefaultProvider??(r=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??Eo({serviceId:s.serviceId,clientVersion:X0.version}),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??CE,maxAttempts:e?.maxAttempts??hn,md5:e?.md5??PE,region:e?.region??xo("Region is missing"),requestHandler:jn.create(e?.requestHandler??n),retryMode:e?.retryMode??(async()=>(await n()).retryMode||mo),sha1:e?.sha1??tE,sha256:e?.sha256??So,streamCollector:e?.streamCollector??$s,streamHasher:e?.streamHasher??IE,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(uo)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(lo))}},DE=e=>{const t=e.httpAuthSchemes;let n=e.httpAuthSchemeProvider,s=e.credentials;return{setHttpAuthScheme(r){const i=t.findIndex(o=>o.schemeId===r.schemeId);i===-1?t.push(r):t.splice(i,1,r)},httpAuthSchemes(){return t},setHttpAuthSchemeProvider(r){n=r},httpAuthSchemeProvider(){return n},setCredentials(r){s=r},credentials(){return s}}},FE=e=>({httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}),$E=(e,t)=>{const n=Object.assign(Co(e),so(e),Oi(e),DE(e));return t.forEach(s=>s.configure(n)),Object.assign(e,Ro(n),ro(n),Bi(n),FE(n))};class UE extends to{config;constructor(...[t]){const n=ME(t||{});super(n),this.initConfig=n;const s=e0(n),r=Wi(s),i=nS(r),o=wo(i),a=ho(o),c=a,d=go(c),u=OS(d),h=QS(u),p=SS(h,{session:[()=>this,J0]}),y=$E(p,t?.extensions||[]);this.config=y,this.middlewareStack.use(co(this.config)),this.middlewareStack.use(bo(this.config)),this.middlewareStack.use(fo(this.config)),this.middlewareStack.use(Mi(this.config)),this.middlewareStack.use(Di(this.config)),this.middlewareStack.use(Fi(this.config)),this.middlewareStack.use($i(this.config,{httpAuthSchemeParametersProvider:JS,identityProvi
36derConfigProvider:async x=>new Vi({"aws.auth#sigv4":x.credentials,"aws.auth#sigv4a":x.credentials})})),this.middlewareStack.use(Li(this.config)),this.middlewareStack.use(NS(this.config)),this.middlewareStack.use(Zb(this.config)),this.middlewareStack.use(aS(this.config)),this.middlewareStack.use(pS(this.config)),this.middlewareStack.use(bS(this.config))}destroy(){super.destroy()}}function LE(){var e=document.createElement("div");return e.setAttribute("class","pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links ad-text adSense adBlock adContent adBanner"),e.setAttribute("style","width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;"),e}function jE(e){if(e.offsetParent===null||e.offsetHeight==0||e.offsetLeft==0||e.offsetTop==0||e.offsetWidth==0||e.clientHeight==0||e.clientWidth==0)return!0;if(window.getComputedStyle!==void 0){var t=window.getComputedStyle(e,null);if(t&&(t.getPropertyValue("display")=="none"||t.getPropertyValue("visibility")=="hidden"))return!0}return!1}async function HE(){try{return(await fetch("https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js",{method:"GET"})).ok}catch{return!1}}function zE(){if(window.document.body.getAttribute("abp")!==null)return!0;var e=LE();window.document.body.appendChild(e);var t=jE(e);return window.document.body.removeChild(e),t}async function qE(){if(zE())return!0;try{if(!await HE())return!0}catch{return!0}return!1}function i_(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2")}function o_(e){return e=Math.floor(e),e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":e>=1e4?(e/1e3).toFixed(1)+"K":e.toLocaleString()}async function a_(e){window.location.origin.includes("amazonaws")?window.open(`/play.html?gameID=${e.gameID}&r=t`,"_blank"):window.open(`/play?gameID=${e.gameID}&r=t`,"_blank"),VE(e.gameID).catch(t=>{console.error("Failed to track click:",t)})}async function VE(e){try{He.localPlays+=1;const t={TableName:"games_list",Key:{gameID:{S:e}},UpdateExpression:"SET clicks = if_not_exists(clicks, :start) + :inc",ExpressionAttributeValues:{":inc":{N:"1"},":start":{N:"0"}},ReturnValues:"UPDATED_NEW"},n=new Kb(t),s=se.dynamoDBClient;if(!s)throw new Error("DynamoDB client not initialized");await s.send(n)}catch(t){console.error("Failed to update click count:",t)}}function c_(e){return e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}async function WE(){try{const e=await qE();return se.adBlockEnabled=e,se.adsEnabled=!e&&He.isAHost(),e}catch(e){return console.error("Adblock detection failed",e),!0}}async function d_(){return(await(await fetch("https://api.github.com/repos/ccported/games/commits/main")).json()).sha||""}function KE(e){const t=document.createElement("div");t.classList.add("modal-overlay");const n=document.createElement("div");n.classList.add("modal");const s=document.createElement("h2");s.textContent=e.title,n.appendChild(s);const r=document.createElement("p");r.innerHTML=e.content,n.appendChild(r);const i=document.createElement("div");i.classList.add("modal-actions"),e.actions.forEach((c,d)=>{const u=document.createElement("button");u.textContent=c.label,u.classList.add(d===0?"primary":"secondary"),u.onclick=()=>c.onClick(a),i.appendChild(u)}),n.appendChild(i),t.appendChild(n),document.body.appendChild(t),t.addEventListener("click",c=>{c.target===t&&a.close()});const o=c=>{c.key==="Escape"&&a.close()};document.addEventListener("keydown",o);const a={close:()=>{document.removeEventListener("keydown",o),t.remove()}};return a}class In extends Error{}In.prototype.name="InvalidTokenError";function GE(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let s=n.charCodeAt(0).toString(16).toUpperCase();return s.length<2&&(s="0"+s),"%"+s}))}function JE(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return GE(t)}catch{return atob(t)}}function ZE(e,t){if(typeof e!="string")throw new In("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,s=e.split(".")[n];
36if(typeof s!="string")throw new In(`Invalid token specified: missing part #${n+1}`);let r;try{r=JE(s)}catch(i){throw new In(`Invalid token specified: invalid base64 for part #${n+1} (${i.message})`)}try{return JSON.parse(r)}catch(i){throw new In(`Invalid token specified: invalid json for part #${n+1} (${i.message})`)}}var XE={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},dt,ut,Ms=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(Ms||{});(e=>{function t(){dt=3,ut=XE}e.reset=t;function n(r){if(!(0<=r&&r<=4))throw new Error("Invalid log level");dt=r}e.setLevel=n;function s(r){ut=r}e.setLogger=s})(Ms||(Ms={}));var W=class ot{constructor(t){this._name=t}debug(...t){dt>=4&&ut.debug(ot._format(this._name,this._method),...t)}info(...t){dt>=3&&ut.info(ot._format(this._name,this._method),...t)}warn(...t){dt>=2&&ut.warn(ot._format(this._name,this._method),...t)}error(...t){dt>=1&&ut.error(ot._format(this._name,this._method),...t)}throw(t){throw this.error(t),t}create(t){const n=Object.create(this);return n._method=t,n.debug("begin"),n}static createStatic(t,n){const s=new ot(`${t}.${n}`);return s.debug("begin"),s}static _format(t,n){const s=`[${t}]`;return n?`${s} ${n}:`:s}static debug(t,...n){dt>=4&&ut.debug(ot._format(t),...n)}static info(t,...n){dt>=3&&ut.info(ot._format(t),...n)}static warn(t,...n){dt>=2&&ut.warn(ot._format(t),...n)}static error(t,...n){dt>=1&&ut.error(ot._format(t),...n)}};Ms.reset();var Ds=class{static decode(e){try{return ZE(e)}catch(t){throw W.error("JwtUtils.decode",t),t}}static async generateSignedJwt(e,t,n){const s=Ve.encodeBase64Url(new TextEncoder().encode(JSON.stringify(e))),r=Ve.encodeBase64Url(new TextEncoder().encode(JSON.stringify(t))),i=`${s}.${r}`,o=await window.crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},n,new TextEncoder().encode(i)),a=Ve.encodeBase64Url(new Uint8Array(o));return`${i}.${a}`}},YE="10000000-1000-4000-8000-100000000000",Ri=e=>btoa([...new Uint8Array(e)].map(t=>String.fromCharCode(t)).join("")),Eh=class at{static _randomWord(){const t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}static generateUUIDv4(){return YE.replace(/[018]/g,n=>(+n^at._randomWord()&15>>+n/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return at.generateUUIDv4()+at.generateUUIDv4()+at.generateUUIDv4()}static async generateCodeChallenge(t){if(!crypto.subtle)throw new Error("Crypto.subtle is available only in secure contexts (HTTPS).");try{const s=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",s);return Ri(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(n){throw W.error("CryptoUtils.generateCodeChallenge",n),n}}static generateBasicAuth(t,n){const r=new TextEncoder().encode([t,n].join(":"));return Ri(r)}static async hash(t,n){const s=new TextEncoder().encode(n),r=await crypto.subtle.digest(t,s);return new Uint8Array(r)}static async customCalculateJwkThumbprint(t){let n;switch(t.kty){case"RSA":n={e:t.e,kty:t.kty,n:t.n};break;case"EC":n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":n={crv:t.crv,kty:t.kty,x:t.x};break;case"oct":n={crv:t.k,kty:t.kty};break;default:throw new Error("Unknown jwk type")}const s=await at.hash("SHA-256",JSON.stringify(n));return at.encodeBase64Url(s)}static async generateDPoPProof({url:t,accessToken:n,httpMethod:s,keyPair:r,nonce:i}){let o,a;const c={jti:window.crypto.randomUUID(),htm:s??"GET",htu:t,iat:Math.floor(Date.now()/1e3)};n&&(o=await at.hash("SHA-256",n),a=at.encodeBase64Url(o),c.ath=a),i&&(c.nonce=i);try{const d=await crypto.subtle.exportKey("jwk",r.publicKey),u={alg:"ES256",typ:"dpop+jwt",jwk:{crv:d.crv,kty:d.kty,x:d.x,y:d.y}};return await Ds.generateSignedJwt(u,c,r.privateKey)}catch(d){throw d instanceof TypeError?new Error(`Error exporting dpop public key: ${d.message}`):d}}static async generateDPoPJkt(t){try{const n=await crypto.subtle.exportKey("jwk",t.publicKey);return await at.customCalculateJwkThumbprint(n)}catch(n){throw n instanceof TypeError?new Error(`Could not retrieve dpop keys from storage: ${n.message}`):n}}static async generateDPoPKeys(){return await window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign","verify"])}};Eh.encodeBase64Url=e=>Ri(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");var Ve=Eh,_t=class{constructor(e){this._name=e,this._callbacks=[],this._logger=new W(`Event('${this._name}')`)}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){const t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}
36async raise(...e){this._logger.debug("raise:",...e);for(const t of this._callbacks)await t(...e)}},Nu=class{static center({...e}){var t,n,s;return e.width==null&&(e.width=(t=[800,720,600,480].find(r=>r<=window.outerWidth/1.618))!=null?t:360),(n=e.left)!=null||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),e.height!=null&&((s=e.top)!=null||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}=${typeof n!="boolean"?n:n?"yes":"no"}`).join(",")}},gt=class Ss extends _t{constructor(){super(...arguments),this._logger=new W(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{const t=this._expiration-Ss.getEpochTime();this._logger.debug("timer completes in",t),this._expiration<=Ss.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(t){const n=this._logger.create("init");t=Math.max(Math.floor(t),1);const s=Ss.getEpochTime()+t;if(this.expiration===s&&this._timerHandle){n.debug("skipping since already initialized for expiration at",this.expiration);return}this.cancel(),n.debug("using duration",t),this._expiration=s;const r=Math.min(t,5);this._timerHandle=setInterval(this._callback,r*1e3)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},Ii=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");const s=new URL(e,"http://127.0.0.1")[t==="fragment"?"hash":"search"];return new URLSearchParams(s.slice(1))}},mn=";",qt=class extends Error{constructor(e,t){var n,s,r;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw W.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=(n=e.error_description)!=null?n:null,this.error_uri=(s=e.error_uri)!=null?s:null,this.state=e.userState,this.session_state=(r=e.session_state)!=null?r:null,this.url_state=e.url_state}},$a=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},QE=class{constructor(e){this._logger=new W("AccessTokenEvents"),this._expiringTimer=new gt("Access token expiring"),this._expiredTimer=new gt("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}async load(e){const t=this._logger.create("load");if(e.access_token&&e.expires_in!==void 0){const n=e.expires_in;if(t.debug("access token present, remaining duration:",n),n>0){let r=n-this._expiringNotificationTimeInSeconds;r<=0&&(r=1),t.debug("registering expiring timer, raising in",r,"seconds"),this._expiringTimer.init(r)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();const s=n+1;t.debug("registering expired timer, raising in",s,"seconds"),this._expiredTimer.init(s)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}async unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},ex=class{constructor(e,t,n,s,r){this._callback=e,this._client_id=t,this._intervalInSeconds=s,this._stopOnError=r,this._logger=new W("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=o=>{o.origin===this._frame_origin&&o.source===this._frame.contentWindow&&(o.data==="error"?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):o.data==="changed"?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(o.data+" message from check session op iframe"))};const i=new URL(n);this._frame_origin=i.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=i.href}load(){return new Promise(e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;const t=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,this._intervalInSeconds*1e3)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},xh=class{constructor(){this._logger=new W("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}}
36,ki=class extends Error{constructor(e,t){super(t),this.name="ErrorDPoPNonce",this.nonce=e}},Ua=class{constructor(e=[],t=null,n={}){this._jwtHandler=t,this._extraHeaders=n,this._logger=new W("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){const{timeoutInSeconds:n,...s}=t;if(!n)return await fetch(e,s);const r=new AbortController,i=setTimeout(()=>r.abort(),n*1e3);try{return await fetch(e,{...t,signal:r.signal})}catch(o){throw o instanceof DOMException&&o.name==="AbortError"?new $a("Network timed out"):o}finally{clearTimeout(i)}}async getJson(e,{token:t,credentials:n,timeoutInSeconds:s}={}){const r=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};t&&(r.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this._appendExtraHeaders(i);let o;try{r.debug("url:",e),o=await this.fetchWithTimeout(e,{method:"GET",headers:i,timeoutInSeconds:s,credentials:n})}catch(d){throw r.error("Network Error"),d}r.debug("HTTP response received, status",o.status);const a=o.headers.get("Content-Type");if(a&&!this._contentTypes.find(d=>a.startsWith(d))&&r.throw(new Error(`Invalid response Content-Type: ${a??"undefined"}, from URL: ${e}`)),o.ok&&this._jwtHandler&&a?.startsWith("application/jwt"))return await this._jwtHandler(await o.text());let c;try{c=await o.json()}catch(d){throw r.error("Error parsing JSON response",d),o.ok?d:new Error(`${o.statusText} (${o.status})`)}if(!o.ok)throw r.error("Error from server:",c),c.error?new qt(c):new Error(`${o.statusText} (${o.status}): ${JSON.stringify(c)}`);return c}async postForm(e,{body:t,basicAuth:n,timeoutInSeconds:s,initCredentials:r,extraHeaders:i}){const o=this._logger.create("postForm"),a={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded",...i};n!==void 0&&(a.Authorization="Basic "+n),this._appendExtraHeaders(a);let c;try{o.debug("url:",e),c=await this.fetchWithTimeout(e,{method:"POST",headers:a,body:t,timeoutInSeconds:s,credentials:r})}catch(p){throw o.error("Network error"),p}o.debug("HTTP response received, status",c.status);const d=c.headers.get("Content-Type");if(d&&!this._contentTypes.find(p=>d.startsWith(p)))throw new Error(`Invalid response Content-Type: ${d??"undefined"}, from URL: ${e}`);const u=await c.text();let h={};if(u)try{h=JSON.parse(u)}catch(p){throw o.error("Error parsing JSON response",p),c.ok?p:new Error(`${c.statusText} (${c.status})`)}if(!c.ok){if(o.error("Error from server:",h),c.headers.has("dpop-nonce")){const p=c.headers.get("dpop-nonce");throw new ki(p,`${JSON.stringify(h)}`)}throw h.error?new qt(h,t):new Error(`${c.statusText} (${c.status}): ${JSON.stringify(h)}`)}return h}_appendExtraHeaders(e){const t=this._logger.create("appendExtraHeaders"),n=Object.keys(this._extraHeaders),s=["accept","content-type"],r=["authorization"];n.length!==0&&n.forEach(i=>{if(s.includes(i.toLocaleLowerCase())){t.warn("Protected header could not be set",i,s);return}if(r.includes(i.toLocaleLowerCase())&&Object.keys(e).includes(i)){t.warn("Header could not be overridden",i,r);return}const o=typeof this._extraHeaders[i]=="function"?this._extraHeaders[i]():this._extraHeaders[i];o&&o!==""&&(e[i]=o)})}},tx=class{constructor(e){this._settings=e,this._logger=new W("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new Ua(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){const e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);const t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},t,this._settings.metadataSeed),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){const n=this._logger.create(`_getMetadataProperty('${e}')`),s=await this.getMetadata();if(n.debug("resolved"),s[e]===void 0){if(t===!0){n.warn("Metadata does not contain optional property");return}n.throw(new Error("Metadata does not contain property "+e))}return s[e]}async getSigningKeys(){const e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;const t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);const n=await this._jsonService.getJson(t,{timeoutInSeconds:this._settings.requestTimeoutInSeconds});if(e.debug("got key set",n),!Array.isArray(n.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=n.keys,this._signingKeys}},_h=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new W("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){return this._logger.create(`get('${e}')`),e=this._prefix+e,await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;const t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");const e=await this._store.length,t=[];for(let n=0;n<e;n++){const s=await this._store.key(n);s&&s.indexOf(this._prefix)===0&&t.push(s.substr(this._prefix.length))}return t}},nx="code",sx="openid",rx="client_secret_post",ix=900,Ti=class{constructor({authority:e,metadataUrl:t,metadata:n,signingKeys:s,metadataSeed:r,client_id:i,client_secret:o,response_type:a=nx,scope:c=sx,redirect_uri:d,post_logout_redirect_uri:u,client_authentication:h=rx,prompt:p,display:y,max_age:x,ui_locales:A,acr_values:_,resource:T,response_mode:P,filterProtocolClaims:Z=!0,loadUserInfo:G=!1,requestTimeoutInSeconds:re,staleStateAgeInSeconds:Y=ix,mergeClaimsStrategy:ht={array:"replace"},disablePKCE:tt=!1,stateStore:Je,revokeTokenAdditionalContentTypes:Kn,fetchRequestCredentials:ja,refreshTokenAllowedScope:Dh,extraQueryParams:Fh={},extraTokenParams:$h={},extraHeaders:Uh={},dpop:Lh,omitScopeWhenRequesting:jh=!1}){var Ha;if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=n,this.metadataSeed=r,this.signingKeys=s,this.client_id=i,this.client_secret=o,this.response_type=a,this.scope=c,this.redirect_uri=d,this.post_logout_redirect_uri=u,this.client_authentication=h,this.prompt=p,this.display=y,this.max_age=x,this.ui_locales=A,this.acr_values=_,this.resource=T,this.response_mode=P,this.filterProtocolClaims=Z??!0,this.loadUserInfo=!!G,this.staleStateAgeInSeconds=Y,this.mergeClaimsStrategy=ht,this.omitScopeWhenRequesting=jh,this.disablePKCE=!!tt,this.revokeTokenAdditionalContentTypes=Kn,this.fetchRequestCredentials=ja||"same-origin",this.requestTimeoutInSeconds=re,Je)this.stateStore=Je;else{const Hh=typeof window<"u"?window.localStorage:new xh;this.stateStore=new _h({store:Hh})}if(this.refreshTokenAllowedScope=Dh,this.extraQueryParams=Fh,this.extraTokenParams=$h,this.extraHeaders=Uh,this.dpop=Lh,this.dpop&&!((H
36a=this.dpop)!=null&&Ha.store))throw new Error("A DPoPStore is required when dpop is enabled")}},ox=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new W("UserInfoService"),this._getClaimsFromJwt=async n=>{const s=this._logger.create("_getClaimsFromJwt");try{const r=Ds.decode(n);return s.debug("JWT decoding successful"),r}catch(r){throw s.error("Error parsing JWT response"),r}},this._jsonService=new Ua(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){const t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));const n=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",n);const s=await this._jsonService.getJson(n,{token:e,credentials:this._settings.fetchRequestCredentials,timeoutInSeconds:this._settings.requestTimeoutInSeconds});return t.debug("got claims",s),s}},vh=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new W("TokenClient"),this._jsonService=new Ua(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:n=this._settings.client_id,client_secret:s=this._settings.client_secret,extraHeaders:r,...i}){const o=this._logger.create("exchangeCode");n||o.throw(new Error("A client_id is required")),t||o.throw(new Error("A redirect_uri is required")),i.code||o.throw(new Error("A code is required"));const a=new URLSearchParams({grant_type:e,redirect_uri:t});for(const[h,p]of Object.entries(i))p!=null&&a.set(h,p);let c;switch(this._settings.client_authentication){case"client_secret_basic":if(s==null)throw o.throw(new Error("A client_secret is required")),null;c=Ve.generateBasicAuth(n,s);break;case"client_secret_post":a.append("client_id",n),s&&a.append("client_secret",s);break}const d=await this._metadataService.getTokenEndpoint(!1);o.debug("got token endpoint");const u=await this._jsonService.postForm(d,{body:a,basicAuth:c,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return o.debug("got response"),u}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,scope:s=this._settings.scope,...r}){const i=this._logger.create("exchangeCredentials");t||i.throw(new Error("A client_id is required"));const o=new URLSearchParams({grant_type:e});this._settings.omitScopeWhenRequesting||o.set("scope",s);for(const[u,h]of Object.entries(r))h!=null&&o.set(u,h);let a;switch(this._settings.client_authentication){case"client_secret_basic":if(n==null)throw i.throw(new Error("A client_secret is required")),null;a=Ve.generateBasicAuth(t,n);break;case"client_secret_post":o.append("client_id",t),n&&o.append("client_secret",n);break}const c=await this._metadataService.getTokenEndpoint(!1);i.debug("got token endpoint");const d=await this._jsonService.postForm(c,{body:o,basicAuth:a,timeoutInSeconds:this._settings.requestTimeoutInSeconds,initCredentials:this._settings.fetchRequestCredentials});return i.debug("got response"),d}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:n=this._settings.client_secret,timeoutInSeconds:s,extraHeaders:r,...i}){const o=this._logger.create("exchangeRefreshToken");t||o.throw(new Error("A client_id is required")),i.refresh_token||o.throw(new Error("A refresh_token is required"));const a=new URLSearchParams({grant_type:e});for(const[h,p]of Object.entries(i))Array.isArray(p)?p.forEach(y=>a.append(h,y)):p!=null&&a.set(h,p);let c;switch(this._settings.client_authentication){case"client_secret_basic":if(n==null)throw o.throw(new Error("A client_secret is required")),null;c=Ve.generateBasicAuth(t,n);break;case"client_secret_post":a.append("client_id",t),n&&a.append("client_secret",n);break}const d=await this._metadataService.getTokenEndpoint(!1);o.debug("got token endpoint");const u=await this._jsonService.postForm(d,{body:a,basicAuth:c,timeoutInSeconds:s,initCredentials:this._settings.fetchRequestCredentials,extraHeaders:r});return o.debug("got response"),u}async revoke(e){var t;const n=this._logger.create("revoke");e.token||n.throw(new Error("A token is required"));const s=await this._metadataService.getRevocationEndpoint(!1);n.debug(`got revocation endpoint, revoking ${(t=e.token_type_hint)!=null?t:"default token type"}`);
36const r=new URLSearchParams;for(const[i,o]of Object.entries(e))o!=null&&r.set(i,o);r.set("client_id",this._settings.client_id),this._settings.client_secret&&r.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(s,{body:r,timeoutInSeconds:this._settings.requestTimeoutInSeconds}),n.debug("got response")}},ax=class{constructor(e,t,n){this._settings=e,this._metadataService=t,this._claimsService=n,this._logger=new W("ResponseValidator"),this._userInfoService=new ox(this._settings,this._metadataService),this._tokenClient=new vh(this._settings,this._metadataService)}async validateSigninResponse(e,t,n){const s=this._logger.create("validateSigninResponse");this._processSigninState(e,t),s.debug("state processed"),await this._processCode(e,t,n),s.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),s.debug("tokens validated"),await this._processClaims(e,t?.skipUserInfo,e.isOpenId),s.debug("claims processed")}async validateCredentialsResponse(e,t){const n=this._logger.create("validateCredentialsResponse"),s=e.isOpenId&&!!e.id_token;s&&this._validateIdTokenAttributes(e),n.debug("tokens validated"),await this._processClaims(e,t,s),n.debug("claims processed")}async validateRefreshResponse(e,t){var n,s;const r=this._logger.create("validateRefreshResponse");e.userState=t.data,(n=e.session_state)!=null||(e.session_state=t.session_state),(s=e.scope)!=null||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),r.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);const i=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,i),r.debug("claims processed")}validateSignoutResponse(e,t){const n=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&n.throw(new Error("State does not match")),n.debug("state validated"),e.userState=t.data,e.error)throw n.warn("Response was error",e.error),new qt(e)}_processSigninState(e,t){var n;const s=this._logger.create("_processSigninState");if(t.id!==e.state&&s.throw(new Error("State does not match")),t.client_id||s.throw(new Error("No client_id on state")),t.authority||s.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&s.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&s.throw(new Error("client_id mismatch on settings vs. signin state")),s.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,(n=e.scope)!=null||(e.scope=t.scope),e.error)throw s.warn("Response was error",e.error),new qt(e);t.code_verifier&&!e.code&&s.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,n=!0){const s=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token){s.debug("not loading user info");return}s.debug("loading user info");const r=await this._userInfoService.getClaims(e.access_token);s.debug("user info claims received from user info endpoint"),n&&r.sub!==e.profile.sub&&s.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(r)),s.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t,n){const s=this._logger.create("_processCode");if(e.code){s.debug("Validating code");const r=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,extraHeaders:n,...t.extraTokenParams});Object.assign(e,r)}else s.debug("No code to process")}_validateIdTokenAttributes(e,t){var n;const s=this._logger.create("_validateIdTokenAttributes");s.debug("decoding ID Token JWT");const r=Ds.decode((n=e.id_token)!=null?n:"");if(r.sub||s.throw(new Error("ID Token is missing a subject claim")),t){const i=Ds.decode(t);r.sub!==i.sub&&s.throw(new Error("sub in id_token does not match current sub")),r.auth_time&&r.auth_time!==i.auth_time&&s.throw(new Error("auth_time in id_token does not match original auth_time")),r.azp&&r.azp!==i.azp&&s.throw(new Error("azp in id_token does not match original azp")),!r.azp&&i.azp&&s.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=r}},Fs=class Pi{constructor(t){this.id=t.id||Ve.generateUUIDv4(),this.data=t.data,t.created&&t.created>0?this.created=t.created:this.created=gt.getEpochTime(),this.request_type=t.request_type,this.url_state=t.url_state}toStorageString(){return new W("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(t){return W.createStatic("State","fromStorageString"),Promise.resolve(new Pi(JSON.parse(t)))}static async clearStaleState(t,n){const s=W.createStatic("State","clearStaleState"),r=gt.getEpochTime()-n,i=await t.getAllKeys();s.debug("got keys",i);for(let o=0;o<i.length;o++){const a=i[o],c=await t.get(a);let d=!1;if(c)try{const u=await Pi.fromStorageString(c);s.debug("got item from key:",a,u.created),u.created<=r&&(d=!0)}catch(u){s.error("Error parsing state for key:",a,u),d=!0}
36else s.debug("no item in storage for key:",a),d=!0;d&&(s.debug("removed item for key:",a),t.remove(a))}}},Ah=class Ni extends Fs{constructor(t){super(t),this.code_verifier=t.code_verifier,this.code_challenge=t.code_challenge,this.authority=t.authority,this.client_id=t.client_id,this.redirect_uri=t.redirect_uri,this.scope=t.scope,this.client_secret=t.client_secret,this.extraTokenParams=t.extraTokenParams,this.response_mode=t.response_mode,this.skipUserInfo=t.skipUserInfo}static async create(t){const n=t.code_verifier===!0?Ve.generateCodeVerifier():t.code_verifier||void 0,s=n?await Ve.generateCodeChallenge(n):void 0;return new Ni({...t,code_verifier:n,code_challenge:s})}toStorageString(){return new W("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(t){W.createStatic("SigninState","fromStorageString");const n=JSON.parse(t);return Ni.create(n)}},Ch=class Rh{constructor(t){this.url=t.url,this.state=t.state}static async create({url:t,authority:n,client_id:s,redirect_uri:r,response_type:i,scope:o,state_data:a,response_mode:c,request_type:d,client_secret:u,nonce:h,url_state:p,resource:y,skipUserInfo:x,extraQueryParams:A,extraTokenParams:_,disablePKCE:T,dpopJkt:P,omitScopeWhenRequesting:Z,...G}){if(!t)throw this._logger.error("create: No url passed"),new Error("url");if(!s)throw this._logger.error("create: No client_id passed"),new Error("client_id");if(!r)throw this._logger.error("create: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("create: No response_type passed"),new Error("response_type");if(!o)throw this._logger.error("create: No scope passed"),new Error("scope");if(!n)throw this._logger.error("create: No authority passed"),new Error("authority");const re=await Ah.create({data:a,request_type:d,url_state:p,code_verifier:!T,client_id:s,authority:n,redirect_uri:r,response_mode:c,client_secret:u,scope:o,extraTokenParams:_,skipUserInfo:x}),Y=new URL(t);Y.searchParams.append("client_id",s),Y.searchParams.append("redirect_uri",r),Y.searchParams.append("response_type",i),Z||Y.searchParams.append("scope",o),h&&Y.searchParams.append("nonce",h),P&&Y.searchParams.append("dpop_jkt",P);let ht=re.id;p&&(ht=`${ht}${mn}${p}`),Y.searchParams.append("state",ht),re.code_challenge&&(Y.searchParams.append("code_challenge",re.code_challenge),Y.searchParams.append("code_challenge_method","S256")),y&&(Array.isArray(y)?y:[y]).forEach(Je=>Y.searchParams.append("resource",Je));for(const[tt,Je]of Object.entries({response_mode:c,...G,...A}))Je!=null&&Y.searchParams.append(tt,Je.toString());return new Rh({url:Y.href,state:re})}};Ch._logger=new W("SigninRequest");var cx=Ch,dx="openid",ai=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){const t=decodeURIComponent(this.state).split(mn);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(mn))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-gt.getEpochTime()}set expires_in(e){typeof e=="string"&&(e=Number(e)),e!==void 0&&e>=0&&(this.expires_at=Math.floor(e)+gt.getEpochTime())}get isOpenId(){var e;return((e=this.scope)==null?void 0:e.split(" ").includes(dx))||!!this.id_token}},ux=class{constructor({url:e,state_data:t,id_token_hint:n,post_logout_redirect_uri:s,extraQueryParams:r,request_type:i,client_id:o,url_state:a}){if(this._logger=new W("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");const c=new URL(e);if(n&&c.searchParams.append("id_token_hint",n),o&&c.searchParams.append("client_id",o),s&&(c.searchParams.append("post_logout_redirect_uri",s),t||a)){this.state=new Fs({data:t,request_type:i,url_state:a});let d=this.state.id;a&&(d=`${d}${mn}${a}`),c.searchParams.append("state",d)}for(const[d,u]of Object.entries({...r}))u!=null&&c.searchParams.append(d,u.toString());this.url=c.href}},lx=class{constructor(e){if(this.state=e.get("state"),this.state){const t=decodeURIComponent(this.state).split(mn);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(mn))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},hx=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],fx=["sub","iss","aud","exp","iat"],px=class{constructor(e){this._settings=e,this._logger=new W("ClaimsService")}filterProtocolClaims(e){const t={...e};if(this._settings.filterProtocolClaims){let n;Array.isArray(this._settings.filterProtocolClaims)?n=this._settings.filterProtocolClaims:n=hx;for(const s of n)fx.includes(s)||delete t[s]}return t}mergeClaims(e,t){const n={...e};for(const[s,r]of Object.entries(t))if(n[s]!==r)if(Array.isArray(n[s])||Array.isArray(r))if(this._settings.mergeClaimsStrategy.array=="replace")n[s]=r;else{const i=Array.isArray(n[s])?n[s]:[n[s]];for(const o of Array.isArray(r)?r:[r])i.includes(o)||i.push(o);n[s]=i}else typeof n[s]=="object"&&typeof r=="object"?n[s]=this.mergeClaims(n[s],r):n[s]=r;return n}},Ih=class{constructor(e,t){this.keys=e,this.nonce=t}},gx=class{constructor(e,t){this._logger=new W("OidcClient"),this.settings=e instanceof Ti?e:new Ti(e),this.metadataService=t??new tx(this.settings),this._claimsService=new px(this.settings),this._val
36idator=new ax(this.settings,this.metadataService,this._claimsService),this._tokenClient=new vh(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:n,request_type:s,id_token_hint:r,login_hint:i,skipUserInfo:o,nonce:a,url_state:c,response_type:d=this.settings.response_type,scope:u=this.settings.scope,redirect_uri:h=this.settings.redirect_uri,prompt:p=this.settings.prompt,display:y=this.settings.display,max_age:x=this.settings.max_age,ui_locales:A=this.settings.ui_locales,acr_values:_=this.settings.acr_values,resource:T=this.settings.resource,response_mode:P=this.settings.response_mode,extraQueryParams:Z=this.settings.extraQueryParams,extraTokenParams:G=this.settings.extraTokenParams,dpopJkt:re,omitScopeWhenRequesting:Y=this.settings.omitScopeWhenRequesting}){const ht=this._logger.create("createSigninRequest");if(d!=="code")throw new Error("Only the Authorization Code flow (with PKCE) is supported");const tt=await this.metadataService.getAuthorizationEndpoint();ht.debug("Received authorization endpoint",tt);const Je=await cx.create({url:tt,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:h,response_type:d,scope:u,state_data:e,url_state:c,prompt:p,display:y,max_age:x,ui_locales:A,id_token_hint:r,login_hint:i,acr_values:_,dpopJkt:re,resource:T,request:t,request_uri:n,extraQueryParams:Z,extraTokenParams:G,request_type:s,response_mode:P,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:a,disablePKCE:this.settings.disablePKCE,omitScopeWhenRequesting:Y});await this.clearStaleState();const Kn=Je.state;return await this.settings.stateStore.set(Kn.id,Kn.toStorageString()),Je}async readSigninResponseState(e,t=!1){const n=this._logger.create("readSigninResponseState"),s=new ai(Ii.readParams(e,this.settings.response_mode));if(!s.state)throw n.throw(new Error("No state in response")),null;const r=await this.settings.stateStore[t?"remove":"get"](s.state);if(!r)throw n.throw(new Error("No matching state found in storage")),null;return{state:await Ah.fromStorageString(r),response:s}}async processSigninResponse(e,t,n=!0){const s=this._logger.create("processSigninResponse"),{state:r,response:i}=await this.readSigninResponseState(e,n);if(s.debug("received state from storage; validating response"),this.settings.dpop&&this.settings.dpop.store){const o=await this.getDpopProof(this.settings.dpop.store);t={...t,DPoP:o}}try{await this._validator.validateSigninResponse(i,r,t)}catch(o){if(o instanceof ki&&this.settings.dpop){const a=await this.getDpopProof(this.settings.dpop.store,o.nonce);t.DPoP=a,await this._validator.validateSigninResponse(i,r,t)}else throw o}return i}async getDpopProof(e,t){let n,s;return(await e.getAllKeys()).includes(this.settings.client_id)?(s=await e.get(this.settings.client_id),s.nonce!==t&&t&&(s.nonce=t,await e.set(this.settings.client_id,s))):(n=await Ve.generateDPoPKeys(),s=new Ih(n,t),await e.set(this.settings.client_id,s)),await Ve.generateDPoPProof({url:await this.metadataService.getTokenEndpoint(!1),httpMethod:"POST",keyPair:s.keys,nonce:s.nonce})}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n=!1,extraTokenParams:s={}}){const r=await this._tokenClient.exchangeCredentials({username:e,password:t,...s}),i=new ai(new URLSearchParams);return Object.assign(i,r),await this._validator.validateCredentialsResponse(i,n),i}async useRefreshToken({state:e,redirect_uri:t,resource:n,timeoutInSeconds:s,extraHeaders:r,extraTokenParams:i}){var o;const a=this._logger.create("useRefreshToken");let c;if(this.settings.refreshTokenAllowedScope===void 0)c=e.scope;else{const h=this.settings.refreshTokenAllowedScope.split(" ");c=(((o=e.scope)==null?void 0:o.split(" "))||[]).filter(y=>h.includes(y)).join(" ")}if(this.settings.dpop&&this.settings.dpop.store){const h=await this.getDpopProof(this.settings.dpop.store);r={...r,DPoP:h}}let d;try{d=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:c,redirect_uri:t,resource:n,timeoutInSeconds:s,extraHeaders:r,...i})}catch(h){if(h instanceof ki&&this.settings.dpop)r.DPoP=await this.getDpopProof(this.settings.dpop.store,h.nonce),d=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,scope:c,redirect_uri:t,resource:n,timeoutInSeconds:s,extraHeaders:r,...i});else throw h}const u=new ai(new URLSearchParams);return Object.assign(u,d),a.debug("validating response",u),await this._val
36idator.validateRefreshResponse(u,{...e,scope:c}),u}async createSignoutRequest({state:e,id_token_hint:t,client_id:n,request_type:s,url_state:r,post_logout_redirect_uri:i=this.settings.post_logout_redirect_uri,extraQueryParams:o=this.settings.extraQueryParams}={}){const a=this._logger.create("createSignoutRequest"),c=await this.metadataService.getEndSessionEndpoint();if(!c)throw a.throw(new Error("No end session endpoint")),null;a.debug("Received end session endpoint",c),!n&&i&&!t&&(n=this.settings.client_id);const d=new ux({url:c,id_token_hint:t,client_id:n,post_logout_redirect_uri:i,state_data:e,extraQueryParams:o,request_type:s,url_state:r});await this.clearStaleState();const u=d.state;return u&&(a.debug("Signout request has state to persist"),await this.settings.stateStore.set(u.id,u.toStorageString())),d}async readSignoutResponseState(e,t=!1){const n=this._logger.create("readSignoutResponseState"),s=new lx(Ii.readParams(e,this.settings.response_mode));if(!s.state){if(n.debug("No state in response"),s.error)throw n.warn("Response was error:",s.error),new qt(s);return{state:void 0,response:s}}const r=await this.settings.stateStore[t?"remove":"get"](s.state);if(!r)throw n.throw(new Error("No matching state found in storage")),null;return{state:await Fs.fromStorageString(r),response:s}}async processSignoutResponse(e){const t=this._logger.create("processSignoutResponse"),{state:n,response:s}=await this.readSignoutResponseState(e,!0);return n?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(s,n)):t.debug("No state from storage; skipping response validation"),s}clearStaleState(){return this._logger.create("clearStaleState"),Fs.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},mx=class{constructor(e){this._userManager=e,this._logger=new W("SessionMonitor"),this._start=async t=>{const n=t.session_state;if(!n)return;const s=this._logger.create("_start");if(t.profile?(this._sub=t.profile.sub,s.debug("session_state",n,", sub",this._sub)):(this._sub=void 0,s.debug("session_state",n,", anonymous user")),this._checkSessionIFrame){this._checkSessionIFrame.start(n);return}try{const r=await this._userManager.metadataService.getCheckSessionIframe();if(r){s.debug("initializing check session iframe");const i=this._userManager.settings.client_id,o=this._userManager.settings.checkSessionIntervalInSeconds,a=this._userManager.settings.stopCheckSessionOnError,c=new ex(this._callback,i,r,o,a);await c.load(),this._checkSessionIFrame=c,c.start(n)}else s.warn("no check session iframe found in the metadata")}catch(r){s.error("Error from getCheckSessionIframe:",r instanceof Error?r.message:r)}},this._stop=()=>{const t=this._logger.create("_stop");if(this._sub=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){const n=setInterval(async()=>{clearInterval(n);try{const s=await this._userManager.querySessionStatus();if(s){const r={session_state:s.session_state,profile:s.sub?{sub:s.sub}:null};this._start(r)}}catch(s){t.error("error from querySessionStatus",s instanceof Error?s.message:s)}},1e3)}},this._callback=async()=>{const t=this._logger.create("_callback");try{const n=await this._userManager.querySessionStatus();let s=!0;n&&this._checkSessionIFrame?n.sub===this._sub?(s=!1,this._checkSessionIFrame.start(n.session_state),t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",n.session_state),await this._userManager.events._raiseUserSessionChanged()):t.debug("different subject signed into OP",n.sub):t.debug("subject no longer signed into OP"),s?this._sub?await this._userManager.events._raiseUserSignedOut():await this._userManager.events._raiseUserSignedIn():t.debug("no change in session detected, no event to raise")}catch(n){this._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",n),await this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch(t=>{this._logger.error(t)})}async _init(){this._logger.create("_init");const e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){const t=await this._userManager.querySessionStatus();if(t){const n={session_state:t.session_state,profile:t.sub?{sub:t.sub}:null};this._start(n)}}}},ci=class kh{constructor(t){var n;this.id_token=t.id_token,this.session_state=(n=t.session_state)!=null?n:null,this.access_token=t.access_token,this.refresh_token=t.refresh_token,this.token_type=t.token_type,this.scope=t.scope,this.profile=t.profile,this.expires_at=t.expires_at,this.state=t.userState,this.url_state=t.url_state}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-gt.getEpochTime()}set expires_in(t){t!==void 0&&(this.expires_at=Math.floor(t)+gt.getEpochTime())}get expired(){const t=this.expires_in;if(t!==void 0)return t<=0}get scopes(){var t,n;return(n=(t=this.scope)==null?void 0:t.split(" "))!=null?n:[]}toStorageString(){return new W("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(t){return W.createStatic("User","fromStorageString"),new kh(JSON.parse(t))}},Ou="oidc-client",Th=class{constructor(){this._abort=new _t("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){const t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);const{url:n,keepOpen:s}=await new Promise((r,i)=>{const o=c=>{var d;const u=c.data,h=(d=e.scriptOrigin)!=null?d:window.location.origin;if(!(c.origin!==h||u?.source!==Ou)){try{const p=Ii.readParams(u.url,e.response_mode).get("state");if(p||t.warn("no state found in response url"),c.source!==this._window&&p!==e.state)return}catch{this._dispose(),i(new Error("Invalid response from window"))}r(u)}};window.addEventListener("message",o,!1),this._disposeHandlers.add(()=>window.removeEventListener("message",o,!1));const a=new BroadcastChannel(`oidc-client-popup-${e.state}`);a.addEventListener("message",o,!1),this._disposeHandlers.add(()=>a.close()),this._disposeHandlers.add(this._abort.addHandler(c=>{this._dispose(),i(c)}))});return t.debug("got response from window"),this._dispose(),s||this.close(),{url:n}}_dispose(){this._logger.create("_dispose");for(const e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,n=!1,s=window.location.origin){const r={source:Ou,url:t,keepOpen:n},i=new W("_notifyParent");
36if(e)i.debug("With parent. Using parent.postMessage."),e.postMessage(r,s);else{i.debug("No parent. Using BroadcastChannel.");const o=new URL(t).searchParams.get("state");if(!o)throw new Error("No parent and no state in URL. Can't complete notification.");const a=new BroadcastChannel(`oidc-client-popup-${o}`);a.postMessage(r),a.close()}}},Ph={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},Nh="_blank",yx=60,wx=2,Oh=10,bx=class extends Ti{constructor(e){const{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:n=e.post_logout_redirect_uri,popupWindowFeatures:s=Ph,popupWindowTarget:r=Nh,redirectMethod:i="assign",redirectTarget:o="self",iframeNotifyParentOrigin:a=e.iframeNotifyParentOrigin,iframeScriptOrigin:c=e.iframeScriptOrigin,requestTimeoutInSeconds:d,silent_redirect_uri:u=e.redirect_uri,silentRequestTimeoutInSeconds:h,automaticSilentRenew:p=!0,validateSubOnSilentRenew:y=!0,includeIdTokenInSilentRenew:x=!1,monitorSession:A=!1,monitorAnonymousSession:_=!1,checkSessionIntervalInSeconds:T=wx,query_status_response_type:P="code",stopCheckSessionOnError:Z=!0,revokeTokenTypes:G=["access_token","refresh_token"],revokeTokensOnSignout:re=!1,includeIdTokenInSilentSignout:Y=!1,accessTokenExpiringNotificationTimeInSeconds:ht=yx,userStore:tt}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=n,this.popupWindowFeatures=s,this.popupWindowTarget=r,this.redirectMethod=i,this.redirectTarget=o,this.iframeNotifyParentOrigin=a,this.iframeScriptOrigin=c,this.silent_redirect_uri=u,this.silentRequestTimeoutInSeconds=h||d||Oh,this.automaticSilentRenew=p,this.validateSubOnSilentRenew=y,this.includeIdTokenInSilentRenew=x,this.monitorSession=A,this.monitorAnonymousSession=_,this.checkSessionIntervalInSeconds=T,this.stopCheckSessionOnError=Z,this.query_status_response_type=P,this.revokeTokenTypes=G,this.revokeTokensOnSignout=re,this.includeIdTokenInSilentSignout=Y,this.accessTokenExpiringNotificationTimeInSeconds=ht,tt)this.userStore=tt;else{const Je=typeof window<"u"?window.sessionStorage:new xh;this.userStore=new _h({store:Je})}}},Bu=class Bh extends Th{constructor({silentRequestTimeoutInSeconds:t=Oh}){super(),this._logger=new W("IFrameWindow"),this._timeoutInSeconds=t,this._frame=Bh.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){const t=window.document.createElement("iframe");return t.style.visibility="hidden",t.style.position="fixed",t.style.left="-1000px",t.style.top="0",t.width="0",t.height="0",window.document.body.appendChild(t),t}async navigate(t){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);const n=setTimeout(()=>void this._abort.raise(new $a("IFrame timed out without a response")),this._timeoutInSeconds*1e3);return this._disposeHandlers.add(()=>clearTimeout(n)),await super.navigate(t)}close(){var t;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",n=>{var s;const r=n.target;(s=r.parentNode)==null||s.removeChild(r),this._abort.raise(new Error("IFrame removed from DOM"))},!0),(t=this._frame.contentWindow)==null||t.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(t,n){return super._notifyParent(window.parent,t,!1,n)}},Sx=class{constructor(e){this._settings=e,this._logger=new W("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new Bu({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),Bu.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},Ex=500,xx=1e3,Mu=class extends Th{constructor({popupWindowTarget:e=Nh,popupWindowFeatures:t={},popupSignal:n}){super(),this._logger=new W("PopupWindow");const s=Nu.center({...Ph,...t});this._window=window.open(void 0,e,Nu.serialize(s)),n&&n.addEventListener("abort",()=>{var r;this._abort.raise(new Error((r=n.reason)!=null?r:"Popup aborted"))}),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{if(!this._window||typeof this._window.closed!="boolean"||this._window.closed){this._abort.raise(new Error("Popup blocked by user"));return}this.close()},t.closePopupWindowAfterInSeconds*xx)}async navigate(e){var t;(t=this._window)==null||t.focus();const n=setInterval(()=>{(!this._window||this._window.closed)&&(this._logger.debug("Popup closed by user or isolated by redirect"),s(),this._disposeHandlers.delete(s))},Ex),s=()=>clearInterval(n);return this._disposeHandlers.add(s),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){super._notifyParent(window.opener,e,t),!t&&!window.opener&&window.close()}},_x=class{constructor(e){this._settings=e,this._logger=new W("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget,popupSignal:n}){return new Mu({popupWindowFeatures:e,popupWindowTarget:t,popupSignal:n})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),Mu.notifyOpener(e,t)}},vx=class{constructor(e){this._settings=e,this._logger=new W("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var n;this._logger.create("prepare");let s=window.self;t==="top"&&(s=(n=window.top)!=null?n:window.self);const r=s.location[e].bind(s.location);let i;return{navigate:async o=>{this._logger.create("navigate");const a=new Promise((c,d)=>{i=d});return r(o.url),await a},close:()=>
36{this._logger.create("close"),i?.(new Error("Redirect aborted")),s.stop()}}}async callback(){}},Ax=class extends QE{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new W("UserManagerEvents"),this._userLoaded=new _t("User loaded"),this._userUnloaded=new _t("User unloaded"),this._silentRenewError=new _t("Silent renew error"),this._userSignedIn=new _t("User signed in"),this._userSignedOut=new _t("User signed out"),this._userSessionChanged=new _t("User session changed")}async load(e,t=!0){await super.load(e),t&&await this._userLoaded.raise(e)}async unload(){await super.unload(),await this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}async _raiseSilentRenewError(e){await this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}async _raiseUserSignedIn(){await this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}async _raiseUserSignedOut(){await this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}async _raiseUserSessionChanged(){await this._userSessionChanged.raise()}},Cx=class{constructor(e){this._userManager=e,this._logger=new W("SilentRenewService"),this._isStarted=!1,this._retryTimer=new gt("Retry Silent Renew"),this._tokenExpiring=async()=>{const t=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),t.debug("silent token renewal successful")}catch(n){if(n instanceof $a){t.warn("ErrorTimeout from signinSilent:",n,"retry in 5s"),this._retryTimer.init(5);return}t.error("Error from signinSilent:",n),await this._userManager.events._raiseSilentRenewError(n)}}}async start(){const e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},Rx=class{constructor(e){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.data=e.state}},Ix=class{constructor(e,t,n,s){this._logger=new W("UserManager"),this.settings=new bx(e),this._client=new gx(e),this._redirectNavigator=t??new vx(this.settings),this._popupNavigator=n??new _x(this.settings),this._iframeNavigator=s??new Sx(this.settings),this._events=new Ax(this.settings),this._silentRenewService=new Cx(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new mx(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(e=!1){const t=this._logger.create("getUser"),n=await this._loadUser();return n?(t.info("user loaded"),await this._events.load(n,e),n):(t.info("user not found in storage"),null)}async removeUser(){const e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),await this._events.unload()}async signinRedirect(e={}){var t;this._logger.create("signinRedirect");const{redirectMethod:n,...s}=e;let r;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(r=await this.generateDPoPJkt(this.settings.dpop));const i=await this._redirectNavigator.prepare({redirectMethod:n});await this._signinStart({request_type:"si:r",dpopJkt:r,...s},i)}async signinRedirectCallback(e=window.location.href){const t=this._logger.create("signinRedirectCallback"),n=await this._signinEnd(e);return n.profile&&n.profile.sub?t.info("success, signed in subject",n.profile.sub):t.info("no subject"),n}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:n=!1}){const s=this._logger.create("signinResourceOwnerCredential"),r=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:n,extraTokenParams:this.settings.extraTokenParams});s.debug("got signin response");const i=await this._buildUser(r);return i.profile&&i.profile.sub?s.info("success, signed in subject",i.profile.sub):s.info("no subject"),i}async signinPopup(e={}){var t;const n=this._logger.create("signinPopup");let s;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(s=await this.generateDPoPJkt(this.settings.dpop));const{popupWindowFeatures:r,popupWindowTarget:i,popupSignal:o,...a}=e,c=this.settings.popup_redirect_uri;c||n.throw(new Error("No popup_redirect_uri configured"));const d=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:i,popupSignal:o}),u=await this._signin({request_type:"si:p",redirect_uri:c,display:"popup",dpopJkt:s,...a},d);return u&&(u.profile&&u.profile.sub?n.info("success, signed in subject",u.profile.sub):n.info("no subject")),u}async signinPopupCallback(e=window.location.href,t=!1){const n=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async signinSilent(e={}){var t,n;const s=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:r,...i}=e;let o=await this._loadUser();if(o?.refresh_token){s.debug("using refresh token");const h=new Rx(o);return await this._useRefreshToken({state:h,redirect_uri:i.redirect_uri,resource:i.resource,extraTokenParams:i.extraTokenParams,timeoutInSeconds:r})}let a;(t=this.settings.dpop)!=null&&t.bind_authorization_code&&(a=await this.generateDPoPJkt(this.settings.dpop));const c=this.settings.silent_redirect_uri;c||s.throw(new Error("No silent_redirect_uri configured"));let d;
36o&&this.settings.validateSubOnSilentRenew&&(s.debug("subject prior to silent renew:",o.profile.sub),d=o.profile.sub);const u=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r});return o=await this._signin({request_type:"si:s",redirect_uri:c,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?o?.id_token:void 0,dpopJkt:a,...i},u,d),o&&((n=o.profile)!=null&&n.sub?s.info("success, signed in subject",o.profile.sub):s.info("no subject")),o}async _useRefreshToken(e){const t=await this._client.useRefreshToken({timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds,...e}),n=new ci({...e.state,...t});return await this.storeUser(n),await this._events.load(n),n}async signinSilentCallback(e=window.location.href){const t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){const{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":await this.signinPopupCallback(e);break;case"si:s":await this.signinSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){const{state:n}=await this._client.readSignoutResponseState(e);if(n)switch(n.request_type){case"so:r":return await this.signoutRedirectCallback(e);case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){const t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:n,...s}=e,r=this.settings.silent_redirect_uri;r||t.throw(new Error("No silent_redirect_uri configured"));const i=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:n}),a=await this._signinStart({request_type:"si:s",redirect_uri:r,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?i?.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...s},o);try{const c={},d=await this._client.processSigninResponse(a.url,c);return t.debug("got signin response"),d.session_state&&d.profile.sub?(t.info("success for subject",d.profile.sub),{session_state:d.session_state,sub:d.profile.sub}):(t.info("success, user not authenticated"),null)}catch(c){if(this.settings.monitorAnonymousSession&&c instanceof qt)switch(c.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:c.session_state}}throw c}}async _signin(e,t,n){const s=await this._signinStart(e,t);return await this._signinEnd(s.url,n)}async _signinStart(e,t){const n=this._logger.create("_signinStart");try{const s=await this._client.createSigninRequest(e);return n.debug("got signin request"),await t.navigate({url:s.url,state:s.state.id,response_mode:s.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(s){throw n.debug("error after preparing navigator, closing navigator window"),t.close(),s}}async _signinEnd(e,t){const n=this._logger.create("_signinEnd"),s={},r=await this._client.processSigninResponse(e,s);return n.debug("got signin response"),await this._buildUser(r,t)}async _buildUser(e,t){const n=this._logger.create("_buildUser"),s=new ci(e);if(t){if(t!==s.profile.sub)throw n.debug("current user does not match user returned from signin. sub from signin:",s.profile.sub),new qt({...e,error:"login_required"});n.debug("current user matches user returned from signin")}return await this.storeUser(s),n.debug("user stored"),await this._events.load(s),s}async signoutRedirect(e={}){const t=this._logger.create("signoutRedirect"),{redirectMethod:n,...s}=e,r=await this._redirectNavigator.prepare({redirectMethod:n});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...s},r),t.info("success")}async signoutRedirectCallback(e=window.location.href){const t=this._logger.create("signoutRedirectCallback"),n=await this._signoutEnd(e);return t.info("success"),n}async signoutPopup(e={}){const t=this._logger.create("signoutPopup"),{popupWindowFeatures:n,popupWindowTarget:s,popupSignal:r,...i}=e,o=this.settings.popup_post_logout_redirect_uri,a=await this._popupNavigator.prepare({popupWindowFeatures:n,popupWindowTarget:s,popupSignal:r});await this._signout({request_type:"so:p",post_logout_redirect_uri:o,state:o==null?void 0:{},...i},a),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){const n=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),n.info("success")}async _signout(e,t){const n=await this._signoutStart(e,t);return await this._signoutEnd(n.url)}async _signoutStart(e={},t){var n;const s=this._logger.create("_signoutStart");try{const r=await this._loadUser();s.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(r);const i=e.id_token_hint||r&&r.id_token;i&&(s.debug("setting id_token_hint in signout request"),e.id_token_hint=i),await this.removeUser(),s.debug("user removed, creating signout request");
36const o=await this._client.createSignoutRequest(e);return s.debug("got signout request"),await t.navigate({url:o.url,state:(n=o.state)==null?void 0:n.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(r){throw s.debug("error after preparing navigator, closing navigator window"),t.close(),r}}async _signoutEnd(e){const t=this._logger.create("_signoutEnd"),n=await this._client.processSignoutResponse(e);return t.debug("got signout response"),n}async signoutSilent(e={}){var t;const n=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:s,...r}=e,i=this.settings.includeIdTokenInSilentSignout?(t=await this._loadUser())==null?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,a=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:s});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:i,...r},a),n.info("success")}async signoutSilentCallback(e=window.location.href){const t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){const t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){const n=this._logger.create("_revokeInternal");if(!e)return;const s=t.filter(r=>typeof e[r]=="string");if(!s.length){n.debug("no need to revoke due to no token(s)");return}for(const r of s)await this._client.revokeToken(e[r],r),n.info(`${r} revoked successfully`),r!=="access_token"&&(e[r]=null);await this.storeUser(e),n.debug("user stored"),await this._events.load(e)}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){const e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),ci.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){const t=this._logger.create("storeUser");if(e){t.debug("storing user");const n=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,n)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey),this.settings.dpop&&await this.settings.dpop.store.remove(this.settings.client_id)}async clearStaleState(){await this._client.clearStaleState()}async dpopProof(e,t,n,s){var r,i;const o=await((i=(r=this.settings.dpop)==null?void 0:r.store)==null?void 0:i.get(this.settings.client_id));if(o)return await Ve.generateDPoPProof({url:e,accessToken:t?.access_token,httpMethod:n,keyPair:o.keys,nonce:s})}async generateDPoPJkt(e){let t=await e.store.get(this.settings.client_id);if(!t){const n=await Ve.generateDPoPKeys();t=new Ih(n),await e.store.set(this.settings.client_id,t)}return await Ve.generateDPoPJkt(t.keys)}};let cs=null;function kx(e){if(cs)return cs;const t={authority:"https://cognito-idp.us-west-2.amazonaws.com/us-west-2_lg1qptg2n",client_id:"4d6esoka62s46lo4d398o3sqpi",redirect_uri:e+"/auth/callback",response_type:"code",scope:"aws.cognito.signin.user.admin email openid phone profile"};return cs=new Ix({...t}),cs}async function Tx(e){await kx(e.origin).signinRedirect()}const Mh="ccported_tokens";function Px(){try{const e=localStorage.getItem(Mh);return e?JSON.parse(e):null}catch{return null}}function Nx(){try{localStorage.removeItem(Mh)}catch{}}function Ox(e,t=60){return e?Date.now()>=e-t*1e3:!0}function Bx(e){if(!e)return null;try{const t=e.split(".");if(t.length!==3)return null;const n=atob(t[1].replace(/-/g,"+").replace(/_/g,"/")),s=decodeURIComponent(n.split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(s)}catch{return null}}const se={awsReady:!1,ssr:!Uu,adBlockEnabled:!1,adsEnabled:!1,credentials:null,dynamoDBClient:null,s3Client:null,devMode:window.location.hostname==="localhost",serverResponses:[],plays:0,user:null,loggedIn:!1};function Mx(){if(se.ssr)return;const{servers:e,aHosts:t,games:n,isAHost:s,...r}=He;localStorage.setItem("ccported_state",JSON.stringify(r))}function Dx(e){return Ux(e),new Proxy(e,{set(t,n,s){return t[n]=s,Mx(),!0}})}const He=Dx({servers:za,aHosts:xs,currentServer:za[0],homeView:"grid",pinnedGames:[],games:[],seenNotifications:[],isAHost:()=>xs.some(e=>e.hostname===new URL(zh.url).hostname),localPlays:0});
36let Du=!1,Fu=!1,Es=!1;async function u_(){if(Du)return;if(Fu){await Fx();return}if(Fu=!0,window){const o=new URLSearchParams(window.location.search),a=o.get("SetServer");if(a){console.log("[initializeTooling] Processing SetServer parameter:",a);const d=await Lu();if(d){const h=d.find(p=>p.hostname===a);h?(He.currentServer=h,console.log("[initializeTooling] Set server to:",h.name)):console.warn("[initializeTooling] Server not found for hostname:",a)}else console.warn("[initializeTooling] No servers available to match:",a);o.delete("SetServer");const u=new URL(window.location.href);u.search=o.toString(),window.history.replaceState(null,"",u.toString())}const c=Px();if(c)if(console.log("[initializeTooling] Found stored tokens.",c),Ox(c.expiresAt))KE({title:"Session expired",content:"Your session has expired and you have been signed out. You can log in again or continue without logging in.",actions:[{label:"Log in",onClick:()=>{try{Tx(new URL(window.location.href))}catch{}}},{label:"Continue without login",onClick:d=>{Nx(),se.user=null,se.loggedIn=!1,d.close()}}]});else{const d=Bx(c.idToken);se.user||(se.user={}),se.user.tokens=c,d&&(se.user.profile=d,se.loggedIn=!0)}}await Hx()||console.error("No available servers found.");const t=await Wh();He.aHosts=t,Vh(t);const n=await WE();se.adBlockEnabled=n,se.adsEnabled=!n&&He.isAHost(),He.isAHost()||t.forEach(async o=>{const a=await La({name:`AHOST ${o.hostname}`,hostname:o.hostname,path:"/",priority:1,protocol:window.isSecureContext?"https":"http"});console.log(`[R][CardGrid][Mount] Tested ad host ${o.hostname}:`,a),a.success&&/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(o.hostname)});const s=await qx(),r=new Wb({region:"us-west-2",credentials:s}),i=new UE({region:"us-west-2",credentials:s});se.credentials=await s(),se.awsReady=!0,se.dynamoDBClient=r,se.s3Client=i,Du=!0}function Fx(){return new Promise(e=>{const t=setInterval(()=>{se.awsReady&&se.dynamoDBClient&&se.s3Client&&(clearInterval(t),e())},50)})}function $x(){return new Promise(e=>{const t=setInterval(()=>{Es||(clearInterval(t),e())},50)})}function Ux(e){if(se.ssr)return e;const t=localStorage.getItem("ccported_state");if(t){const n=JSON.parse(t);Object.assign(e,n)}return e}async function*Lx(e){console.log("[SERVERS][testServersWithYield] Testing servers with yield...",e);const t=e;if(t.length===0)return;const n=[];let s=0;const r=t.map(i=>La(i));for(let i=0;i<r.length;i++)r[i].then(o=>{o.success?n.push(t[i]):console.log(`[SERVERS][testServersWithYield] Server ${t[i].name} (${t[i].hostname}) failed: ${o.reason}`),s++});for(;s<r.length;){for(;n.length>0;){const i=n.shift();i&&(yield i)}await new Promise(i=>setTimeout(i,50))}for(;n.length>0;){const i=n.shift();i&&(yield i)}}function ds(e,t){const n={server:e,...t},s=se.serverResponses.findIndex(r=>r.server.hostname===e.hostname);s!==-1?se.serverResponses[s]=n:se.serverResponses.push(n)}async function La(e){const t=performance.now();console.log(`[SERVERS][testSingleServer] Testing server ${e.name} (${e.hostname})...`);try{const n=await fetch(`${e.protocol}://${e.hostname}/blocked_res.txt`);let s=t;if(n&&(s=performance.now()),n.ok&&n.status===200){s=performance.now();const r=await n.text();if(r.includes("===NOT_BLOCKED===")&&r.includes('SOmehtin23"')){s=performance.now();const i=await jx(e,t);return ds(e,i),i}else{const i={success:!1,time:s-t,reason:"Content mismatch: "+r};return ds(e,i),i}}else{const r={success:!1,time:s-t,reason:`Bad status: ${n.status}`};return ds(e,r),r}}catch(n){const s={success:!1,time:performance.now()-t,reason:`Network error: ${n}`};return ds(e,s),s}}async function jx(e,t){return new Promise(n=>{const s=document.createElement("iframe");s.style.display="none",s.src=`${e.protocol}://${e.hostname}/test_availability.html`,document.body.appendChild(s);let r=!1;const i=()=>{s.parentNode&&document.body.removeChild(s),window.removeEventListener("message",a)},o=c=>{r||(r=!0,i(),n(c))},a=c=>{if(c.origin!==`http://${e.hostname}`&&c.origin!==`https://${e.hostname}`)return;const d=c.data,u=performance.now();if(d==="INITIALIZED"){if(!s.contentWindow){o({success:!1,time:u-t,reason:"Embed window not found"});return}s.contentWindow.postMessage("CHECK_AVAILABILITY",`${e.protocol}://${e.hostname}`);return}o(d==="===NOT_BLOCKED==="?{success:!0,time:u-t,reason:"Embed/Response success"}:{success:!1,time:u-t,reason:"Incorrect embed challenge response "+d})};window.addEventListener("message",a),setTimeout(()=>{o({success:!1,time:performance.now()-t,reason:"Timeout waiting for Iframe"})},3e3)})}
36async function Hx(){if(Es)return console.log("[STATE][findServer] Server search already in progress, waiting..."),await $x(),He.currentServer;Es=!0;const e=await Lu();if(!e||e.length===0)return console.error("[STATE][findServer] No servers available."),null;He.servers=e;try{const t=He.currentServer&&He.currentServer.hostname?He.currentServer:null,n=async i=>{if(!i)return null;const o=await La(i);return o.success?(console.log(`[STATE][findServer] Server ${i.name} is available.`),i):(console.log(`[STATE][findServer] Server ${i.name} failed test: ${o.reason}`),null)};if(t){console.log(`[STATE][findServer] Using optimistic server: ${t.name} with priority ${t.priority}`);const i=await n(t);if(i)return He.currentServer=i,i;console.log("[STATE][findServer] Optimistic server failed, trying findSingleServer...")}const s=e.sort((i,o)=>i.priority-o.priority),r=await zx(s);return r?(He.currentServer=r,r):(console.error("[STATE][findServer] No available servers found after full list check."),null)}finally{Es=!1}}async function zx(e){for await(const t of Lx(e))return console.log(`Found available server: ${t.hostname}`),t;return null}async function qx(){const t=sw({client:new Gy({region:"us-west-2"}),identityPoolId:"us-west-2:8ffe94a1-9042-4509-8e65-4efe16e61e3e"});return se.awsReady=!0,t}export{mg as A,yg as B,zs as C,ul as D,N as E,je as F,J as G,ve as H,Hn as I,Gx as J,vs as K,Zx as L,Gy as M,i_ as N,o_ as O,a_ as P,Xx as R,se as S,Kb as U,B as _,po as a,kx as b,Fl as c,t_ as d,He as e,Tx as f,Ui as g,KE as h,u_ as i,Yx as j,e_ as k,d_ as l,Uu as m,WE as n,Wh as o,t0 as p,CS as q,n_ as r,Qx as s,VE as t,s_ as u,c_ as v,Fx as w,Ft as x,un as y,zn as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.