@spiffcommerce/core 40.3.6 → 40.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2688,7 +2688,7 @@ Minimum version required to store current data is: `+X+`.
2688
2688
  `));return t(i)},dV={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},hV=(r,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t})=>({applyToStack:n=>{n.addRelativeTo(fV(r,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t}),dV)}}),pV=r=>e=>{throw e},gV=(r,e)=>{},mV=r=>(e,t)=>async n=>{if(!aa.isInstance(n.request))return e(n);const a=xc(t).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:s={}},identity:o,signer:l}=a,u=await e({...n,request:await l.sign(n.request,o,s)}).catch((l.errorHandler||pV)(s));return(l.successHandler||gV)(u.response,s),u},vV={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},yV=r=>({applyToStack:e=>{e.addRelativeTo(mV(),vV)}}),sd=r=>{if(typeof r=="function")return r;const e=Promise.resolve(r);return()=>e},kI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yE=Object.entries(kI).reduce((r,[e,t])=>(r[t]=Number(e),r),{}),AV=kI.split(""),Xu=6,od=8,bV=63,tm=r=>{let e=r.length/4*3;r.slice(-2)==="=="?e-=2:r.slice(-1)==="="&&e--;const t=new ArrayBuffer(e),n=new DataView(t);for(let i=0;i<r.length;i+=4){let a=0,s=0;for(let u=i,c=i+3;u<=c;u++)if(r[u]!=="="){if(!(r[u]in yE))throw new TypeError(`Invalid character ${r[u]} in base64 string.`);a|=yE[r[u]]<<(c-u)*Xu,s+=Xu}else a>>=Xu;const o=i/4*3;a>>=s%od;const l=Math.floor(s/od);for(let u=0;u<l;u++){const c=(l-u-1)*od;n.setUint8(o+u,(a&255<<c)>>c)}}return new Uint8Array(t)},Dl=r=>new TextEncoder().encode(r),Pd=r=>typeof r=="string"?Dl(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r),rm=r=>{if(typeof r=="string")return r;if(typeof r!="object"||typeof r.byteOffset!="number"||typeof r.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(r)};function wg(r){let e;typeof r=="string"?e=Dl(r):e=r;const t=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!t&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let i="";for(let a=0;a<e.length;a+=3){let s=0,o=0;for(let u=a,c=Math.min(a+3,e.length);u<c;u++)s|=e[u]<<(c-u-1)*od,o+=od;const l=Math.ceil(o/Xu);s<<=l*Xu-o;for(let u=1;u<=l;u++){const c=(l-u)*Xu;i+=AV[(s&bV<<c)>>c]}i+="==".slice(0,4-l)}return i}class El extends Uint8Array{static fromString(e,t="utf-8"){if(typeof e=="string")return t==="base64"?El.mutate(tm(e)):El.mutate(Dl(e));throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}static mutate(e){return Object.setPrototypeOf(e,El.prototype),e}transformToString(e="utf-8"){return e==="base64"?wg(this):rm(this)}}const kl=r=>encodeURIComponent(r).replace(/[!'()*]/g,CV),CV=r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`;function wV(r){const e=[];for(let t of Object.keys(r).sort()){const n=r[t];if(t=kl(t),Array.isArray(n))for(let i=0,a=n.length;i<a;i++)e.push(`${t}=${kl(n[i])}`);else{let i=t;(n||typeof n=="string")&&(i+=`=${kl(n)}`),e.push(i)}}return e.join("&")}function AE(r,e){return new Request(r,e)}function xV(r=0){return new Promise((e,t)=>{r&&setTimeout(()=>{const n=new Error(`Request did not complete within ${r} ms`);n.name="TimeoutError",t(n)},r)})}const Bv={supported:void 0};class D1{config;configProvider;static create(e){return typeof e?.handle=="function"?e:new D1(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(t=>t||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),Bv.supported===void 0&&(Bv.supported=typeof Request<"u"&&"keepalive"in AE("https://[::1]"))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);const i=n??this.config.requestTimeout,a=this.config.keepAlive===!0,s=this.config.credentials;if(t?.aborted){const w=bE(t);return Promise.reject(w)}let o=e.path;const l=wV(e.query||{});l&&(o+=`?${l}`),e.fragment&&(o+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){const w=e.username??"",k=e.password??"";u=`${w}:${k}@`}const{port:c,method:h}=e,f=`${e.protocol}//${u}${e.hostname}${c?`:${c}`:""}${o}`,d=h==="GET"||h==="HEAD"?void 0:e.body,g={body:d,headers:new Headers(e.headers),method:h,credentials:s};this.config?.cache&&(g.cache=this.config.cache),d&&(g.duplex="half"),typeof AbortController<"u"&&(g.signal=t),Bv.supported&&(g.keepalive=a),typeof this.config.requestInit=="function"&&Object.assign(g,this.config.requestInit(e));let v=()=>{};const y=AE(f,g),A=[fetch(y).then(w=>{const k=w.headers,T={};for(const R of k.entries())T[R[0]]=R[1];return w.body!=null?{response:new dc({headers:T,reason:w.statusText,statusCode:w.status,body:w.body})}:w.blob().then(R=>({response:new dc({headers:T,reason:w.statusText,statusCode:w.status,body:R})}))}),xV(i)];return t&&A.push(new Promise((w,k)=>{const T=()=>{const S=bE(t);k(S)};if(typeof t.addEventListener=="function"){const S=t;S.addEventListener("abort",T,{once:!0}),v=()=>S.removeEventListener("abort",T)}else t.onabort=T})),Promise.race(A).finally(v)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}function bE(r){const e=r&&typeof r=="object"&&"reason"in r?r.reason:void 0;if(e){if(e instanceof Error){const i=new Error("Request aborted");return i.name="AbortError",i.cause=e,i}const n=new Error(String(e));return n.name="AbortError",n}const t=new Error("Request aborted");return t.name="AbortError",t}const SV=async r=>typeof Blob=="function"&&r instanceof Blob||r.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await r.arrayBuffer()):EV(r):kV(r);async function EV(r){const e=await FV(r),t=tm(e);return new Uint8Array(t)}async function kV(r){const e=[],t=r.getReader();let n=!1,i=0;for(;!n;){const{done:o,value:l}=await t.read();l&&(e.push(l),i+=l.length),n=o}const a=new Uint8Array(i);let s=0;for(const o of e)a.set(o,s),s+=o.length;return a}function FV(r){return new Promise((e,t)=>{const n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return t(new Error("Reader aborted too early"));const i=n.result??"",a=i.indexOf(","),s=a>-1?a+1:i.length;e(i.substring(s))},n.onabort=()=>t(new Error("Read aborted")),n.onerror=()=>t(n.error),n.readAsDataURL(r)})}const FI={},fA={};for(let r=0;r<256;r++){let e=r.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),FI[r]=e,fA[e]=r}function TV(r){if(r.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2){const n=r.slice(t,t+2).toLowerCase();if(n in fA)e[t/2]=fA[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function Fl(r){let e="";for(let t=0;t<r.byteLength;t++)e+=FI[r[t]];return e}const dA=async(r=new Uint8Array,e)=>{if(r instanceof Uint8Array)return El.mutate(r);if(!r)return El.mutate(new Uint8Array);const t=e.streamCollector(r);return El.mutate(await t)},Jp=r=>typeof r=="function"?r():r,TI=(r,e,t,n,i)=>({name:e,namespace:r,traits:t,input:n,output:i}),IV=r=>(e,t)=>async n=>{const{response:i}=await e(n),{operationSchema:a}=xc(t),[,s,o,l,u,c]=a??[];try{const h=await r.protocol.deserializeResponse(TI(s,o,l,u,c),{...r,...t},i);return{response:i,output:h}}catch(h){if(Object.defineProperty(h,"$response",{value:i,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in h)){const f="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{h.message+=`
2689
2689
  `+f}catch{!t.logger||t.logger?.constructor?.name==="NoOpLogger"?console.warn(f):t.logger?.warn?.(f)}typeof h.$responseBodyText<"u"&&h.$response&&(h.$response.body=h.$responseBodyText);try{if(dc.isInstance(i)){const{headers:d={}}=i,g=Object.entries(d);h.$metadata={httpStatusCode:i.statusCode,requestId:Mv(/^x-[\w-]+-request-?id$/,g),extendedRequestId:Mv(/^x-[\w-]+-id-2$/,g),cfId:Mv(/^x-[\w-]+-cf-id$/,g)}}}catch{}}throw h}},Mv=(r,e)=>(e.find(([t])=>t.match(r))||[void 0,void 0])[1];function DV(r){const e={};if(r=r.replace(/^\?/,""),r)for(const t of r.split("&")){let[n,i=null]=t.split("=");n=decodeURIComponent(n),i&&(i=decodeURIComponent(i)),n in e?Array.isArray(e[n])?e[n].push(i):e[n]=[e[n],i]:e[n]=i}return e}const hc=r=>{if(typeof r=="string")return hc(new URL(r));const{hostname:e,pathname:t,port:n,protocol:i,search:a}=r;let s;return a&&(s=DV(a)),{hostname:e,port:n?parseInt(n):void 0,protocol:i,path:t,query:s}},PV=r=>{if(typeof r=="object"){if("url"in r){const e=hc(r.url);if(r.headers){e.headers={};for(const[t,n]of Object.entries(r.headers))e.headers[t.toLowerCase()]=n.join(", ")}return e}return r}return hc(r)},RV=r=>(e,t)=>async n=>{const{operationSchema:i}=xc(t),[,a,s,o,l,u]=i??[],c=t.endpointV2?async()=>PV(t.endpointV2):r.endpoint,h=await r.protocol.serializeRequest(TI(a,s,o,l,u),n.input,{...r,...t,endpoint:c});return e({...n,request:h})},OV={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},BV={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function MV(r){return{applyToStack:e=>{e.add(RV(r),BV),e.add(IV(r),OV),r.protocol.setSerdeContext(r)}}}const _v=[];function Yf(r){if(typeof r=="object")return r;if(r=r|0,_v[r])return _v[r];const e={};let t=0;for(const n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(r>>t++&1)===1&&(e[n]=1);return _v[r]=e}const Of={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},Nv=[],Lv={};class vi{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=vi.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;const n=[];let i=e,a=e;for(this._isMemberSchema=!1;Uv(i);)n.push(i[1]),i=i[0],a=Jp(i),this._isMemberSchema=!0;if(n.length>0){this.memberTraits={};for(let s=n.length-1;s>=0;--s){const o=n[s];Object.assign(this.memberTraits,Yf(o))}}else this.memberTraits=0;if(a instanceof vi){const s=this.memberTraits;Object.assign(this,a),this.memberTraits=Object.assign({},s,a.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=t??a.memberName;return}if(this.schema=Jp(a),_V(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(a),this.traits=0),this._isMemberSchema&&!t)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){const t=this.prototype.isPrototypeOf(e);return!t&&typeof e=="object"&&e!==null?e.symbol===this.symbol:t}static of(e){const t=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if(Nv[e])return Nv[e]}else if(typeof e=="string"){if(Lv[e])return Lv[e]}else if(t&&e[Of.ns])return e[Of.ns];const n=Jp(e);if(n instanceof vi)return n;if(Uv(n)){const[a,s]=n;if(a instanceof vi)return Object.assign(a.getMergedTraits(),Yf(s)),a;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}const i=new vi(n);return t?e[Of.ns]=i:typeof n=="string"?Lv[n]=i:typeof n=="number"?Nv[n]=i:i}getSchema(){const e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){const{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){const e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){const e=this.getSchema();if(typeof e!="object")return!1;const t=e[0];return t===3||t===-3||t===4}isUnionSchema(){const e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){const e=this.getSchema();return e===21||e===42}isTimestampSchema(){const e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){const{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return Yf(this.memberTraits)}getOwnTraits(){return Yf(this.traits)}getKeySchema(){const[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);const n=this.getSchema(),i=e?15:n[4]??0;return Bf([i,0],"key")}getValueSchema(){const e=this.getSchema(),[t,n,i]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],a=typeof e=="number"?63&e:e&&typeof e=="object"&&(n||i)?e[3+e[0]]:t?15:void 0;if(a!=null)return Bf([a,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){const t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){const n=t[4].indexOf(e),i=t[5][n];return Bf(Uv(i)?i:[i,0],e)}if(this.isDocumentSchema())return Bf([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){const e={};try{for(const[t,n]of this.structIterator())e[t]=n}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(const[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");const e=this.getSchema(),t=e[4].length;let n=e[Of.it];if(n&&t===n.length){yield*n;return}n=Array(t);for(let i=0;i<t;++i){const a=e[4][i],s=Bf([e[5][i],0],a);yield n[i]=[a,s]}e[Of.it]=n}}function Bf(r,e){if(r instanceof vi)return Object.assign(r,{memberName:e,_isMemberSchema:!0});const t=vi;return new t(r,e)}const Uv=r=>Array.isArray(r)&&r.length===2,_V=r=>Array.isArray(r)&&r.length>=5;class ra{namespace;schemas;exceptions;static registries=new Map;constructor(e,t=new Map,n=new Map){this.namespace=e,this.schemas=t,this.exceptions=n}static for(e){return ra.registries.has(e)||ra.registries.set(e,new ra(e)),ra.registries.get(e)}copyFrom(e){const{schemas:t,exceptions:n}=this;for(const[i,a]of e.schemas)t.has(i)||t.set(i,a);for(const[i,a]of e.exceptions)n.has(i)||n.set(i,a)}register(e,t){const n=this.normalizeShapeId(e);for(const i of[this,ra.for(n.split("#")[0])])i.schemas.set(n,t)}getSchema(e){const t=this.normalizeShapeId(e);if(!this.schemas.has(t))throw new Error(`@smithy/core/schema - schema not found for ${t}`);return this.schemas.get(t)}registerError(e,t){const n=e,i=n[1];for(const a of[this,ra.for(i)])a.schemas.set(i+"#"+n[2],n),a.exceptions.set(n,t)}getErrorCtor(e){const t=e;return this.exceptions.has(t)?this.exceptions.get(t):ra.for(t[1]).exceptions.get(t)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,t,n]=e,i=t+"#"+n;if(i.startsWith("smithy.ts.sdk.synthetic.")&&i.endsWith("ServiceException"))return e}}find(e){return[...this.schemas.values()].find(e)}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}const hA=r=>{if(r!=null){if(typeof r=="string"){const e=parseFloat(r);if(!Number.isNaN(e))return String(e)!==String(r)&&$V.warn(GV(`Expected number but observed string: ${r}`)),e}if(typeof r=="number")return r;throw new TypeError(`Expected number, got ${typeof r}: ${r}`)}},NV=Math.ceil(2**127*(2-2**-23)),CE=r=>{const e=hA(r);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>NV)throw new TypeError(`Expected 32-bit float, got ${r}`);return e},LV=r=>{if(r!=null){if(Number.isInteger(r)&&!Number.isNaN(r))return r;throw new TypeError(`Expected integer, got ${typeof r}: ${r}`)}},wE=r=>II(r,16),xE=r=>II(r,8),II=(r,e)=>{const t=LV(r);if(t!==void 0&&UV(t,e)!==t)throw new TypeError(`Expected ${e}-bit integer, got ${r}`);return t},UV=(r,e)=>{switch(e){case 32:return Int32Array.of(r)[0];case 16:return Int16Array.of(r)[0];case 8:return Int8Array.of(r)[0]}},VV=r=>hA(typeof r=="string"?nm(r):r),zV=r=>CE(typeof r=="string"?nm(r):r),HV=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,nm=r=>{const e=r.match(HV);if(e===null||e[0].length!==r.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(r)},xg=r=>wE(typeof r=="string"?nm(r):r),jV=r=>xE(typeof r=="string"?nm(r):r),GV=r=>String(new TypeError(r).stack||r).split(`
2690
2690
  `).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
2691
- `),$V={warn:console.warn},qV=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],P1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function QV(r){const e=r.getUTCFullYear(),t=r.getUTCMonth(),n=r.getUTCDay(),i=r.getUTCDate(),a=r.getUTCHours(),s=r.getUTCMinutes(),o=r.getUTCSeconds(),l=i<10?`0${i}`:`${i}`,u=a<10?`0${a}`:`${a}`,c=s<10?`0${s}`:`${s}`,h=o<10?`0${o}`:`${o}`;return`${qV[n]}, ${l} ${P1[t]} ${e} ${u}:${c}:${h} GMT`}const WV=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),YV=r=>{if(r==null)return;if(typeof r!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");const e=WV.exec(r);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");const[t,n,i,a,s,o,l,u,c]=e,h=xg(Rd(n)),f=Ao(i,"month",1,12),d=Ao(a,"day",1,31),g=Kp(h,f,d,{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u});return c.toUpperCase()!="Z"&&g.setTime(g.getTime()-oz(c)),g},XV=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),JV=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),KV=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),DI=r=>{if(r==null)return;if(typeof r!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=XV.exec(r);if(e){const[t,n,i,a,s,o,l,u]=e;return Kp(xg(Rd(a)),Vv(i),Ao(n,"day",1,31),{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u})}if(e=JV.exec(r),e){const[t,n,i,a,s,o,l,u]=e;return rz(Kp(ez(a),Vv(i),Ao(n,"day",1,31),{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u}))}if(e=KV.exec(r),e){const[t,n,i,a,s,o,l,u]=e;return Kp(xg(Rd(u)),Vv(n),Ao(i.trimLeft(),"day",1,31),{hours:a,minutes:s,seconds:o,fractionalMilliseconds:l})}throw new TypeError("Invalid RFC-7231 date-time value")},ZV=r=>{if(r==null)return;let e;if(typeof r=="number")e=r;else if(typeof r=="string")e=VV(r);else if(typeof r=="object"&&r.tag===1)e=r.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},Kp=(r,e,t,n)=>{const i=e-1;return iz(r,i,t),new Date(Date.UTC(r,i,t,Ao(n.hours,"hour",0,23),Ao(n.minutes,"minute",0,59),Ao(n.seconds,"seconds",0,60),sz(n.fractionalMilliseconds)))},ez=r=>{const e=new Date().getUTCFullYear(),t=Math.floor(e/100)*100+xg(Rd(r));return t<e?t+100:t},tz=50*365*24*60*60*1e3,rz=r=>r.getTime()-new Date().getTime()>tz?new Date(Date.UTC(r.getUTCFullYear()-100,r.getUTCMonth(),r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds())):r,Vv=r=>{const e=P1.indexOf(r);if(e<0)throw new TypeError(`Invalid month: ${r}`);return e+1},nz=[31,28,31,30,31,30,31,31,30,31,30,31],iz=(r,e,t)=>{let n=nz[e];if(e===1&&az(r)&&(n=29),t>n)throw new TypeError(`Invalid day for ${P1[e]} in ${r}: ${t}`)},az=r=>r%4===0&&(r%100!==0||r%400===0),Ao=(r,e,t,n)=>{const i=jV(Rd(r));if(i<t||i>n)throw new TypeError(`${e} must be between ${t} and ${n}, inclusive`);return i},sz=r=>r==null?0:zV("0."+r)*1e3,oz=r=>{const e=r[0];let t=1;if(e=="+")t=1;else if(e=="-")t=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);const n=Number(r.substring(1,3)),i=Number(r.substring(4,6));return t*(n*60+i)*60*1e3},Rd=r=>{let e=0;for(;e<r.length-1&&r.charAt(e)==="0";)e++;return e===0?r:r.slice(e)},SE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ti=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0")),PI=()=>{if(SE)return SE();const r=new Uint8Array(16);return crypto.getRandomValues(r),r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ti[r[0]]+Ti[r[1]]+Ti[r[2]]+Ti[r[3]]+"-"+Ti[r[4]]+Ti[r[5]]+"-"+Ti[r[6]]+Ti[r[7]]+"-"+Ti[r[8]]+Ti[r[9]]+"-"+Ti[r[10]]+Ti[r[11]]+Ti[r[12]]+Ti[r[13]]+Ti[r[14]]+Ti[r[15]]},go=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};go.from=r=>r&&typeof r=="object"&&(r instanceof go||"deserializeJSON"in r)?r:typeof r=="string"||Object.getPrototypeOf(r)===String.prototype?go(String(r)):go(JSON.stringify(r));go.fromObject=go.from;const EE=/^-?\d*(\.\d+)?$/;class ts{string;type;constructor(e,t){if(this.string=e,this.type=t,!EE.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;const t=e;return ts.prototype.isPrototypeOf(e)||t.type==="bigDecimal"&&EE.test(t.string)}}class lz{serdeContext;setSerdeContext(e){this.serdeContext=e}}class uz extends lz{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=ra.for(e.defaultNamespace);for(const t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return aa}getResponseType(){return dc}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(const[n,i]of t.url.searchParams.entries())e.query[n]=i;if(t.headers)for(const[n,i]of Object.entries(t.headers))e.headers[n]=i.join(", ");return e}else{if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(const[n,i]of Object.entries(t.headers))e.headers[n]=i;return e}}setHostPrefix(e,t,n){if(this.serdeContext?.disableHostPrefix)return;const i=vi.of(t.input),a=Yf(t.traits??{});if(a.endpoint){let s=a.endpoint?.[0];if(typeof s=="string"){const o=[...i.structIterator()].filter(([,l])=>l.getMergedTraits().hostLabel);for(const[l]of o){const u=n[l];if(typeof u!="string")throw new Error(`@smithy/core/schema - ${l} in input must be a string as hostLabel.`);s=s.replace(`{${l}}`,u)}e.hostname=s+e.hostname}}}deserializeMetadata(e){return{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"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n})}async loadEventStreamCapability(){const{EventStreamSerde:e}=await Promise.resolve().then(()=>require("./index-BvxaWFsr.cjs"));return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,n,i,a){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class cz extends uz{async serializeRequest(e,t,n){const i=this.serializer,a={},s={},o=await n.endpoint(),l=vi.of(e?.input),u=l.getSchema();let c;const h=t&&typeof t=="object"?t:{},f=new aa({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:a,headers:s,body:void 0});if(o&&(this.updateServiceEndpoint(f,o),this.setHostPrefix(f,e,h)),h){const d=l.getEventStreamMember();if(d){if(h[d]){const g={};for(const[v,y]of l.structIterator())v!==d&&h[v]&&(i.write(y,h[v]),g[v]=i.flush());c=await this.serializeEventStream({eventStream:h[d],requestSchema:l,initialRequest:g})}}else i.write(u,h),c=i.flush()}return f.headers=Object.assign(f.headers,s),f.query=a,f.body=c,f.method="POST",f}async deserializeResponse(e,t,n){const i=this.deserializer,a=vi.of(e.output),s={};if(n.statusCode>=300){const l=await dA(n.body,t);throw l.byteLength>0&&Object.assign(s,await i.read(15,l)),await this.handleError(e,t,n,s,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(const l in n.headers){const u=n.headers[l];delete n.headers[l],n.headers[l.toLowerCase()]=u}const o=a.getEventStreamMember();if(o)s[o]=await this.deserializeEventStream({response:n,responseSchema:a,initialResponseContainer:s});else{const l=await dA(n.body,t);l.byteLength>0&&Object.assign(s,await i.read(a,l))}return s.$metadata=this.deserializeMetadata(n),s}}function RI(r,e){if(e.timestampFormat.useTrait&&r.isTimestampSchema()&&(r.getSchema()===5||r.getSchema()===6||r.getSchema()===7))return r.getSchema();const{httpLabel:t,httpPrefixHeaders:n,httpHeader:i,httpQuery:a}=r.getMergedTraits();return(e.httpBindings?typeof n=="string"||i?6:a||t?5:void 0:void 0)??e.timestampFormat.default}function fz(r,e,t){r.__smithy_context?r.__smithy_context.features||(r.__smithy_context.features={}):r.__smithy_context={features:{}},r.__smithy_context.features[e]=t}class dz{authSchemes=new Map;constructor(e){for(const[t,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(t,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}class hz{async sign(e,t,n){return e}}const pz=r=>function(t){return OI(t)&&t.expiration.getTime()-Date.now()<r},gz=3e5,mz=pz(gz),OI=r=>r.expiration!==void 0,vz=(r,e,t)=>{if(r===void 0)return;const n=typeof r!="function"?async()=>Promise.resolve(r):r;let i,a,s,o=!1;const l=async u=>{a||(a=n(u));try{i=await a,s=!0,o=!1}finally{a=void 0}return i};return e===void 0?async u=>((!s||u?.forceRefresh)&&(i=await l(u)),i):async u=>((!s||u?.forceRefresh)&&(i=await l(u)),o?i:t(i)?(e(i)&&await l(u),i):(o=!0,i))},yz=void 0;function Az(r){return r===void 0?!0:typeof r=="string"&&r.length<=50}function bz(r){const e=sd(r.userAgentAppId??yz),{customUserAgent:t}=r;return Object.assign(r,{customUserAgent:typeof t=="string"?[[t]]:t,userAgentAppId:async()=>{const n=await e();if(!Az(n)){const i=r.logger?.constructor?.name==="NoOpLogger"||!r.logger?console:r.logger;typeof n!="string"?i?.warn("userAgentAppId must be a string or undefined."):n.length>50&&i?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return n}})}class Cz{capacity;data=new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const n=this.hash(e);if(n===!1)return t();if(!this.data.has(n)){if(this.data.size>this.capacity+10){const i=this.data.keys();let a=0;for(;;){const{value:s,done:o}=i.next();if(this.data.delete(s),o||++a>10)break}}this.data.set(n,t())}return this.data.get(n)}size(){return this.data.size}hash(e){let t="";const{parameters:n}=this;if(n.length===0)return!1;for(const i of n){const a=String(e[i]??"");if(a.includes("|;"))return!1;t+=a+"|;"}return t}}const wz=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}$"),BI=r=>wz.test(r)||r.startsWith("[")&&r.endsWith("]"),xz=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),im=(r,e=!1)=>{if(!e)return xz.test(r);const t=r.split(".");for(const n of t)if(!im(n))return!1;return!0},Sg={},Od="endpoints";function Do(r){return typeof r!="object"||r==null?r:"ref"in r?`$${Do(r.ref)}`:"fn"in r?`${r.fn}(${(r.argv||[]).map(Do).join(", ")})`:JSON.stringify(r,null,2)}class sa extends Error{constructor(e){super(e),this.name="EndpointError"}}const Sz=(r,e)=>r===e,Ez=r=>{const e=r.split("."),t=[];for(const n of e){const i=n.indexOf("[");if(i!==-1){if(n.indexOf("]")!==n.length-1)throw new sa(`Path: '${r}' does not end with ']'`);const a=n.slice(i+1,-1);if(Number.isNaN(parseInt(a)))throw new sa(`Invalid array index: '${a}' in path: '${r}'`);i!==0&&t.push(n.slice(0,i)),t.push(a)}else t.push(n)}return t},MI=(r,e)=>Ez(e).reduce((t,n)=>{if(typeof t!="object")throw new sa(`Index '${n}' in '${e}' not found in '${JSON.stringify(r)}'`);return Array.isArray(t)?t[parseInt(n)]:t[n]},r),kz=r=>r!=null,Fz=r=>!r,zv={[Id.HTTP]:80,[Id.HTTPS]:443},Tz=r=>{const e=(()=>{try{if(r instanceof URL)return r;if(typeof r=="object"&&"hostname"in r){const{hostname:f,port:d,protocol:g="",path:v="",query:y={}}=r,A=new URL(`${g}//${f}${d?`:${d}`:""}${v}`);return A.search=Object.entries(y).map(([w,k])=>`${w}=${k}`).join("&"),A}return new URL(r)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(r)} as a whatwg URL.`),null;const t=e.href,{host:n,hostname:i,pathname:a,protocol:s,search:o}=e;if(o)return null;const l=s.slice(0,-1);if(!Object.values(Id).includes(l))return null;const u=BI(i),c=t.includes(`${n}:${zv[l]}`)||typeof r=="string"&&r.includes(`${n}:${zv[l]}`),h=`${n}${c?`:${zv[l]}`:""}`;return{scheme:l,authority:h,path:a,normalizedPath:a.endsWith("/")?a:`${a}/`,isIp:u}},Iz=(r,e)=>r===e,Dz=(r,e,t,n)=>e>=t||r.length<t||/[^\u0000-\u007f]/.test(r)?null:n?r.substring(r.length-t,r.length-e):r.substring(e,t),Pz=r=>encodeURIComponent(r).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Rz={booleanEquals:Sz,getAttr:MI,isSet:kz,isValidHostLabel:im,not:Fz,parseURL:Tz,stringEquals:Iz,substring:Dz,uriEncode:Pz},_I=(r,e)=>{const t=[],n={...e.endpointParams,...e.referenceRecord};let i=0;for(;i<r.length;){const a=r.indexOf("{",i);if(a===-1){t.push(r.slice(i));break}t.push(r.slice(i,a));const s=r.indexOf("}",a);if(s===-1){t.push(r.slice(a));break}r[a+1]==="{"&&r[s+1]==="}"&&(t.push(r.slice(a+1,s)),i=s+2);const o=r.substring(a+1,s);if(o.includes("#")){const[l,u]=o.split("#");t.push(MI(n[l],u))}else t.push(n[o]);i=s+1}return t.join("")},Oz=({ref:r},e)=>({...e.endpointParams,...e.referenceRecord})[r],am=(r,e,t)=>{if(typeof r=="string")return _I(r,t);if(r.fn)return LI.callFunction(r,t);if(r.ref)return Oz(r,t);throw new sa(`'${e}': ${String(r)} is not a string, function or reference.`)},NI=({fn:r,argv:e},t)=>{const n=e.map(a=>["boolean","number"].includes(typeof a)?a:LI.evaluateExpression(a,"arg",t)),i=r.split(".");return i[0]in Sg&&i[1]!=null?Sg[i[0]][i[1]](...n):Rz[r](...n)},LI={evaluateExpression:am,callFunction:NI},Bz=({assign:r,...e},t)=>{if(r&&r in t.referenceRecord)throw new sa(`'${r}' is already defined in Reference Record.`);const n=NI(e,t);return t.logger?.debug?.(`${Od} evaluateCondition: ${Do(e)} = ${Do(n)}`),{result:n===""?!0:!!n,...r!=null&&{toAssign:{name:r,value:n}}}},R1=(r=[],e)=>{const t={};for(const n of r){const{result:i,toAssign:a}=Bz(n,{...e,referenceRecord:{...e.referenceRecord,...t}});if(!i)return{result:i};a&&(t[a.name]=a.value,e.logger?.debug?.(`${Od} assign: ${a.name} := ${Do(a.value)}`))}return{result:!0,referenceRecord:t}},Mz=(r,e)=>Object.entries(r).reduce((t,[n,i])=>({...t,[n]:i.map(a=>{const s=am(a,"Header value entry",e);if(typeof s!="string")throw new sa(`Header '${n}' value '${s}' is not a string`);return s})}),{}),UI=(r,e)=>Object.entries(r).reduce((t,[n,i])=>({...t,[n]:zI.getEndpointProperty(i,e)}),{}),VI=(r,e)=>{if(Array.isArray(r))return r.map(t=>VI(t,e));switch(typeof r){case"string":return _I(r,e);case"object":if(r===null)throw new sa(`Unexpected endpoint property: ${r}`);return zI.getEndpointProperties(r,e);case"boolean":return r;default:throw new sa(`Unexpected endpoint property type: ${typeof r}`)}},zI={getEndpointProperty:VI,getEndpointProperties:UI},_z=(r,e)=>{const t=am(r,"Endpoint URL",e);if(typeof t=="string")try{return new URL(t)}catch(n){throw console.error(`Failed to construct URL with ${t}`,n),n}throw new sa(`Endpoint URL must be a string, got ${typeof t}`)},Nz=(r,e)=>{const{conditions:t,endpoint:n}=r,{result:i,referenceRecord:a}=R1(t,e);if(!i)return;const s={...e,referenceRecord:{...e.referenceRecord,...a}},{url:o,properties:l,headers:u}=n;return e.logger?.debug?.(`${Od} Resolving endpoint from template: ${Do(n)}`),{...u!=null&&{headers:Mz(u,s)},...l!=null&&{properties:UI(l,s)},url:_z(o,s)}},Lz=(r,e)=>{const{conditions:t,error:n}=r,{result:i,referenceRecord:a}=R1(t,e);if(i)throw new sa(am(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...a}}))},HI=(r,e)=>{for(const t of r)if(t.type==="endpoint"){const n=Nz(t,e);if(n)return n}else if(t.type==="error")Lz(t,e);else if(t.type==="tree"){const n=jI.evaluateTreeRule(t,e);if(n)return n}else throw new sa(`Unknown endpoint rule: ${t}`);throw new sa("Rules evaluation failed")},Uz=(r,e)=>{const{conditions:t,rules:n}=r,{result:i,referenceRecord:a}=R1(t,e);if(i)return jI.evaluateRules(n,{...e,referenceRecord:{...e.referenceRecord,...a}})},jI={evaluateRules:HI,evaluateTreeRule:Uz},Vz=(r,e)=>{const{endpointParams:t,logger:n}=e,{parameters:i,rules:a}=r;e.logger?.debug?.(`${Od} Initial EndpointParams: ${Do(t)}`);const s=Object.entries(i).filter(([,u])=>u.default!=null).map(([u,c])=>[u,c.default]);if(s.length>0)for(const[u,c]of s)t[u]=t[u]??c;const o=Object.entries(i).filter(([,u])=>u.required).map(([u])=>u);for(const u of o)if(t[u]==null)throw new sa(`Missing required parameter: '${u}'`);const l=HI(a,{endpointParams:t,logger:n,referenceRecord:{}});return e.logger?.debug?.(`${Od} Resolved endpoint: ${Do(l)}`),l},GI=(r,e=!1)=>{if(e){for(const t of r.split("."))if(!GI(t))return!1;return!0}return!(!im(r)||r.length<3||r.length>63||r!==r.toLowerCase()||BI(r))},kE=":",zz="/",Hz=r=>{const e=r.split(kE);if(e.length<6)return null;const[t,n,i,a,s,...o]=e;if(t!=="arn"||n===""||i===""||o.join(kE)==="")return null;const l=o.map(u=>u.split(zz)).flat();return{partition:n,service:i,region:a,accountId:s,resourceId:l}},jz=[{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",supportsDualStack:!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:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,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:!0,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)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,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:!0,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)"}}}],Gz={partitions:jz};let $z=Gz;const qz=r=>{const{partitions:e}=$z;for(const n of e){const{regions:i,outputs:a}=n;for(const[s,o]of Object.entries(i))if(s===r)return{...a,...o}}for(const n of e){const{regionRegex:i,outputs:a}=n;if(new RegExp(i).test(r))return{...a}}const t=e.find(n=>n.id==="aws");if(!t)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...t.outputs}},$I={isVirtualHostableS3Bucket:GI,parseArn:Hz,partition:qz};Sg.aws=$I;function Qz(r,e,t){return r.$source||(r.$source={}),r.$source[e]=t,r}function Fs(r,e,t){r.__aws_sdk_context?r.__aws_sdk_context.features||(r.__aws_sdk_context.features={}):r.__aws_sdk_context={features:{}},r.__aws_sdk_context.features[e]=t}var Po;(function(r){r.STANDARD="standard",r.ADAPTIVE="adaptive"})(Po||(Po={}));const ld=3,Wz=Po.STANDARD,Yz=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Xz=["TimeoutError","RequestTimeout","RequestTimeoutException"],Jz=[500,502,503,504],Kz=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],Zz=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],eH=r=>r?.$retryable!==void 0,tH=r=>r.$metadata?.clockSkewCorrected,rH=r=>{const e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return r&&r instanceof TypeError?e.has(r.message):!1},qI=r=>r.$metadata?.httpStatusCode===429||Yz.includes(r.name)||r.$retryable?.throttling==!0,O1=(r,e=0)=>eH(r)||tH(r)||Xz.includes(r.name)||Kz.includes(r?.code||"")||Zz.includes(r?.code||"")||Jz.includes(r.$metadata?.httpStatusCode||0)||rH(r)||r.cause!==void 0&&e<=10&&O1(r.cause,e+1),nH=r=>{if(r.$metadata?.httpStatusCode!==void 0){const e=r.$metadata.httpStatusCode;return 500<=e&&e<=599&&!O1(r)}return!1};class B1{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let t;this.updateMeasuredRate();const n=e;if(n?.errorType==="THROTTLING"||qI(n?.error??e)){const s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const a=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(a)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.availableTokens){const t=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(n=>B1.setTimeoutFn(n,t))}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){const n=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const QI=20*1e3,FE=500,iH=1,aH="amz-sdk-invocation-id",sH="amz-sdk-request";class Ui{static v2026=typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return Ui.v2026?50:100}static throttlingDelay(){return Ui.v2026?1e3:500}static cost(){return Ui.v2026?14:5}static throttlingCost(){return Ui.v2026?5:10}static modifiedCostType(){return Ui.v2026?"THROTTLING":"TRANSIENT"}}class oH{x=Ui.delay();computeNextBackoffDelay(e){const i=Math.random()*Math.min(this.x*2**e,QI);return Math.floor(i)}setDelayBase(e){this.x=e}}class TE{delay;count;cost;longPoll;constructor(e,t,n,i){this.delay=e,this.count=t,this.cost=n,this.longPoll=i}getRetryCount(){return this.count}getRetryDelay(){return Math.min(QI,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}class pA{mode=Po.STANDARD;capacity=FE;retryBackoffStrategy;maxAttemptsProvider;baseDelay;constructor(e){typeof e=="number"?this.maxAttemptsProvider=async()=>e:typeof e=="function"?this.maxAttemptsProvider=e:e&&typeof e=="object"&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>ld,this.baseDelay??=Ui.delay(),this.retryBackoffStrategy??=new oH}async acquireInitialRetryToken(e){return new TE(Ui.delay(),0,void 0,Ui.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts(),i=this.shouldRetry(e,t,n);if(i||e.isLongPoll?.()){const a=t.errorType;this.retryBackoffStrategy.setDelayBase(a==="THROTTLING"?Ui.throttlingDelay():this.baseDelay);const s=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());let o=s;if(t.retryAfterHint instanceof Date&&(o=Math.max(s,Math.min(t.retryAfterHint.getTime()-Date.now(),s+5e3))),i){const l=this.getCapacityCost(a);return this.capacity-=l,new TE(o,e.getRetryCount()+1,l,e.isLongPoll?.()??!1)}else throw Object.assign(new Error("No retry token available"),{$backoff:Ui.v2026?o:0})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(FE,this.capacity+(e.getRetryCost()??iH))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${ld}`),ld}}shouldRetry(e,t,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return e===Ui.modifiedCostType()?Ui.throttlingCost():Ui.cost()}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class lH{mode=Po.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,t){const{rateLimiter:n}=t??{};this.rateLimiter=n??new B1,this.standardRetryStrategy=t?new pA({maxAttempts:typeof e=="number"?e:3,...t}):new pA(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}const uH=/\d{12}\.ddb/;async function cH(r,e,t){if(t.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&Fs(r,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){const a=await e.retryStrategy();if(typeof a.mode=="string")switch(a.mode){case Po.ADAPTIVE:Fs(r,"RETRY_MODE_ADAPTIVE","F");break;case Po.STANDARD:Fs(r,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){const a=r.endpointV2;switch(String(a?.url?.hostname).match(uH)&&Fs(r,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":Fs(r,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":Fs(r,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":Fs(r,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const i=r.__smithy_context?.selectedHttpAuthScheme?.identity;if(i?.$source){const a=i;a.accountId&&Fs(r,"RESOLVED_ACCOUNT_ID","T");for(const[s,o]of Object.entries(a.$source??{}))Fs(r,s,o)}}const IE="user-agent",Hv="x-amz-user-agent",DE=" ",jv="/",fH=/[^!$%&'*+\-.^_`|~\w]/g,dH=/[^!$%&'*+\-.^_`|~\w#]/g,PE="-",hH=1024;function pH(r){let e="";for(const t in r){const n=r[t];if(e.length+n.length+1<=hH){e.length?e+=","+n:e+=n;continue}break}return e}const gH=r=>(e,t)=>async n=>{const{request:i}=n;if(!aa.isInstance(i))return e(n);const{headers:a}=i,s=t?.userAgent?.map(Rp)||[],o=(await r.defaultUserAgentProvider()).map(Rp);await cH(t,r,n);const l=t;o.push(`m/${pH(Object.assign({},t.__smithy_context?.features,l.__aws_sdk_context?.features))}`);const u=r?.customUserAgent?.map(Rp)||[],c=await r.userAgentAppId();c&&o.push(Rp(["app",`${c}`]));const h=[].concat([...o,...s,...u]).join(DE),f=[...o.filter(d=>d.startsWith("aws-sdk-")),...u].join(DE);return r.runtime!=="browser"?(f&&(a[Hv]=a[Hv]?`${a[IE]} ${f}`:f),a[IE]=h):a[Hv]=h,e({...n,request:i})},Rp=r=>{const e=r[0].split(jv).map(s=>s.replace(fH,PE)).join(jv),t=r[1]?.replace(dH,PE),n=e.indexOf(jv),i=e.substring(0,n);let a=e.substring(n+1);return i==="api"&&(a=a.toLowerCase()),[i,a,t].filter(s=>s&&s.length>0).reduce((s,o,l)=>{switch(l){case 0:return o;case 1:return`${s}/${o}`;default:return`${s}#${o}`}},"")},mH={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},vH=r=>({applyToStack:e=>{e.add(gH(r),mH)}}),yH=!1,AH=!1,RE=new Set,bH=(r,e=im)=>{if(!RE.has(r)&&!e(r))if(r==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${r}" is not a valid hostname component.`);else RE.add(r)},WI=r=>typeof r=="string"&&(r.startsWith("fips-")||r.endsWith("-fips")),CH=r=>WI(r)?["fips-aws-global","aws-fips"].includes(r)?"us-east-1":r.replace(/fips-(dkr-|prod-)?|-fips/,""):r,wH=r=>{const{region:e,useFipsEndpoint:t}=r;if(!e)throw new Error("Region is missing");return Object.assign(r,{region:async()=>{const n=typeof e=="function"?await e():e,i=CH(n);return bH(i),i},useFipsEndpoint:async()=>{const n=typeof e=="string"?e:await e();return WI(n)?!0:typeof t!="function"?Promise.resolve(!!t):t()}})},OE="content-length";function xH(r){return e=>async t=>{const n=t.request;if(aa.isInstance(n)){const{body:i,headers:a}=n;if(i&&Object.keys(a).map(s=>s.toLowerCase()).indexOf(OE)===-1)try{const s=r(i);n.headers={...n.headers,[OE]:String(s)}}catch{}}return e({...t,request:n})}}const SH={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},EH=r=>({applyToStack:e=>{e.add(xH(r.bodyLengthChecker),SH)}}),kH=async r=>{const e=r?.Bucket||"";if(typeof r.Bucket=="string"&&(r.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),PH(e)){if(r.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!DH(e)||e.indexOf(".")!==-1&&!String(r.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(r.ForcePathStyle=!0);return r.DisableMultiRegionAccessPoints&&(r.disableMultiRegionAccessPoints=!0,r.DisableMRAP=!0),r},FH=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,TH=/(\d+\.){3}\d+/,IH=/\.\./,DH=r=>FH.test(r)&&!TH.test(r)&&!IH.test(r),PH=r=>{const[e,t,n,,,i]=r.split(":"),a=e==="arn"&&r.split(":").length>=6,s=!!(a&&t&&n&&i);if(a&&!s)throw new Error(`Invalid ARN: ${r} was an invalid ARN.`);return s},RH=(r,e,t,n=!1)=>{const i=async()=>{let a;return n?a=t.clientContextParams?.[r]??t[r]??t[e]:a=t[r]??t[e],typeof a=="function"?a():a};return r==="credentialScope"||e==="CredentialScope"?async()=>{const a=typeof t.credentials=="function"?await t.credentials():t.credentials;return a?.credentialScope??a?.CredentialScope}:r==="accountId"||e==="AccountId"?async()=>{const a=typeof t.credentials=="function"?await t.credentials():t.credentials;return a?.accountId??a?.AccountId}:r==="endpoint"||e==="endpoint"?async()=>{if(t.isCustomEndpoint===!1)return;const a=await i();if(a&&typeof a=="object"){if("url"in a)return a.url.href;if("hostname"in a){const{protocol:s,hostname:o,port:l,path:u}=a;return`${s}//${o}${l?":"+l:""}${u}`}}return a}:i},YI=async r=>{},XI=r=>{if(typeof r=="object"){if("url"in r){const e=hc(r.url);if(r.headers){e.headers={};for(const[t,n]of Object.entries(r.headers))e.headers[t.toLowerCase()]=n.join(", ")}return e}return r}return hc(r)},OH=async(r,e,t,n)=>{if(!t.isCustomEndpoint){let s;t.serviceConfiguredEndpoint?s=await t.serviceConfiguredEndpoint():s=await YI(t.serviceId),s&&(t.endpoint=()=>Promise.resolve(XI(s)),t.isCustomEndpoint=!0)}const i=await BH(r,e,t);if(typeof t.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");const a=t.endpointProvider(i,n);if(t.isCustomEndpoint&&t.endpoint){const s=await t.endpoint();if(s?.headers){a.headers??={};for(const[o,l]of Object.entries(s.headers))a.headers[o]=Array.isArray(l)?l:[l]}}return a},BH=async(r,e,t)=>{const n={},i=e?.getEndpointParameterInstructions?.()||{};for(const[a,s]of Object.entries(i))switch(s.type){case"staticContextParams":n[a]=s.value;break;case"contextParams":n[a]=r[s.name];break;case"clientContextParams":case"builtInParams":n[a]=await RH(s.name,a,t,s.type!=="builtInParams")();break;case"operationContextParams":n[a]=s.get(r);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return Object.keys(i).length===0&&Object.assign(n,t),String(t.serviceId).toLowerCase()==="s3"&&await kH(n),n},MH=({config:r,instructions:e})=>(t,n)=>async i=>{r.isCustomEndpoint&&fz(n,"ENDPOINT_OVERRIDE","N");const a=await OH(i.input,{getEndpointParameterInstructions(){return e}},{...r},n);n.endpointV2=a,n.authSchemes=a.properties?.authSchemes;const s=n.authSchemes?.[0];if(s){n.signing_region=s.signingRegion,n.signing_service=s.signingName;const l=xc(n)?.selectedHttpAuthScheme?.httpAuthOption;l&&(l.signingProperties=Object.assign(l.signingProperties||{},{signing_region:s.signingRegion,signingRegion:s.signingRegion,signing_service:s.signingName,signingName:s.signingName,signingRegionSet:s.signingRegionSet},s.properties))}return t({...i})},_H={name:"serializerMiddleware"},NH={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:_H.name},JI=(r,e)=>({applyToStack:t=>{t.addRelativeTo(MH({config:r,instructions:e}),NH)}}),LH=r=>{const e=r.tls??!0,{endpoint:t,useDualstackEndpoint:n,useFipsEndpoint:i}=r,a=t!=null?async()=>XI(await Ls(t)()):void 0,o=Object.assign(r,{endpoint:a,tls:e,isCustomEndpoint:!!t,useDualstackEndpoint:Ls(n??!1),useFipsEndpoint:Ls(i??!1)});let l;return o.serviceConfiguredEndpoint=async()=>(r.serviceId&&!l&&(l=YI(r.serviceId)),l),o},UH=r=>r instanceof Error?r:r instanceof Object?Object.assign(new Error,r):typeof r=="string"?new Error(r):new Error(`AWS SDK error wrapper for ${r}`),VH=r=>{const{retryStrategy:e,retryMode:t}=r,n=Ls(r.maxAttempts??ld);let i=e?Promise.resolve(e):void 0;const a=async()=>await Ls(t)()===Po.ADAPTIVE?new lH(n):new pA(n);return Object.assign(r,{maxAttempts:n,retryStrategy:()=>i??=a()})},pl=(r,e)=>{const t=[];if(r&&t.push(r),e)for(const n of e)t.push(n);return t},io=(r,e)=>`${r||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,Eg=()=>{let r=[],e=[],t=!1;const n=new Set,i=h=>h.sort((f,d)=>BE[d.step]-BE[f.step]||ME[d.priority||"normal"]-ME[f.priority||"normal"]),a=h=>{let f=!1;const d=g=>{const v=pl(g.name,g.aliases);if(v.includes(h)){f=!0;for(const y of v)n.delete(y);return!1}return!0};return r=r.filter(d),e=e.filter(d),f},s=h=>{let f=!1;const d=g=>{if(g.middleware===h){f=!0;for(const v of pl(g.name,g.aliases))n.delete(v);return!1}return!0};return r=r.filter(d),e=e.filter(d),f},o=h=>(r.forEach(f=>{h.add(f.middleware,{...f})}),e.forEach(f=>{h.addRelativeTo(f.middleware,{...f})}),h.identifyOnResolve?.(c.identifyOnResolve()),h),l=h=>{const f=[];return h.before.forEach(d=>{d.before.length===0&&d.after.length===0?f.push(d):f.push(...l(d))}),f.push(h),h.after.reverse().forEach(d=>{d.before.length===0&&d.after.length===0?f.push(d):f.push(...l(d))}),f},u=(h=!1)=>{const f=[],d=[],g={};return r.forEach(y=>{const A={...y,before:[],after:[]};for(const w of pl(A.name,A.aliases))g[w]=A;f.push(A)}),e.forEach(y=>{const A={...y,before:[],after:[]};for(const w of pl(A.name,A.aliases))g[w]=A;d.push(A)}),d.forEach(y=>{if(y.toMiddleware){const A=g[y.toMiddleware];if(A===void 0){if(h)return;throw new Error(`${y.toMiddleware} is not found when adding ${io(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}y.relation==="after"&&A.after.push(y),y.relation==="before"&&A.before.push(y)}}),i(f).map(l).reduce((y,A)=>(y.push(...A),y),[])},c={add:(h,f={})=>{const{name:d,override:g,aliases:v}=f,y={step:"initialize",priority:"normal",middleware:h,...f},A=pl(d,v);if(A.length>0){if(A.some(w=>n.has(w))){if(!g)throw new Error(`Duplicate middleware name '${io(d,v)}'`);for(const w of A){const k=r.findIndex(S=>S.name===w||S.aliases?.some(R=>R===w));if(k===-1)continue;const T=r[k];if(T.step!==y.step||y.priority!==T.priority)throw new Error(`"${io(T.name,T.aliases)}" middleware with ${T.priority} priority in ${T.step} step cannot be overridden by "${io(d,v)}" middleware with ${y.priority} priority in ${y.step} step.`);r.splice(k,1)}}for(const w of A)n.add(w)}r.push(y)},addRelativeTo:(h,f)=>{const{name:d,override:g,aliases:v}=f,y={middleware:h,...f},A=pl(d,v);if(A.length>0){if(A.some(w=>n.has(w))){if(!g)throw new Error(`Duplicate middleware name '${io(d,v)}'`);for(const w of A){const k=e.findIndex(S=>S.name===w||S.aliases?.some(R=>R===w));if(k===-1)continue;const T=e[k];if(T.toMiddleware!==y.toMiddleware||T.relation!==y.relation)throw new Error(`"${io(T.name,T.aliases)}" middleware ${T.relation} "${T.toMiddleware}" middleware cannot be overridden by "${io(d,v)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);e.splice(k,1)}}for(const w of A)n.add(w)}e.push(y)},clone:()=>o(Eg()),use:h=>{h.applyToStack(c)},remove:h=>typeof h=="string"?a(h):s(h),removeByTag:h=>{let f=!1;const d=g=>{const{tags:v,name:y,aliases:A}=g;if(v&&v.includes(h)){const w=pl(y,A);for(const k of w)n.delete(k);return f=!0,!1}return!0};return r=r.filter(d),e=e.filter(d),f},concat:h=>{const f=o(Eg());return f.use(h),f.identifyOnResolve(t||f.identifyOnResolve()||(h.identifyOnResolve?.()??!1)),f},applyToStack:o,identify:()=>u(!0).map(h=>{const f=h.step??h.relation+" "+h.toMiddleware;return io(h.name,h.aliases)+" - "+f}),identifyOnResolve(h){return typeof h=="boolean"&&(t=h),t},resolve:(h,f)=>{for(const d of u().map(g=>g.middleware).reverse())h=d(h,f);return t&&console.log(c.identify()),h}};return c},BE={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},ME={high:3,normal:2,low:1};class zH{config;middlewareStack=Eg();initConfig;handlers;constructor(e){this.config=e;const{protocol:t,protocolSettings:n}=e;n&&typeof t=="function"&&(e.protocol=new t(n))}send(e,t,n){const i=typeof t!="function"?t:void 0,a=typeof t=="function"?t:n,s=i===void 0&&this.config.cacheMiddleware===!0;let o;if(s){this.handlers||(this.handlers=new WeakMap);const l=this.handlers;l.has(e.constructor)?o=l.get(e.constructor):(o=e.resolveMiddleware(this.middlewareStack,this.config,i),l.set(e.constructor,o))}else delete this.handlers,o=e.resolveMiddleware(this.middlewareStack,this.config,i);if(a)o(e).then(l=>a(null,l.output),l=>a(l)).catch(()=>{});else return o(e).then(l=>l.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const Gv="***SensitiveInformation***";function gA(r,e){if(e==null)return e;const t=vi.of(r);if(t.getMergedTraits().sensitive)return Gv;if(t.isListSchema()){if(!!t.getValueSchema().getMergedTraits().sensitive)return Gv}else if(t.isMapSchema()){if(!!t.getKeySchema().getMergedTraits().sensitive||!!t.getValueSchema().getMergedTraits().sensitive)return Gv}else if(t.isStructSchema()&&typeof e=="object"){const n=e,i={};for(const[a,s]of t.structIterator())n[a]!=null&&(i[a]=gA(s,n[a]));return i}return e}class M1{middlewareStack=Eg();schema;static classBuilder(){return new HH}resolveMiddlewareWithContext(e,t,n,{middlewareFn:i,clientName:a,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,smithyContext:u,additionalContext:c,CommandCtor:h}){for(const y of i.bind(this)(h,e,t,n))this.middlewareStack.use(y);const f=e.concat(this.middlewareStack),{logger:d}=t,g={logger:d,clientName:a,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,[cA]:{commandInstance:this,...u},...c},{requestHandler:v}=t;return f.resolve(y=>v.handle(y.request,n||{}),g)}}class HH{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=n=>n,t=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends M1{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.input=n??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(n,i,a){const s=e._operationSchema,o=s?.[4]??s?.input,l=s?.[5]??s?.output;return this.resolveMiddlewareWithContext(n,i,a,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(s?gA.bind(null,o):u=>u),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(s?gA.bind(null,l):u=>u),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}class Hu extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;const t=e;return Hu.prototype.isPrototypeOf(t)||!!t.$fault&&!!t.$metadata&&(t.$fault==="client"||t.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;const t=e;return this===Hu?Hu.isInstance(e):Hu.isInstance(e)?t.name&&this.name?this.prototype.isPrototypeOf(e)||t.name===this.name:this.prototype.isPrototypeOf(e):!1}}const _E=(r,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,i])=>{(r[n]==null||r[n]==="")&&(r[n]=i)});const t=r.message||r.Message||"UnknownError";return r.message=t,delete r.Message,r},jH=r=>{switch(r){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{}}},KI=Object.values(Dd),GH=r=>{const e=[];for(const t in Dd){const n=Dd[t];r[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>r[n]})}for(const[t,n]of Object.entries(r.checksumAlgorithms??{}))e.push({algorithmId:()=>t,checksumConstructor:()=>n});return{addChecksumAlgorithm(t){r.checksumAlgorithms=r.checksumAlgorithms??{};const n=t.algorithmId(),i=t.checksumConstructor();KI.includes(n)?r.checksumAlgorithms[n.toUpperCase()]=i:r.checksumAlgorithms[n]=i,e.push(t)},checksumAlgorithms(){return e}}},$H=r=>{const e={};return r.checksumAlgorithms().forEach(t=>{const n=t.algorithmId();KI.includes(n)&&(e[n]=t.checksumConstructor())}),e},qH=r=>({setRetryStrategy(e){r.retryStrategy=e},retryStrategy(){return r.retryStrategy}}),QH=r=>{const e={};return e.retryStrategy=r.retryStrategy(),e},WH=r=>Object.assign(GH(r),qH(r)),YH=r=>Object.assign($H(r),QH(r));class ZI{trace(){}debug(){}info(){}warn(){}error(){}}const XH=r=>r?.body instanceof ReadableStream;function JH(r,e){if(dc.isInstance(r))for(const t of Object.keys(r.headers)){const n=t.toLowerCase();if(n==="retry-after"){const i=r.headers[t];let a=NaN;if(i.endsWith("GMT"))try{a=(DI(i).getTime()-Date.now())/1e3}catch(s){e?.trace?.("Failed to parse retry-after header"),e?.trace?.(s)}else i.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?a=Number(i.match(/ GMT, ([\d.]+)$/)?.[1]):i.match(/^((\d+)|(\d+\.\d+))$/)?a=Number(i):Date.parse(i)>=Date.now()&&(a=(Date.parse(i)-Date.now())/1e3);return isNaN(a)?void 0:new Date(Date.now()+a*1e3)}else if(n==="x-amz-retry-after"){const i=r.headers[t],a=Number(i);if(isNaN(a)){e?.trace?.(`Failed to parse x-amz-retry-after=${i}`);return}return new Date(Date.now()+a)}}}const KH=r=>(e,t)=>async n=>{let i=await r.retryStrategy();const a=await r.maxAttempts();if(ZH(i)){i=i;let s=await i.acquireInitialRetryToken((t.partition_id??"")+(t.__retryLongPoll?":longpoll":"")),o=new Error,l=0,u=0;const{request:c}=n,h=aa.isInstance(c);for(h&&(c.headers[aH]=PI());;)try{h&&(c.headers[sH]=`attempt=${l+1}; max=${a}`);const{response:f,output:d}=await e(n);return i.recordSuccess(s),d.$metadata.attempts=l+1,d.$metadata.totalRetryDelay=u,{response:f,output:d}}catch(f){const d=ej(f,r.logger);if(o=UH(f),h&&XH(c))throw(t.logger instanceof ZI?console:t.logger)?.warn("An error was encountered in a non-retryable streaming request."),o;try{s=await i.refreshRetryTokenForRetry(s,d)}catch(v){throw typeof v.$backoff=="number"&&await NE(v.$backoff),o.$metadata||(o.$metadata={}),o.$metadata.attempts=l+1,o.$metadata.totalRetryDelay=u,o}l=s.getRetryCount();const g=s.getRetryDelay();u+=g,await NE(g)}}else return i=i,i?.mode&&(t.userAgent=[...t.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(e,n)},NE=r=>new Promise(e=>setTimeout(e,r)),ZH=r=>typeof r.acquireInitialRetryToken<"u"&&typeof r.refreshRetryTokenForRetry<"u"&&typeof r.recordSuccess<"u",ej=(r,e)=>{const t={error:r,errorType:tj(r)},n=JH(r.$response,e);return n&&(t.retryAfterHint=n),t},tj=r=>qI(r)?"THROTTLING":O1(r)?"TRANSIENT":nH(r)?"SERVER_ERROR":"CLIENT_ERROR",rj={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},nj=r=>({applyToStack:e=>{e.add(KH(r),rj)}}),LE=r=>dc.isInstance(r)?r.headers?.date??r.headers?.Date:void 0,eD=r=>new Date(Date.now()+r),ij=(r,e)=>Math.abs(eD(e).getTime()-r)>=3e5,UE=(r,e)=>{const t=Date.parse(r);return ij(t,e)?t-Date.now():e},ud=(r,e)=>{if(!e)throw new Error(`Property \`${r}\` is not resolved for AWS SDK SigV4Auth`);return e},aj=async r=>{const e=ud("context",r.context),t=ud("config",r.config),n=e.endpointV2?.properties?.authSchemes?.[0],a=await ud("signer",t.signer)(n),s=r?.signingRegion,o=r?.signingRegionSet,l=r?.signingName;return{config:t,signer:a,signingRegion:s,signingRegionSet:o,signingName:l}};class sj{async sign(e,t,n){if(!aa.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const i=await aj(n),{config:a,signer:s}=i;let{signingRegion:o,signingName:l}=i;const u=n.context;if(u?.authSchemes?.length??!1){const[h,f]=u.authSchemes;h?.name==="sigv4a"&&f?.name==="sigv4"&&(o=f?.signingRegion??o,l=f?.signingName??l)}return await s.sign(e,{signingDate:eD(a.systemClockOffset),signingRegion:o,signingService:l})}errorHandler(e){return t=>{const n=t.ServerTime??LE(t.$response);if(n){const i=ud("config",e.config),a=i.systemClockOffset;i.systemClockOffset=UE(n,i.systemClockOffset),i.systemClockOffset!==a&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=LE(e);if(n){const i=ud("config",t.config);i.systemClockOffset=UE(n,i.systemClockOffset)}}}const oj=(r,e,t)=>{let n,i,a,s=!1;const o=async()=>{i||(i=r());try{n=await i,a=!0,s=!1}finally{i=void 0}return n};return async l=>((!a||l?.forceRefresh)&&(n=await o()),n)},lj="X-Amz-Algorithm",uj="X-Amz-Credential",tD="X-Amz-Date",cj="X-Amz-SignedHeaders",fj="X-Amz-Expires",rD="X-Amz-Signature",nD="X-Amz-Security-Token",iD="authorization",aD=tD.toLowerCase(),dj="date",hj=[iD,aD,dj],pj=rD.toLowerCase(),mA="x-amz-content-sha256",gj=nD.toLowerCase(),mj={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},vj=/^proxy-/,yj=/^sec-/,$v="AWS4-HMAC-SHA256",Aj="AWS4-HMAC-SHA256-PAYLOAD",bj="UNSIGNED-PAYLOAD",Cj=50,sD="aws4_request",wj=3600*24*7,Op={},qv=[],Qv=(r,e,t)=>`${r}/${e}/${t}/${sD}`,xj=async(r,e,t,n,i)=>{const a=await VE(r,e.secretAccessKey,e.accessKeyId),s=`${t}:${n}:${i}:${Fl(a)}:${e.sessionToken}`;if(s in Op)return Op[s];for(qv.push(s);qv.length>Cj;)delete Op[qv.shift()];let o=`AWS4${e.secretAccessKey}`;for(const l of[t,n,i,sD])o=await VE(r,o,l);return Op[s]=o},VE=(r,e,t)=>{const n=new r(e);return n.update(Pd(t)),n.digest()},zE=({headers:r},e,t)=>{const n={};for(const i of Object.keys(r).sort()){if(r[i]==null)continue;const a=i.toLowerCase();(a in mj||e?.has(a)||vj.test(a)||yj.test(a))&&(!t||t&&!t.has(a))||(n[a]=r[i].trim().replace(/\s+/g," "))}return n},Sj=r=>typeof ArrayBuffer=="function"&&r instanceof ArrayBuffer||Object.prototype.toString.call(r)==="[object ArrayBuffer]",Wv=async({headers:r,body:e},t)=>{for(const n of Object.keys(r))if(n.toLowerCase()===mA)return r[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||Sj(e)){const n=new t;return n.update(Pd(e)),Fl(await n.digest())}return bj};class Ej{format(e){const t=[];for(const a of Object.keys(e)){const s=Dl(a);t.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[a]))}const n=new Uint8Array(t.reduce((a,s)=>a+s.byteLength,0));let i=0;for(const a of t)n.set(a,i),i+=a.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(e.value.bytes,1),i;case"binary":const a=new DataView(new ArrayBuffer(3+e.value.byteLength));a.setUint8(0,6),a.setUint16(1,e.value.byteLength,!1);const s=new Uint8Array(a.buffer);return s.set(e.value,3),s;case"string":const o=Dl(e.value),l=new DataView(new ArrayBuffer(3+o.byteLength));l.setUint8(0,7),l.setUint16(1,o.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(o,3),u;case"timestamp":const c=new Uint8Array(9);return c[0]=8,c.set(_1.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!kj.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const h=new Uint8Array(17);return h[0]=9,h.set(TV(e.value.replace(/\-/g,"")),1),h}}}var HE;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(HE||(HE={}));const kj=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class _1{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,i=Math.abs(Math.round(e));n>-1&&i>0;n--,i/=256)t[n]=i;return e<0&&jE(t),new _1(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&jE(e),parseInt(Fl(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function jE(r){for(let e=0;e<8;e++)r[e]^=255;for(let e=7;e>-1&&(r[e]++,r[e]===0);e--);}const Fj=(r,e)=>{r=r.toLowerCase();for(const t of Object.keys(e))if(r===t.toLowerCase())return!0;return!1},Tj=(r,e={})=>{const{headers:t,query:n={}}=aa.clone(r);for(const i of Object.keys(t)){const a=i.toLowerCase();(a.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(a)||e.hoistableHeaders?.has(a))&&(n[i]=t[i],delete t[i])}return{...r,headers:t,query:n}},GE=r=>{r=aa.clone(r);for(const e of Object.keys(r.headers))hj.indexOf(e.toLowerCase())>-1&&delete r.headers[e];return r},Ij=({query:r={}})=>{const e=[],t={};for(const n of Object.keys(r)){if(n.toLowerCase()===pj)continue;const i=kl(n);e.push(i);const a=r[n];typeof a=="string"?t[i]=`${i}=${kl(a)}`:Array.isArray(a)&&(t[i]=a.slice(0).reduce((s,o)=>s.concat([`${i}=${kl(o)}`]),[]).sort().join("&"))}return e.sort().map(n=>t[n]).filter(n=>n).join("&")},Dj=r=>Pj(r).toISOString().replace(/\.\d{3}Z$/,"Z"),Pj=r=>typeof r=="number"?new Date(r*1e3):typeof r=="string"?Number(r)?new Date(Number(r)*1e3):new Date(r):r;class Rj{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:s=!0}){this.service=i,this.sha256=a,this.uriEscapePath=s,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Ls(n),this.credentialProvider=Ls(t)}createCanonicalRequest(e,t,n){const i=Object.keys(t).sort();return`${e.method}
2691
+ `),$V={warn:console.warn},qV=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],P1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function QV(r){const e=r.getUTCFullYear(),t=r.getUTCMonth(),n=r.getUTCDay(),i=r.getUTCDate(),a=r.getUTCHours(),s=r.getUTCMinutes(),o=r.getUTCSeconds(),l=i<10?`0${i}`:`${i}`,u=a<10?`0${a}`:`${a}`,c=s<10?`0${s}`:`${s}`,h=o<10?`0${o}`:`${o}`;return`${qV[n]}, ${l} ${P1[t]} ${e} ${u}:${c}:${h} GMT`}const WV=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),YV=r=>{if(r==null)return;if(typeof r!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");const e=WV.exec(r);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");const[t,n,i,a,s,o,l,u,c]=e,h=xg(Rd(n)),f=Ao(i,"month",1,12),d=Ao(a,"day",1,31),g=Kp(h,f,d,{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u});return c.toUpperCase()!="Z"&&g.setTime(g.getTime()-oz(c)),g},XV=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),JV=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),KV=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),DI=r=>{if(r==null)return;if(typeof r!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=XV.exec(r);if(e){const[t,n,i,a,s,o,l,u]=e;return Kp(xg(Rd(a)),Vv(i),Ao(n,"day",1,31),{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u})}if(e=JV.exec(r),e){const[t,n,i,a,s,o,l,u]=e;return rz(Kp(ez(a),Vv(i),Ao(n,"day",1,31),{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u}))}if(e=KV.exec(r),e){const[t,n,i,a,s,o,l,u]=e;return Kp(xg(Rd(u)),Vv(n),Ao(i.trimLeft(),"day",1,31),{hours:a,minutes:s,seconds:o,fractionalMilliseconds:l})}throw new TypeError("Invalid RFC-7231 date-time value")},ZV=r=>{if(r==null)return;let e;if(typeof r=="number")e=r;else if(typeof r=="string")e=VV(r);else if(typeof r=="object"&&r.tag===1)e=r.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},Kp=(r,e,t,n)=>{const i=e-1;return iz(r,i,t),new Date(Date.UTC(r,i,t,Ao(n.hours,"hour",0,23),Ao(n.minutes,"minute",0,59),Ao(n.seconds,"seconds",0,60),sz(n.fractionalMilliseconds)))},ez=r=>{const e=new Date().getUTCFullYear(),t=Math.floor(e/100)*100+xg(Rd(r));return t<e?t+100:t},tz=50*365*24*60*60*1e3,rz=r=>r.getTime()-new Date().getTime()>tz?new Date(Date.UTC(r.getUTCFullYear()-100,r.getUTCMonth(),r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds())):r,Vv=r=>{const e=P1.indexOf(r);if(e<0)throw new TypeError(`Invalid month: ${r}`);return e+1},nz=[31,28,31,30,31,30,31,31,30,31,30,31],iz=(r,e,t)=>{let n=nz[e];if(e===1&&az(r)&&(n=29),t>n)throw new TypeError(`Invalid day for ${P1[e]} in ${r}: ${t}`)},az=r=>r%4===0&&(r%100!==0||r%400===0),Ao=(r,e,t,n)=>{const i=jV(Rd(r));if(i<t||i>n)throw new TypeError(`${e} must be between ${t} and ${n}, inclusive`);return i},sz=r=>r==null?0:zV("0."+r)*1e3,oz=r=>{const e=r[0];let t=1;if(e=="+")t=1;else if(e=="-")t=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);const n=Number(r.substring(1,3)),i=Number(r.substring(4,6));return t*(n*60+i)*60*1e3},Rd=r=>{let e=0;for(;e<r.length-1&&r.charAt(e)==="0";)e++;return e===0?r:r.slice(e)},SE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ti=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0")),PI=()=>{if(SE)return SE();const r=new Uint8Array(16);return crypto.getRandomValues(r),r[6]=r[6]&15|64,r[8]=r[8]&63|128,Ti[r[0]]+Ti[r[1]]+Ti[r[2]]+Ti[r[3]]+"-"+Ti[r[4]]+Ti[r[5]]+"-"+Ti[r[6]]+Ti[r[7]]+"-"+Ti[r[8]]+Ti[r[9]]+"-"+Ti[r[10]]+Ti[r[11]]+Ti[r[12]]+Ti[r[13]]+Ti[r[14]]+Ti[r[15]]},go=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};go.from=r=>r&&typeof r=="object"&&(r instanceof go||"deserializeJSON"in r)?r:typeof r=="string"||Object.getPrototypeOf(r)===String.prototype?go(String(r)):go(JSON.stringify(r));go.fromObject=go.from;const EE=/^-?\d*(\.\d+)?$/;class ts{string;type;constructor(e,t){if(this.string=e,this.type=t,!EE.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;const t=e;return ts.prototype.isPrototypeOf(e)||t.type==="bigDecimal"&&EE.test(t.string)}}class lz{serdeContext;setSerdeContext(e){this.serdeContext=e}}class uz extends lz{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=ra.for(e.defaultNamespace);for(const t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return aa}getResponseType(){return dc}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(const[n,i]of t.url.searchParams.entries())e.query[n]=i;if(t.headers)for(const[n,i]of Object.entries(t.headers))e.headers[n]=i.join(", ");return e}else{if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(const[n,i]of Object.entries(t.headers))e.headers[n]=i;return e}}setHostPrefix(e,t,n){if(this.serdeContext?.disableHostPrefix)return;const i=vi.of(t.input),a=Yf(t.traits??{});if(a.endpoint){let s=a.endpoint?.[0];if(typeof s=="string"){const o=[...i.structIterator()].filter(([,l])=>l.getMergedTraits().hostLabel);for(const[l]of o){const u=n[l];if(typeof u!="string")throw new Error(`@smithy/core/schema - ${l} in input must be a string as hostLabel.`);s=s.replace(`{${l}}`,u)}e.hostname=s+e.hostname}}}deserializeMetadata(e){return{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"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n})}async loadEventStreamCapability(){const{EventStreamSerde:e}=await Promise.resolve().then(()=>require("./index-DMKTxLwo.cjs"));return new e({marshaller:this.getEventStreamMarshaller(),serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,n,i,a){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class cz extends uz{async serializeRequest(e,t,n){const i=this.serializer,a={},s={},o=await n.endpoint(),l=vi.of(e?.input),u=l.getSchema();let c;const h=t&&typeof t=="object"?t:{},f=new aa({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:a,headers:s,body:void 0});if(o&&(this.updateServiceEndpoint(f,o),this.setHostPrefix(f,e,h)),h){const d=l.getEventStreamMember();if(d){if(h[d]){const g={};for(const[v,y]of l.structIterator())v!==d&&h[v]&&(i.write(y,h[v]),g[v]=i.flush());c=await this.serializeEventStream({eventStream:h[d],requestSchema:l,initialRequest:g})}}else i.write(u,h),c=i.flush()}return f.headers=Object.assign(f.headers,s),f.query=a,f.body=c,f.method="POST",f}async deserializeResponse(e,t,n){const i=this.deserializer,a=vi.of(e.output),s={};if(n.statusCode>=300){const l=await dA(n.body,t);throw l.byteLength>0&&Object.assign(s,await i.read(15,l)),await this.handleError(e,t,n,s,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(const l in n.headers){const u=n.headers[l];delete n.headers[l],n.headers[l.toLowerCase()]=u}const o=a.getEventStreamMember();if(o)s[o]=await this.deserializeEventStream({response:n,responseSchema:a,initialResponseContainer:s});else{const l=await dA(n.body,t);l.byteLength>0&&Object.assign(s,await i.read(a,l))}return s.$metadata=this.deserializeMetadata(n),s}}function RI(r,e){if(e.timestampFormat.useTrait&&r.isTimestampSchema()&&(r.getSchema()===5||r.getSchema()===6||r.getSchema()===7))return r.getSchema();const{httpLabel:t,httpPrefixHeaders:n,httpHeader:i,httpQuery:a}=r.getMergedTraits();return(e.httpBindings?typeof n=="string"||i?6:a||t?5:void 0:void 0)??e.timestampFormat.default}function fz(r,e,t){r.__smithy_context?r.__smithy_context.features||(r.__smithy_context.features={}):r.__smithy_context={features:{}},r.__smithy_context.features[e]=t}class dz{authSchemes=new Map;constructor(e){for(const[t,n]of Object.entries(e))n!==void 0&&this.authSchemes.set(t,n)}getIdentityProvider(e){return this.authSchemes.get(e)}}class hz{async sign(e,t,n){return e}}const pz=r=>function(t){return OI(t)&&t.expiration.getTime()-Date.now()<r},gz=3e5,mz=pz(gz),OI=r=>r.expiration!==void 0,vz=(r,e,t)=>{if(r===void 0)return;const n=typeof r!="function"?async()=>Promise.resolve(r):r;let i,a,s,o=!1;const l=async u=>{a||(a=n(u));try{i=await a,s=!0,o=!1}finally{a=void 0}return i};return e===void 0?async u=>((!s||u?.forceRefresh)&&(i=await l(u)),i):async u=>((!s||u?.forceRefresh)&&(i=await l(u)),o?i:t(i)?(e(i)&&await l(u),i):(o=!0,i))},yz=void 0;function Az(r){return r===void 0?!0:typeof r=="string"&&r.length<=50}function bz(r){const e=sd(r.userAgentAppId??yz),{customUserAgent:t}=r;return Object.assign(r,{customUserAgent:typeof t=="string"?[[t]]:t,userAgentAppId:async()=>{const n=await e();if(!Az(n)){const i=r.logger?.constructor?.name==="NoOpLogger"||!r.logger?console:r.logger;typeof n!="string"?i?.warn("userAgentAppId must be a string or undefined."):n.length>50&&i?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return n}})}class Cz{capacity;data=new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const n=this.hash(e);if(n===!1)return t();if(!this.data.has(n)){if(this.data.size>this.capacity+10){const i=this.data.keys();let a=0;for(;;){const{value:s,done:o}=i.next();if(this.data.delete(s),o||++a>10)break}}this.data.set(n,t())}return this.data.get(n)}size(){return this.data.size}hash(e){let t="";const{parameters:n}=this;if(n.length===0)return!1;for(const i of n){const a=String(e[i]??"");if(a.includes("|;"))return!1;t+=a+"|;"}return t}}const wz=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}$"),BI=r=>wz.test(r)||r.startsWith("[")&&r.endsWith("]"),xz=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),im=(r,e=!1)=>{if(!e)return xz.test(r);const t=r.split(".");for(const n of t)if(!im(n))return!1;return!0},Sg={},Od="endpoints";function Do(r){return typeof r!="object"||r==null?r:"ref"in r?`$${Do(r.ref)}`:"fn"in r?`${r.fn}(${(r.argv||[]).map(Do).join(", ")})`:JSON.stringify(r,null,2)}class sa extends Error{constructor(e){super(e),this.name="EndpointError"}}const Sz=(r,e)=>r===e,Ez=r=>{const e=r.split("."),t=[];for(const n of e){const i=n.indexOf("[");if(i!==-1){if(n.indexOf("]")!==n.length-1)throw new sa(`Path: '${r}' does not end with ']'`);const a=n.slice(i+1,-1);if(Number.isNaN(parseInt(a)))throw new sa(`Invalid array index: '${a}' in path: '${r}'`);i!==0&&t.push(n.slice(0,i)),t.push(a)}else t.push(n)}return t},MI=(r,e)=>Ez(e).reduce((t,n)=>{if(typeof t!="object")throw new sa(`Index '${n}' in '${e}' not found in '${JSON.stringify(r)}'`);return Array.isArray(t)?t[parseInt(n)]:t[n]},r),kz=r=>r!=null,Fz=r=>!r,zv={[Id.HTTP]:80,[Id.HTTPS]:443},Tz=r=>{const e=(()=>{try{if(r instanceof URL)return r;if(typeof r=="object"&&"hostname"in r){const{hostname:f,port:d,protocol:g="",path:v="",query:y={}}=r,A=new URL(`${g}//${f}${d?`:${d}`:""}${v}`);return A.search=Object.entries(y).map(([w,k])=>`${w}=${k}`).join("&"),A}return new URL(r)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(r)} as a whatwg URL.`),null;const t=e.href,{host:n,hostname:i,pathname:a,protocol:s,search:o}=e;if(o)return null;const l=s.slice(0,-1);if(!Object.values(Id).includes(l))return null;const u=BI(i),c=t.includes(`${n}:${zv[l]}`)||typeof r=="string"&&r.includes(`${n}:${zv[l]}`),h=`${n}${c?`:${zv[l]}`:""}`;return{scheme:l,authority:h,path:a,normalizedPath:a.endsWith("/")?a:`${a}/`,isIp:u}},Iz=(r,e)=>r===e,Dz=(r,e,t,n)=>e>=t||r.length<t||/[^\u0000-\u007f]/.test(r)?null:n?r.substring(r.length-t,r.length-e):r.substring(e,t),Pz=r=>encodeURIComponent(r).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Rz={booleanEquals:Sz,getAttr:MI,isSet:kz,isValidHostLabel:im,not:Fz,parseURL:Tz,stringEquals:Iz,substring:Dz,uriEncode:Pz},_I=(r,e)=>{const t=[],n={...e.endpointParams,...e.referenceRecord};let i=0;for(;i<r.length;){const a=r.indexOf("{",i);if(a===-1){t.push(r.slice(i));break}t.push(r.slice(i,a));const s=r.indexOf("}",a);if(s===-1){t.push(r.slice(a));break}r[a+1]==="{"&&r[s+1]==="}"&&(t.push(r.slice(a+1,s)),i=s+2);const o=r.substring(a+1,s);if(o.includes("#")){const[l,u]=o.split("#");t.push(MI(n[l],u))}else t.push(n[o]);i=s+1}return t.join("")},Oz=({ref:r},e)=>({...e.endpointParams,...e.referenceRecord})[r],am=(r,e,t)=>{if(typeof r=="string")return _I(r,t);if(r.fn)return LI.callFunction(r,t);if(r.ref)return Oz(r,t);throw new sa(`'${e}': ${String(r)} is not a string, function or reference.`)},NI=({fn:r,argv:e},t)=>{const n=e.map(a=>["boolean","number"].includes(typeof a)?a:LI.evaluateExpression(a,"arg",t)),i=r.split(".");return i[0]in Sg&&i[1]!=null?Sg[i[0]][i[1]](...n):Rz[r](...n)},LI={evaluateExpression:am,callFunction:NI},Bz=({assign:r,...e},t)=>{if(r&&r in t.referenceRecord)throw new sa(`'${r}' is already defined in Reference Record.`);const n=NI(e,t);return t.logger?.debug?.(`${Od} evaluateCondition: ${Do(e)} = ${Do(n)}`),{result:n===""?!0:!!n,...r!=null&&{toAssign:{name:r,value:n}}}},R1=(r=[],e)=>{const t={};for(const n of r){const{result:i,toAssign:a}=Bz(n,{...e,referenceRecord:{...e.referenceRecord,...t}});if(!i)return{result:i};a&&(t[a.name]=a.value,e.logger?.debug?.(`${Od} assign: ${a.name} := ${Do(a.value)}`))}return{result:!0,referenceRecord:t}},Mz=(r,e)=>Object.entries(r).reduce((t,[n,i])=>({...t,[n]:i.map(a=>{const s=am(a,"Header value entry",e);if(typeof s!="string")throw new sa(`Header '${n}' value '${s}' is not a string`);return s})}),{}),UI=(r,e)=>Object.entries(r).reduce((t,[n,i])=>({...t,[n]:zI.getEndpointProperty(i,e)}),{}),VI=(r,e)=>{if(Array.isArray(r))return r.map(t=>VI(t,e));switch(typeof r){case"string":return _I(r,e);case"object":if(r===null)throw new sa(`Unexpected endpoint property: ${r}`);return zI.getEndpointProperties(r,e);case"boolean":return r;default:throw new sa(`Unexpected endpoint property type: ${typeof r}`)}},zI={getEndpointProperty:VI,getEndpointProperties:UI},_z=(r,e)=>{const t=am(r,"Endpoint URL",e);if(typeof t=="string")try{return new URL(t)}catch(n){throw console.error(`Failed to construct URL with ${t}`,n),n}throw new sa(`Endpoint URL must be a string, got ${typeof t}`)},Nz=(r,e)=>{const{conditions:t,endpoint:n}=r,{result:i,referenceRecord:a}=R1(t,e);if(!i)return;const s={...e,referenceRecord:{...e.referenceRecord,...a}},{url:o,properties:l,headers:u}=n;return e.logger?.debug?.(`${Od} Resolving endpoint from template: ${Do(n)}`),{...u!=null&&{headers:Mz(u,s)},...l!=null&&{properties:UI(l,s)},url:_z(o,s)}},Lz=(r,e)=>{const{conditions:t,error:n}=r,{result:i,referenceRecord:a}=R1(t,e);if(i)throw new sa(am(n,"Error",{...e,referenceRecord:{...e.referenceRecord,...a}}))},HI=(r,e)=>{for(const t of r)if(t.type==="endpoint"){const n=Nz(t,e);if(n)return n}else if(t.type==="error")Lz(t,e);else if(t.type==="tree"){const n=jI.evaluateTreeRule(t,e);if(n)return n}else throw new sa(`Unknown endpoint rule: ${t}`);throw new sa("Rules evaluation failed")},Uz=(r,e)=>{const{conditions:t,rules:n}=r,{result:i,referenceRecord:a}=R1(t,e);if(i)return jI.evaluateRules(n,{...e,referenceRecord:{...e.referenceRecord,...a}})},jI={evaluateRules:HI,evaluateTreeRule:Uz},Vz=(r,e)=>{const{endpointParams:t,logger:n}=e,{parameters:i,rules:a}=r;e.logger?.debug?.(`${Od} Initial EndpointParams: ${Do(t)}`);const s=Object.entries(i).filter(([,u])=>u.default!=null).map(([u,c])=>[u,c.default]);if(s.length>0)for(const[u,c]of s)t[u]=t[u]??c;const o=Object.entries(i).filter(([,u])=>u.required).map(([u])=>u);for(const u of o)if(t[u]==null)throw new sa(`Missing required parameter: '${u}'`);const l=HI(a,{endpointParams:t,logger:n,referenceRecord:{}});return e.logger?.debug?.(`${Od} Resolved endpoint: ${Do(l)}`),l},GI=(r,e=!1)=>{if(e){for(const t of r.split("."))if(!GI(t))return!1;return!0}return!(!im(r)||r.length<3||r.length>63||r!==r.toLowerCase()||BI(r))},kE=":",zz="/",Hz=r=>{const e=r.split(kE);if(e.length<6)return null;const[t,n,i,a,s,...o]=e;if(t!=="arn"||n===""||i===""||o.join(kE)==="")return null;const l=o.map(u=>u.split(zz)).flat();return{partition:n,service:i,region:a,accountId:s,resourceId:l}},jz=[{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",supportsDualStack:!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:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,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:!0,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)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,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:!0,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)"}}}],Gz={partitions:jz};let $z=Gz;const qz=r=>{const{partitions:e}=$z;for(const n of e){const{regions:i,outputs:a}=n;for(const[s,o]of Object.entries(i))if(s===r)return{...a,...o}}for(const n of e){const{regionRegex:i,outputs:a}=n;if(new RegExp(i).test(r))return{...a}}const t=e.find(n=>n.id==="aws");if(!t)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...t.outputs}},$I={isVirtualHostableS3Bucket:GI,parseArn:Hz,partition:qz};Sg.aws=$I;function Qz(r,e,t){return r.$source||(r.$source={}),r.$source[e]=t,r}function Fs(r,e,t){r.__aws_sdk_context?r.__aws_sdk_context.features||(r.__aws_sdk_context.features={}):r.__aws_sdk_context={features:{}},r.__aws_sdk_context.features[e]=t}var Po;(function(r){r.STANDARD="standard",r.ADAPTIVE="adaptive"})(Po||(Po={}));const ld=3,Wz=Po.STANDARD,Yz=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Xz=["TimeoutError","RequestTimeout","RequestTimeoutException"],Jz=[500,502,503,504],Kz=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],Zz=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND"],eH=r=>r?.$retryable!==void 0,tH=r=>r.$metadata?.clockSkewCorrected,rH=r=>{const e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return r&&r instanceof TypeError?e.has(r.message):!1},qI=r=>r.$metadata?.httpStatusCode===429||Yz.includes(r.name)||r.$retryable?.throttling==!0,O1=(r,e=0)=>eH(r)||tH(r)||Xz.includes(r.name)||Kz.includes(r?.code||"")||Zz.includes(r?.code||"")||Jz.includes(r.$metadata?.httpStatusCode||0)||rH(r)||r.cause!==void 0&&e<=10&&O1(r.cause,e+1),nH=r=>{if(r.$metadata?.httpStatusCode!==void 0){const e=r.$metadata.httpStatusCode;return 500<=e&&e<=599&&!O1(r)}return!1};class B1{static setTimeoutFn=setTimeout;beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let t;this.updateMeasuredRate();const n=e;if(n?.errorType==="THROTTLING"||qI(n?.error??e)){const s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const a=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(a)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){if(this.refillTokenBucket(),e>this.availableTokens){const t=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(n=>B1.setTimeoutFn(n,t))}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){const n=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}const QI=20*1e3,FE=500,iH=1,aH="amz-sdk-invocation-id",sH="amz-sdk-request";class Ui{static v2026=typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return Ui.v2026?50:100}static throttlingDelay(){return Ui.v2026?1e3:500}static cost(){return Ui.v2026?14:5}static throttlingCost(){return Ui.v2026?5:10}static modifiedCostType(){return Ui.v2026?"THROTTLING":"TRANSIENT"}}class oH{x=Ui.delay();computeNextBackoffDelay(e){const i=Math.random()*Math.min(this.x*2**e,QI);return Math.floor(i)}setDelayBase(e){this.x=e}}class TE{delay;count;cost;longPoll;constructor(e,t,n,i){this.delay=e,this.count=t,this.cost=n,this.longPoll=i}getRetryCount(){return this.count}getRetryDelay(){return Math.min(QI,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}class pA{mode=Po.STANDARD;capacity=FE;retryBackoffStrategy;maxAttemptsProvider;baseDelay;constructor(e){typeof e=="number"?this.maxAttemptsProvider=async()=>e:typeof e=="function"?this.maxAttemptsProvider=e:e&&typeof e=="object"&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>ld,this.baseDelay??=Ui.delay(),this.retryBackoffStrategy??=new oH}async acquireInitialRetryToken(e){return new TE(Ui.delay(),0,void 0,Ui.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts(),i=this.shouldRetry(e,t,n);if(i||e.isLongPoll?.()){const a=t.errorType;this.retryBackoffStrategy.setDelayBase(a==="THROTTLING"?Ui.throttlingDelay():this.baseDelay);const s=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());let o=s;if(t.retryAfterHint instanceof Date&&(o=Math.max(s,Math.min(t.retryAfterHint.getTime()-Date.now(),s+5e3))),i){const l=this.getCapacityCost(a);return this.capacity-=l,new TE(o,e.getRetryCount()+1,l,e.isLongPoll?.()??!1)}else throw Object.assign(new Error("No retry token available"),{$backoff:Ui.v2026?o:0})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(FE,this.capacity+(e.getRetryCost()??iH))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${ld}`),ld}}shouldRetry(e,t,n){return e.getRetryCount()+1<n&&this.capacity>=this.getCapacityCost(t.errorType)&&this.isRetryableError(t.errorType)}getCapacityCost(e){return e===Ui.modifiedCostType()?Ui.throttlingCost():Ui.cost()}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class lH{mode=Po.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,t){const{rateLimiter:n}=t??{};this.rateLimiter=n??new B1,this.standardRetryStrategy=t?new pA({maxAttempts:typeof e=="number"?e:3,...t}):new pA(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,t){return this.rateLimiter.updateClientSendingRate(t),this.standardRetryStrategy.refreshRetryTokenForRetry(e,t)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}const uH=/\d{12}\.ddb/;async function cH(r,e,t){if(t.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&Fs(r,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){const a=await e.retryStrategy();if(typeof a.mode=="string")switch(a.mode){case Po.ADAPTIVE:Fs(r,"RETRY_MODE_ADAPTIVE","F");break;case Po.STANDARD:Fs(r,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){const a=r.endpointV2;switch(String(a?.url?.hostname).match(uH)&&Fs(r,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":Fs(r,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":Fs(r,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":Fs(r,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const i=r.__smithy_context?.selectedHttpAuthScheme?.identity;if(i?.$source){const a=i;a.accountId&&Fs(r,"RESOLVED_ACCOUNT_ID","T");for(const[s,o]of Object.entries(a.$source??{}))Fs(r,s,o)}}const IE="user-agent",Hv="x-amz-user-agent",DE=" ",jv="/",fH=/[^!$%&'*+\-.^_`|~\w]/g,dH=/[^!$%&'*+\-.^_`|~\w#]/g,PE="-",hH=1024;function pH(r){let e="";for(const t in r){const n=r[t];if(e.length+n.length+1<=hH){e.length?e+=","+n:e+=n;continue}break}return e}const gH=r=>(e,t)=>async n=>{const{request:i}=n;if(!aa.isInstance(i))return e(n);const{headers:a}=i,s=t?.userAgent?.map(Rp)||[],o=(await r.defaultUserAgentProvider()).map(Rp);await cH(t,r,n);const l=t;o.push(`m/${pH(Object.assign({},t.__smithy_context?.features,l.__aws_sdk_context?.features))}`);const u=r?.customUserAgent?.map(Rp)||[],c=await r.userAgentAppId();c&&o.push(Rp(["app",`${c}`]));const h=[].concat([...o,...s,...u]).join(DE),f=[...o.filter(d=>d.startsWith("aws-sdk-")),...u].join(DE);return r.runtime!=="browser"?(f&&(a[Hv]=a[Hv]?`${a[IE]} ${f}`:f),a[IE]=h):a[Hv]=h,e({...n,request:i})},Rp=r=>{const e=r[0].split(jv).map(s=>s.replace(fH,PE)).join(jv),t=r[1]?.replace(dH,PE),n=e.indexOf(jv),i=e.substring(0,n);let a=e.substring(n+1);return i==="api"&&(a=a.toLowerCase()),[i,a,t].filter(s=>s&&s.length>0).reduce((s,o,l)=>{switch(l){case 0:return o;case 1:return`${s}/${o}`;default:return`${s}#${o}`}},"")},mH={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},vH=r=>({applyToStack:e=>{e.add(gH(r),mH)}}),yH=!1,AH=!1,RE=new Set,bH=(r,e=im)=>{if(!RE.has(r)&&!e(r))if(r==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${r}" is not a valid hostname component.`);else RE.add(r)},WI=r=>typeof r=="string"&&(r.startsWith("fips-")||r.endsWith("-fips")),CH=r=>WI(r)?["fips-aws-global","aws-fips"].includes(r)?"us-east-1":r.replace(/fips-(dkr-|prod-)?|-fips/,""):r,wH=r=>{const{region:e,useFipsEndpoint:t}=r;if(!e)throw new Error("Region is missing");return Object.assign(r,{region:async()=>{const n=typeof e=="function"?await e():e,i=CH(n);return bH(i),i},useFipsEndpoint:async()=>{const n=typeof e=="string"?e:await e();return WI(n)?!0:typeof t!="function"?Promise.resolve(!!t):t()}})},OE="content-length";function xH(r){return e=>async t=>{const n=t.request;if(aa.isInstance(n)){const{body:i,headers:a}=n;if(i&&Object.keys(a).map(s=>s.toLowerCase()).indexOf(OE)===-1)try{const s=r(i);n.headers={...n.headers,[OE]:String(s)}}catch{}}return e({...t,request:n})}}const SH={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},EH=r=>({applyToStack:e=>{e.add(xH(r.bodyLengthChecker),SH)}}),kH=async r=>{const e=r?.Bucket||"";if(typeof r.Bucket=="string"&&(r.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),PH(e)){if(r.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!DH(e)||e.indexOf(".")!==-1&&!String(r.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(r.ForcePathStyle=!0);return r.DisableMultiRegionAccessPoints&&(r.disableMultiRegionAccessPoints=!0,r.DisableMRAP=!0),r},FH=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,TH=/(\d+\.){3}\d+/,IH=/\.\./,DH=r=>FH.test(r)&&!TH.test(r)&&!IH.test(r),PH=r=>{const[e,t,n,,,i]=r.split(":"),a=e==="arn"&&r.split(":").length>=6,s=!!(a&&t&&n&&i);if(a&&!s)throw new Error(`Invalid ARN: ${r} was an invalid ARN.`);return s},RH=(r,e,t,n=!1)=>{const i=async()=>{let a;return n?a=t.clientContextParams?.[r]??t[r]??t[e]:a=t[r]??t[e],typeof a=="function"?a():a};return r==="credentialScope"||e==="CredentialScope"?async()=>{const a=typeof t.credentials=="function"?await t.credentials():t.credentials;return a?.credentialScope??a?.CredentialScope}:r==="accountId"||e==="AccountId"?async()=>{const a=typeof t.credentials=="function"?await t.credentials():t.credentials;return a?.accountId??a?.AccountId}:r==="endpoint"||e==="endpoint"?async()=>{if(t.isCustomEndpoint===!1)return;const a=await i();if(a&&typeof a=="object"){if("url"in a)return a.url.href;if("hostname"in a){const{protocol:s,hostname:o,port:l,path:u}=a;return`${s}//${o}${l?":"+l:""}${u}`}}return a}:i},YI=async r=>{},XI=r=>{if(typeof r=="object"){if("url"in r){const e=hc(r.url);if(r.headers){e.headers={};for(const[t,n]of Object.entries(r.headers))e.headers[t.toLowerCase()]=n.join(", ")}return e}return r}return hc(r)},OH=async(r,e,t,n)=>{if(!t.isCustomEndpoint){let s;t.serviceConfiguredEndpoint?s=await t.serviceConfiguredEndpoint():s=await YI(t.serviceId),s&&(t.endpoint=()=>Promise.resolve(XI(s)),t.isCustomEndpoint=!0)}const i=await BH(r,e,t);if(typeof t.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");const a=t.endpointProvider(i,n);if(t.isCustomEndpoint&&t.endpoint){const s=await t.endpoint();if(s?.headers){a.headers??={};for(const[o,l]of Object.entries(s.headers))a.headers[o]=Array.isArray(l)?l:[l]}}return a},BH=async(r,e,t)=>{const n={},i=e?.getEndpointParameterInstructions?.()||{};for(const[a,s]of Object.entries(i))switch(s.type){case"staticContextParams":n[a]=s.value;break;case"contextParams":n[a]=r[s.name];break;case"clientContextParams":case"builtInParams":n[a]=await RH(s.name,a,t,s.type!=="builtInParams")();break;case"operationContextParams":n[a]=s.get(r);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return Object.keys(i).length===0&&Object.assign(n,t),String(t.serviceId).toLowerCase()==="s3"&&await kH(n),n},MH=({config:r,instructions:e})=>(t,n)=>async i=>{r.isCustomEndpoint&&fz(n,"ENDPOINT_OVERRIDE","N");const a=await OH(i.input,{getEndpointParameterInstructions(){return e}},{...r},n);n.endpointV2=a,n.authSchemes=a.properties?.authSchemes;const s=n.authSchemes?.[0];if(s){n.signing_region=s.signingRegion,n.signing_service=s.signingName;const l=xc(n)?.selectedHttpAuthScheme?.httpAuthOption;l&&(l.signingProperties=Object.assign(l.signingProperties||{},{signing_region:s.signingRegion,signingRegion:s.signingRegion,signing_service:s.signingName,signingName:s.signingName,signingRegionSet:s.signingRegionSet},s.properties))}return t({...i})},_H={name:"serializerMiddleware"},NH={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:_H.name},JI=(r,e)=>({applyToStack:t=>{t.addRelativeTo(MH({config:r,instructions:e}),NH)}}),LH=r=>{const e=r.tls??!0,{endpoint:t,useDualstackEndpoint:n,useFipsEndpoint:i}=r,a=t!=null?async()=>XI(await Ls(t)()):void 0,o=Object.assign(r,{endpoint:a,tls:e,isCustomEndpoint:!!t,useDualstackEndpoint:Ls(n??!1),useFipsEndpoint:Ls(i??!1)});let l;return o.serviceConfiguredEndpoint=async()=>(r.serviceId&&!l&&(l=YI(r.serviceId)),l),o},UH=r=>r instanceof Error?r:r instanceof Object?Object.assign(new Error,r):typeof r=="string"?new Error(r):new Error(`AWS SDK error wrapper for ${r}`),VH=r=>{const{retryStrategy:e,retryMode:t}=r,n=Ls(r.maxAttempts??ld);let i=e?Promise.resolve(e):void 0;const a=async()=>await Ls(t)()===Po.ADAPTIVE?new lH(n):new pA(n);return Object.assign(r,{maxAttempts:n,retryStrategy:()=>i??=a()})},pl=(r,e)=>{const t=[];if(r&&t.push(r),e)for(const n of e)t.push(n);return t},io=(r,e)=>`${r||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,Eg=()=>{let r=[],e=[],t=!1;const n=new Set,i=h=>h.sort((f,d)=>BE[d.step]-BE[f.step]||ME[d.priority||"normal"]-ME[f.priority||"normal"]),a=h=>{let f=!1;const d=g=>{const v=pl(g.name,g.aliases);if(v.includes(h)){f=!0;for(const y of v)n.delete(y);return!1}return!0};return r=r.filter(d),e=e.filter(d),f},s=h=>{let f=!1;const d=g=>{if(g.middleware===h){f=!0;for(const v of pl(g.name,g.aliases))n.delete(v);return!1}return!0};return r=r.filter(d),e=e.filter(d),f},o=h=>(r.forEach(f=>{h.add(f.middleware,{...f})}),e.forEach(f=>{h.addRelativeTo(f.middleware,{...f})}),h.identifyOnResolve?.(c.identifyOnResolve()),h),l=h=>{const f=[];return h.before.forEach(d=>{d.before.length===0&&d.after.length===0?f.push(d):f.push(...l(d))}),f.push(h),h.after.reverse().forEach(d=>{d.before.length===0&&d.after.length===0?f.push(d):f.push(...l(d))}),f},u=(h=!1)=>{const f=[],d=[],g={};return r.forEach(y=>{const A={...y,before:[],after:[]};for(const w of pl(A.name,A.aliases))g[w]=A;f.push(A)}),e.forEach(y=>{const A={...y,before:[],after:[]};for(const w of pl(A.name,A.aliases))g[w]=A;d.push(A)}),d.forEach(y=>{if(y.toMiddleware){const A=g[y.toMiddleware];if(A===void 0){if(h)return;throw new Error(`${y.toMiddleware} is not found when adding ${io(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}y.relation==="after"&&A.after.push(y),y.relation==="before"&&A.before.push(y)}}),i(f).map(l).reduce((y,A)=>(y.push(...A),y),[])},c={add:(h,f={})=>{const{name:d,override:g,aliases:v}=f,y={step:"initialize",priority:"normal",middleware:h,...f},A=pl(d,v);if(A.length>0){if(A.some(w=>n.has(w))){if(!g)throw new Error(`Duplicate middleware name '${io(d,v)}'`);for(const w of A){const k=r.findIndex(S=>S.name===w||S.aliases?.some(R=>R===w));if(k===-1)continue;const T=r[k];if(T.step!==y.step||y.priority!==T.priority)throw new Error(`"${io(T.name,T.aliases)}" middleware with ${T.priority} priority in ${T.step} step cannot be overridden by "${io(d,v)}" middleware with ${y.priority} priority in ${y.step} step.`);r.splice(k,1)}}for(const w of A)n.add(w)}r.push(y)},addRelativeTo:(h,f)=>{const{name:d,override:g,aliases:v}=f,y={middleware:h,...f},A=pl(d,v);if(A.length>0){if(A.some(w=>n.has(w))){if(!g)throw new Error(`Duplicate middleware name '${io(d,v)}'`);for(const w of A){const k=e.findIndex(S=>S.name===w||S.aliases?.some(R=>R===w));if(k===-1)continue;const T=e[k];if(T.toMiddleware!==y.toMiddleware||T.relation!==y.relation)throw new Error(`"${io(T.name,T.aliases)}" middleware ${T.relation} "${T.toMiddleware}" middleware cannot be overridden by "${io(d,v)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);e.splice(k,1)}}for(const w of A)n.add(w)}e.push(y)},clone:()=>o(Eg()),use:h=>{h.applyToStack(c)},remove:h=>typeof h=="string"?a(h):s(h),removeByTag:h=>{let f=!1;const d=g=>{const{tags:v,name:y,aliases:A}=g;if(v&&v.includes(h)){const w=pl(y,A);for(const k of w)n.delete(k);return f=!0,!1}return!0};return r=r.filter(d),e=e.filter(d),f},concat:h=>{const f=o(Eg());return f.use(h),f.identifyOnResolve(t||f.identifyOnResolve()||(h.identifyOnResolve?.()??!1)),f},applyToStack:o,identify:()=>u(!0).map(h=>{const f=h.step??h.relation+" "+h.toMiddleware;return io(h.name,h.aliases)+" - "+f}),identifyOnResolve(h){return typeof h=="boolean"&&(t=h),t},resolve:(h,f)=>{for(const d of u().map(g=>g.middleware).reverse())h=d(h,f);return t&&console.log(c.identify()),h}};return c},BE={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},ME={high:3,normal:2,low:1};class zH{config;middlewareStack=Eg();initConfig;handlers;constructor(e){this.config=e;const{protocol:t,protocolSettings:n}=e;n&&typeof t=="function"&&(e.protocol=new t(n))}send(e,t,n){const i=typeof t!="function"?t:void 0,a=typeof t=="function"?t:n,s=i===void 0&&this.config.cacheMiddleware===!0;let o;if(s){this.handlers||(this.handlers=new WeakMap);const l=this.handlers;l.has(e.constructor)?o=l.get(e.constructor):(o=e.resolveMiddleware(this.middlewareStack,this.config,i),l.set(e.constructor,o))}else delete this.handlers,o=e.resolveMiddleware(this.middlewareStack,this.config,i);if(a)o(e).then(l=>a(null,l.output),l=>a(l)).catch(()=>{});else return o(e).then(l=>l.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const Gv="***SensitiveInformation***";function gA(r,e){if(e==null)return e;const t=vi.of(r);if(t.getMergedTraits().sensitive)return Gv;if(t.isListSchema()){if(!!t.getValueSchema().getMergedTraits().sensitive)return Gv}else if(t.isMapSchema()){if(!!t.getKeySchema().getMergedTraits().sensitive||!!t.getValueSchema().getMergedTraits().sensitive)return Gv}else if(t.isStructSchema()&&typeof e=="object"){const n=e,i={};for(const[a,s]of t.structIterator())n[a]!=null&&(i[a]=gA(s,n[a]));return i}return e}class M1{middlewareStack=Eg();schema;static classBuilder(){return new HH}resolveMiddlewareWithContext(e,t,n,{middlewareFn:i,clientName:a,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,smithyContext:u,additionalContext:c,CommandCtor:h}){for(const y of i.bind(this)(h,e,t,n))this.middlewareStack.use(y);const f=e.concat(this.middlewareStack),{logger:d}=t,g={logger:d,clientName:a,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,[cA]:{commandInstance:this,...u},...c},{requestHandler:v}=t;return f.resolve(y=>v.handle(y.request,n||{}),g)}}class HH{_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=n=>n,t=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends M1{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.input=n??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(n,i,a){const s=e._operationSchema,o=s?.[4]??s?.input,l=s?.[5]??s?.output;return this.resolveMiddlewareWithContext(n,i,a,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(s?gA.bind(null,o):u=>u),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(s?gA.bind(null,l):u=>u),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}class Hu extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;const t=e;return Hu.prototype.isPrototypeOf(t)||!!t.$fault&&!!t.$metadata&&(t.$fault==="client"||t.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;const t=e;return this===Hu?Hu.isInstance(e):Hu.isInstance(e)?t.name&&this.name?this.prototype.isPrototypeOf(e)||t.name===this.name:this.prototype.isPrototypeOf(e):!1}}const _E=(r,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,i])=>{(r[n]==null||r[n]==="")&&(r[n]=i)});const t=r.message||r.Message||"UnknownError";return r.message=t,delete r.Message,r},jH=r=>{switch(r){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{}}},KI=Object.values(Dd),GH=r=>{const e=[];for(const t in Dd){const n=Dd[t];r[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>r[n]})}for(const[t,n]of Object.entries(r.checksumAlgorithms??{}))e.push({algorithmId:()=>t,checksumConstructor:()=>n});return{addChecksumAlgorithm(t){r.checksumAlgorithms=r.checksumAlgorithms??{};const n=t.algorithmId(),i=t.checksumConstructor();KI.includes(n)?r.checksumAlgorithms[n.toUpperCase()]=i:r.checksumAlgorithms[n]=i,e.push(t)},checksumAlgorithms(){return e}}},$H=r=>{const e={};return r.checksumAlgorithms().forEach(t=>{const n=t.algorithmId();KI.includes(n)&&(e[n]=t.checksumConstructor())}),e},qH=r=>({setRetryStrategy(e){r.retryStrategy=e},retryStrategy(){return r.retryStrategy}}),QH=r=>{const e={};return e.retryStrategy=r.retryStrategy(),e},WH=r=>Object.assign(GH(r),qH(r)),YH=r=>Object.assign($H(r),QH(r));class ZI{trace(){}debug(){}info(){}warn(){}error(){}}const XH=r=>r?.body instanceof ReadableStream;function JH(r,e){if(dc.isInstance(r))for(const t of Object.keys(r.headers)){const n=t.toLowerCase();if(n==="retry-after"){const i=r.headers[t];let a=NaN;if(i.endsWith("GMT"))try{a=(DI(i).getTime()-Date.now())/1e3}catch(s){e?.trace?.("Failed to parse retry-after header"),e?.trace?.(s)}else i.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?a=Number(i.match(/ GMT, ([\d.]+)$/)?.[1]):i.match(/^((\d+)|(\d+\.\d+))$/)?a=Number(i):Date.parse(i)>=Date.now()&&(a=(Date.parse(i)-Date.now())/1e3);return isNaN(a)?void 0:new Date(Date.now()+a*1e3)}else if(n==="x-amz-retry-after"){const i=r.headers[t],a=Number(i);if(isNaN(a)){e?.trace?.(`Failed to parse x-amz-retry-after=${i}`);return}return new Date(Date.now()+a)}}}const KH=r=>(e,t)=>async n=>{let i=await r.retryStrategy();const a=await r.maxAttempts();if(ZH(i)){i=i;let s=await i.acquireInitialRetryToken((t.partition_id??"")+(t.__retryLongPoll?":longpoll":"")),o=new Error,l=0,u=0;const{request:c}=n,h=aa.isInstance(c);for(h&&(c.headers[aH]=PI());;)try{h&&(c.headers[sH]=`attempt=${l+1}; max=${a}`);const{response:f,output:d}=await e(n);return i.recordSuccess(s),d.$metadata.attempts=l+1,d.$metadata.totalRetryDelay=u,{response:f,output:d}}catch(f){const d=ej(f,r.logger);if(o=UH(f),h&&XH(c))throw(t.logger instanceof ZI?console:t.logger)?.warn("An error was encountered in a non-retryable streaming request."),o;try{s=await i.refreshRetryTokenForRetry(s,d)}catch(v){throw typeof v.$backoff=="number"&&await NE(v.$backoff),o.$metadata||(o.$metadata={}),o.$metadata.attempts=l+1,o.$metadata.totalRetryDelay=u,o}l=s.getRetryCount();const g=s.getRetryDelay();u+=g,await NE(g)}}else return i=i,i?.mode&&(t.userAgent=[...t.userAgent||[],["cfg/retry-mode",i.mode]]),i.retry(e,n)},NE=r=>new Promise(e=>setTimeout(e,r)),ZH=r=>typeof r.acquireInitialRetryToken<"u"&&typeof r.refreshRetryTokenForRetry<"u"&&typeof r.recordSuccess<"u",ej=(r,e)=>{const t={error:r,errorType:tj(r)},n=JH(r.$response,e);return n&&(t.retryAfterHint=n),t},tj=r=>qI(r)?"THROTTLING":O1(r)?"TRANSIENT":nH(r)?"SERVER_ERROR":"CLIENT_ERROR",rj={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},nj=r=>({applyToStack:e=>{e.add(KH(r),rj)}}),LE=r=>dc.isInstance(r)?r.headers?.date??r.headers?.Date:void 0,eD=r=>new Date(Date.now()+r),ij=(r,e)=>Math.abs(eD(e).getTime()-r)>=3e5,UE=(r,e)=>{const t=Date.parse(r);return ij(t,e)?t-Date.now():e},ud=(r,e)=>{if(!e)throw new Error(`Property \`${r}\` is not resolved for AWS SDK SigV4Auth`);return e},aj=async r=>{const e=ud("context",r.context),t=ud("config",r.config),n=e.endpointV2?.properties?.authSchemes?.[0],a=await ud("signer",t.signer)(n),s=r?.signingRegion,o=r?.signingRegionSet,l=r?.signingName;return{config:t,signer:a,signingRegion:s,signingRegionSet:o,signingName:l}};class sj{async sign(e,t,n){if(!aa.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const i=await aj(n),{config:a,signer:s}=i;let{signingRegion:o,signingName:l}=i;const u=n.context;if(u?.authSchemes?.length??!1){const[h,f]=u.authSchemes;h?.name==="sigv4a"&&f?.name==="sigv4"&&(o=f?.signingRegion??o,l=f?.signingName??l)}return await s.sign(e,{signingDate:eD(a.systemClockOffset),signingRegion:o,signingService:l})}errorHandler(e){return t=>{const n=t.ServerTime??LE(t.$response);if(n){const i=ud("config",e.config),a=i.systemClockOffset;i.systemClockOffset=UE(n,i.systemClockOffset),i.systemClockOffset!==a&&t.$metadata&&(t.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=LE(e);if(n){const i=ud("config",t.config);i.systemClockOffset=UE(n,i.systemClockOffset)}}}const oj=(r,e,t)=>{let n,i,a,s=!1;const o=async()=>{i||(i=r());try{n=await i,a=!0,s=!1}finally{i=void 0}return n};return async l=>((!a||l?.forceRefresh)&&(n=await o()),n)},lj="X-Amz-Algorithm",uj="X-Amz-Credential",tD="X-Amz-Date",cj="X-Amz-SignedHeaders",fj="X-Amz-Expires",rD="X-Amz-Signature",nD="X-Amz-Security-Token",iD="authorization",aD=tD.toLowerCase(),dj="date",hj=[iD,aD,dj],pj=rD.toLowerCase(),mA="x-amz-content-sha256",gj=nD.toLowerCase(),mj={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},vj=/^proxy-/,yj=/^sec-/,$v="AWS4-HMAC-SHA256",Aj="AWS4-HMAC-SHA256-PAYLOAD",bj="UNSIGNED-PAYLOAD",Cj=50,sD="aws4_request",wj=3600*24*7,Op={},qv=[],Qv=(r,e,t)=>`${r}/${e}/${t}/${sD}`,xj=async(r,e,t,n,i)=>{const a=await VE(r,e.secretAccessKey,e.accessKeyId),s=`${t}:${n}:${i}:${Fl(a)}:${e.sessionToken}`;if(s in Op)return Op[s];for(qv.push(s);qv.length>Cj;)delete Op[qv.shift()];let o=`AWS4${e.secretAccessKey}`;for(const l of[t,n,i,sD])o=await VE(r,o,l);return Op[s]=o},VE=(r,e,t)=>{const n=new r(e);return n.update(Pd(t)),n.digest()},zE=({headers:r},e,t)=>{const n={};for(const i of Object.keys(r).sort()){if(r[i]==null)continue;const a=i.toLowerCase();(a in mj||e?.has(a)||vj.test(a)||yj.test(a))&&(!t||t&&!t.has(a))||(n[a]=r[i].trim().replace(/\s+/g," "))}return n},Sj=r=>typeof ArrayBuffer=="function"&&r instanceof ArrayBuffer||Object.prototype.toString.call(r)==="[object ArrayBuffer]",Wv=async({headers:r,body:e},t)=>{for(const n of Object.keys(r))if(n.toLowerCase()===mA)return r[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||Sj(e)){const n=new t;return n.update(Pd(e)),Fl(await n.digest())}return bj};class Ej{format(e){const t=[];for(const a of Object.keys(e)){const s=Dl(a);t.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[a]))}const n=new Uint8Array(t.reduce((a,s)=>a+s.byteLength,0));let i=0;for(const a of t)n.set(a,i),i+=a.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(e.value.bytes,1),i;case"binary":const a=new DataView(new ArrayBuffer(3+e.value.byteLength));a.setUint8(0,6),a.setUint16(1,e.value.byteLength,!1);const s=new Uint8Array(a.buffer);return s.set(e.value,3),s;case"string":const o=Dl(e.value),l=new DataView(new ArrayBuffer(3+o.byteLength));l.setUint8(0,7),l.setUint16(1,o.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(o,3),u;case"timestamp":const c=new Uint8Array(9);return c[0]=8,c.set(_1.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!kj.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const h=new Uint8Array(17);return h[0]=9,h.set(TV(e.value.replace(/\-/g,"")),1),h}}}var HE;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(HE||(HE={}));const kj=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class _1{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,i=Math.abs(Math.round(e));n>-1&&i>0;n--,i/=256)t[n]=i;return e<0&&jE(t),new _1(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&jE(e),parseInt(Fl(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function jE(r){for(let e=0;e<8;e++)r[e]^=255;for(let e=7;e>-1&&(r[e]++,r[e]===0);e--);}const Fj=(r,e)=>{r=r.toLowerCase();for(const t of Object.keys(e))if(r===t.toLowerCase())return!0;return!1},Tj=(r,e={})=>{const{headers:t,query:n={}}=aa.clone(r);for(const i of Object.keys(t)){const a=i.toLowerCase();(a.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(a)||e.hoistableHeaders?.has(a))&&(n[i]=t[i],delete t[i])}return{...r,headers:t,query:n}},GE=r=>{r=aa.clone(r);for(const e of Object.keys(r.headers))hj.indexOf(e.toLowerCase())>-1&&delete r.headers[e];return r},Ij=({query:r={}})=>{const e=[],t={};for(const n of Object.keys(r)){if(n.toLowerCase()===pj)continue;const i=kl(n);e.push(i);const a=r[n];typeof a=="string"?t[i]=`${i}=${kl(a)}`:Array.isArray(a)&&(t[i]=a.slice(0).reduce((s,o)=>s.concat([`${i}=${kl(o)}`]),[]).sort().join("&"))}return e.sort().map(n=>t[n]).filter(n=>n).join("&")},Dj=r=>Pj(r).toISOString().replace(/\.\d{3}Z$/,"Z"),Pj=r=>typeof r=="number"?new Date(r*1e3):typeof r=="string"?Number(r)?new Date(Number(r)*1e3):new Date(r):r;class Rj{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:s=!0}){this.service=i,this.sha256=a,this.uriEscapePath=s,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=Ls(n),this.credentialProvider=Ls(t)}createCanonicalRequest(e,t,n){const i=Object.keys(t).sort();return`${e.method}
2692
2692
  ${this.getCanonicalPath(e)}
2693
2693
  ${Ij(e)}
2694
2694
  ${i.map(a=>`${a}:${t[a]}`).join(`
@@ -2700,7 +2700,7 @@ ${e}
2700
2700
  ${t}
2701
2701
  ${Fl(s)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const a of e.split("/"))a?.length!==0&&a!=="."&&(a===".."?t.pop():t.push(a));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return kl(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){const t=Dj(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}class $E extends Rj{headerFormatter=new Ej;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:s=!0}){super({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:s})}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:i=3600,unsignableHeaders:a,unhoistableHeaders:s,signableHeaders:o,hoistableHeaders:l,signingRegion:u,signingService:c}=t,h=await this.credentialProvider();this.validateResolvedCredentials(h);const f=u??await this.regionProvider(),{longDate:d,shortDate:g}=this.formatDate(n);if(i>wj)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const v=Qv(g,f,c??this.service),y=Tj(GE(e),{unhoistableHeaders:s,hoistableHeaders:l});h.sessionToken&&(y.query[nD]=h.sessionToken),y.query[lj]=$v,y.query[uj]=`${h.accessKeyId}/${v}`,y.query[tD]=d,y.query[fj]=i.toString(10);const A=zE(y,a,o);return y.query[cj]=this.getCanonicalHeaderList(A),y.query[rD]=await this.getSignature(d,v,this.getSigningKey(h,f,g,c),this.createCanonicalRequest(y,A,await Wv(e,this.sha256))),y}async sign(e,t){return typeof e=="string"?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:i,signingRegion:a,signingService:s}){const o=a??await this.regionProvider(),{shortDate:l,longDate:u}=this.formatDate(n),c=Qv(l,o,s??this.service),h=await Wv({headers:{},body:t},this.sha256),f=new this.sha256;f.update(e);const d=Fl(await f.digest()),g=[Aj,u,c,i,d,h].join(`
2702
2702
  `);return this.signString(g,{signingDate:n,signingRegion:o,signingService:s})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:i}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:i,priorSignature:e.priorSignature}).then(s=>({message:e.message,signature:s}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:i}={}){const a=await this.credentialProvider();this.validateResolvedCredentials(a);const s=n??await this.regionProvider(),{shortDate:o}=this.formatDate(t),l=new this.sha256(await this.getSigningKey(a,s,o,i));return l.update(Pd(e)),Fl(await l.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:a,signingService:s}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const l=a??await this.regionProvider(),u=GE(e),{longDate:c,shortDate:h}=this.formatDate(t),f=Qv(h,l,s??this.service);u.headers[aD]=c,o.sessionToken&&(u.headers[gj]=o.sessionToken);const d=await Wv(u,this.sha256);!Fj(mA,u.headers)&&this.applyChecksum&&(u.headers[mA]=d);const g=zE(u,i,n),v=await this.getSignature(c,f,this.getSigningKey(o,l,h,s),this.createCanonicalRequest(u,g,d));return u.headers[iD]=`${$v} Credential=${o.accessKeyId}/${f}, SignedHeaders=${this.getCanonicalHeaderList(g)}, Signature=${v}`,u}async getSignature(e,t,n,i){const a=await this.createStringToSign(e,t,i,$v),s=new this.sha256(await n);return s.update(Pd(a)),Fl(await s.digest())}getSigningKey(e,t,n,i){return xj(this.sha256,e,n,t,i||this.service)}}const Oj=r=>{let e=r.credentials,t=!!r.credentials,n;Object.defineProperty(r,"credentials",{set(u){u&&u!==e&&u!==n&&(t=!0),e=u;const c=Bj(r,{credentials:e,credentialDefaultProvider:r.credentialDefaultProvider}),h=Mj(r,c);if(t&&!h.attributed){const f=typeof e=="object"&&e!==null;n=async d=>{const v=await h(d);return f&&(!v.$source||Object.keys(v.$source).length===0)?Qz(v,"CREDENTIALS_CODE","e"):v},n.memoized=h.memoized,n.configBound=h.configBound,n.attributed=!0}else n=h},get(){return n},enumerable:!0,configurable:!0}),r.credentials=e;const{signingEscapePath:i=!0,systemClockOffset:a=r.systemClockOffset||0,sha256:s}=r;let o;return r.signer?o=sd(r.signer):r.regionInfoProvider?o=()=>sd(r.region)().then(async u=>[await r.regionInfoProvider(u,{useFipsEndpoint:await r.useFipsEndpoint(),useDualstackEndpoint:await r.useDualstackEndpoint()})||{},u]).then(([u,c])=>{const{signingRegion:h,signingService:f}=u;r.signingRegion=r.signingRegion||h||c,r.signingName=r.signingName||f||r.serviceId;const d={...r,credentials:r.credentials,region:r.signingRegion,service:r.signingName,sha256:s,uriEscapePath:i},g=r.signerConstructor||$E;return new g(d)}):o=async u=>{u=Object.assign({},{name:"sigv4",signingName:r.signingName||r.defaultSigningName,signingRegion:await sd(r.region)(),properties:{}},u);const c=u.signingRegion,h=u.signingName;r.signingRegion=r.signingRegion||c,r.signingName=r.signingName||h||r.serviceId;const f={...r,credentials:r.credentials,region:r.signingRegion,service:r.signingName,sha256:s,uriEscapePath:i},d=r.signerConstructor||$E;return new d(f)},Object.assign(r,{systemClockOffset:a,signingEscapePath:i,signer:o})};function Bj(r,{credentials:e,credentialDefaultProvider:t}){let n;return e?e?.memoized?n=e:n=vz(e,mz,OI):t?n=sd(t(Object.assign({},r,{parentClientConfig:r}))):n=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},n.memoized=!0,n}function Mj(r,e){if(e.configBound)return e;const t=async n=>e({...n,callerClientConfig:r});return t.memoized=e.memoized,t.configBound=!0,t}const _j=async(r,e,t)=>({operation:xc(e).operation,region:await Ls(r.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function Nj(r){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-idp",region:r.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function Ur(r){return{schemeId:"smithy.api#noAuth"}}const Lj=r=>{const e=[];switch(r.operation){case"AssociateSoftwareToken":{e.push(Ur());break}case"ChangePassword":{e.push(Ur());break}case"CompleteWebAuthnRegistration":{e.push(Ur());break}case"ConfirmDevice":{e.push(Ur());break}case"ConfirmForgotPassword":{e.push(Ur());break}case"ConfirmSignUp":{e.push(Ur());break}case"DeleteUser":{e.push(Ur());break}case"DeleteUserAttributes":{e.push(Ur());break}case"DeleteWebAuthnCredential":{e.push(Ur());break}case"ForgetDevice":{e.push(Ur());break}case"ForgotPassword":{e.push(Ur());break}case"GetDevice":{e.push(Ur());break}case"GetTokensFromRefreshToken":{e.push(Ur());break}case"GetUser":{e.push(Ur());break}case"GetUserAttributeVerificationCode":{e.push(Ur());break}case"GetUserAuthFactors":{e.push(Ur());break}case"GlobalSignOut":{e.push(Ur());break}case"InitiateAuth":{e.push(Ur());break}case"ListDevices":{e.push(Ur());break}case"ListWebAuthnCredentials":{e.push(Ur());break}case"ResendConfirmationCode":{e.push(Ur());break}case"RespondToAuthChallenge":{e.push(Ur());break}case"RevokeToken":{e.push(Ur());break}case"SetUserMFAPreference":{e.push(Ur());break}case"SetUserSettings":{e.push(Ur());break}case"SignUp":{e.push(Ur());break}case"StartWebAuthnRegistration":{e.push(Ur());break}case"UpdateAuthEventFeedback":{e.push(Ur());break}case"UpdateDeviceStatus":{e.push(Ur());break}case"UpdateUserAttributes":{e.push(Ur());break}case"VerifySoftwareToken":{e.push(Ur());break}case"VerifyUserAttribute":{e.push(Ur());break}default:e.push(Nj(r))}return e},Uj=r=>{const e=Oj(r);return Object.assign(e,{authSchemePreference:Ls(r.authSchemePreference??[])})},Vj=r=>Object.assign(r,{useDualstackEndpoint:r.useDualstackEndpoint??!1,useFipsEndpoint:r.useFipsEndpoint??!1,defaultSigningName:"cognito-idp"}),oD={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},zj="3.1026.0",Hj={version:zj},jj=r=>new TextEncoder().encode(r);var Gj=typeof Buffer<"u"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:jj;function Bd(r){return r instanceof Uint8Array?r:typeof r=="string"?Gj(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r)}function vA(r){return typeof r=="string"?r.length===0:r.byteLength===0}var lD={name:"SHA-256"},qE={name:"HMAC",hash:lD},$j=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 qj={};function Zp(){return typeof window<"u"?window:typeof self<"u"?self:qj}var Qj=(function(){function r(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return r.prototype.update=function(e){if(!vA(e)){var t=Bd(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},r.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return Zp().crypto.subtle.sign(qE,t,e.toHash).then(function(n){return new Uint8Array(n)})}):vA(this.toHash)?Promise.resolve($j):Promise.resolve().then(function(){return Zp().crypto.subtle.digest(lD,e.toHash)}).then(function(t){return Promise.resolve(new Uint8Array(t))})},r.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(t,n){Zp().crypto.subtle.importKey("raw",Bd(e.secret),qE,!1,["sign"]).then(t,n)}),this.key.catch(function(){}))},r})(),ma=64,Wj=32,Yj=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]),Xj=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],Jj=Math.pow(2,53)-1,eg=(function(){function r(){this.state=Int32Array.from(Xj),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return r.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>Jj)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===ma&&(this.hashBuffer(),this.bufferLength=0)},r.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%ma>=ma-8){for(var i=this.bufferLength;i<ma;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<ma-8;i++)t.setUint8(i,0);t.setUint32(ma-8,Math.floor(e/4294967296),!0),t.setUint32(ma-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(Wj),i=0;i<8;i++)a[i*4]=this.state[i]>>>24&255,a[i*4+1]=this.state[i]>>>16&255,a[i*4+2]=this.state[i]>>>8&255,a[i*4+3]=this.state[i]>>>0&255;return a},r.prototype.hashBuffer=function(){for(var e=this,t=e.buffer,n=e.state,i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=n[5],c=n[6],h=n[7],f=0;f<ma;f++){if(f<16)this.temp[f]=(t[f*4]&255)<<24|(t[f*4+1]&255)<<16|(t[f*4+2]&255)<<8|t[f*4+3]&255;else{var d=this.temp[f-2],g=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10;d=this.temp[f-15];var v=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3;this.temp[f]=(g+this.temp[f-7]|0)+(v+this.temp[f-16]|0)}var y=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&u^~l&c)|0)+(h+(Yj[f]+this.temp[f]|0)|0)|0,A=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&s^a&s)|0;h=c,c=u,u=l,l=o+y|0,o=s,s=a,a=i,i=y+A|0}n[0]+=i,n[1]+=a,n[2]+=s,n[3]+=o,n[4]+=l,n[5]+=u,n[6]+=c,n[7]+=h},r})(),Kj=(function(){function r(e){this.secret=e,this.hash=new eg,this.reset()}return r.prototype.update=function(e){if(!(vA(e)||this.error))try{this.hash.update(Bd(e))}catch(t){this.error=t}},r.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()},r.prototype.digest=function(){return Rs(this,void 0,void 0,function(){return Os(this,function(e){return[2,this.digestSync()]})})},r.prototype.reset=function(){if(this.hash=new eg,this.secret){this.outer=new eg;var e=Zj(this.secret),t=new Uint8Array(ma);t.set(e);for(var n=0;n<ma;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(var n=0;n<e.byteLength;n++)e[n]=0}},r})();function Zj(r){var e=Bd(r);if(e.byteLength>ma){var t=new eg;t.update(e),e=t.digest()}var n=new Uint8Array(ma);return n.set(e),n}var eG=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function tG(r){if(rG(r)&&typeof r.crypto.subtle=="object"){var e=r.crypto.subtle;return nG(e)}return!1}function rG(r){if(typeof r=="object"&&typeof r.crypto=="object"){var e=r.crypto.getRandomValues;return typeof e=="function"}return!1}function nG(r){return r&&eG.every(function(e){return typeof r[e]=="function"})}var iG=(function(){function r(e){tG(Zp())?this.hash=new Qj(e):this.hash=new Kj(e)}return r.prototype.update=function(e,t){this.hash.update(Bd(e))},r.prototype.digest=function(){return this.hash.digest()},r.prototype.reset=function(){this.hash.reset()},r})();const aG=({serviceId:r,clientVersion:e})=>async t=>{const n=typeof window<"u"?window.navigator:void 0,i=n?.userAgent??"",a=n?.userAgentData?.platform??QE.os(i)??"other",s=void 0,o=n?.userAgentData?.brands??[],l=o[o.length-1],u=l?.brand??QE.browser(i)??"unknown",c=l?.version??"unknown",h=[["aws-sdk-js",e],["ua","2.1"],[`os/${a}`,s],["lang/js"],["md/browser",`${u}_${c}`]];r&&h.push([`api/${r}`,e]);const f=await t?.userAgentAppId?.();return f&&h.push([`app/${f}`]),h},QE={os(r){if(/iPhone|iPad|iPod/.test(r))return"iOS";if(/Macintosh|Mac OS X/.test(r))return"macOS";if(/Windows NT/.test(r))return"Windows";if(/Android/.test(r))return"Android";if(/Linux/.test(r))return"Linux"},browser(r){if(/EdgiOS|EdgA|Edg\//.test(r))return"Microsoft Edge";if(/Firefox\//.test(r))return"Firefox";if(/Chrome\//.test(r))return"Chrome";if(/Safari\//.test(r))return"Safari"}},sG=r=>()=>Promise.reject(r),WE=typeof TextEncoder=="function"?new TextEncoder:null,oG=r=>{if(typeof r=="string"){if(WE)return WE.encode(r).byteLength;let e=r.length;for(let t=e-1;t>=0;t--){const n=r.charCodeAt(t);n>127&&n<=2047?e++:n>2047&&n<=65535&&(e+=2),n>=56320&&n<=57343&&t--}return e}else{if(typeof r.byteLength=="number")return r.byteLength;if(typeof r.size=="number")return r.size}throw new Error(`Body Length computation failed for ${r}`)},lG=["in-region","cross-region","mobile","standard","legacy"],uG=({defaultsMode:r}={})=>oj(async()=>{const e=typeof r=="function"?await r():r;switch(e?.toLowerCase()){case"auto":return Promise.resolve(cG()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${lG.join(", ")}, got ${e}`)}}),cG=()=>{const r=window?.navigator;if(r?.connection){const{effectiveType:e,rtt:t,downlink:n}=r?.connection;if(typeof e=="string"&&e!=="4g"||Number(t)>100||Number(n)<10)return!0}return r?.userAgentData?.mobile||typeof r?.maxTouchPoints=="number"&&r?.maxTouchPoints>1};class fG{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){const n=t.getMemberSchemas(),i=Object.values(n).find(a=>!!a.getMergedTraits().httpPayload);if(i){const a=i.getMergedTraits().mediaType;return a||(i.isStringSchema()?"text/plain":i.isBlobSchema()?"application/octet-stream":e)}else if(!t.isUnitSchema()&&Object.values(n).find(s=>{const{httpQuery:o,httpQueryParams:l,httpHeader:u,httpLabel:c,httpPrefixHeaders:h}=s.getMergedTraits();return!o&&!l&&!u&&!c&&h===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,t,n,i,a,s){let o=e;e.includes("#")&&([,o]=e.split("#"));const l={$metadata:a,$fault:n.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:s?.(this.errorRegistry,o)??this.errorRegistry.getSchema(e),errorMetadata:l}}catch{i.message=i.message??i.Message??"UnknownError";const c=this.errorRegistry,h=c.getBaseException();if(h){const g=c.getErrorCtor(h)??Error;throw this.decorateServiceException(Object.assign(new g({name:o}),l),i)}const f=i,d=f?.message??f?.Message??f?.Error?.Message??f?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(d),{name:o},l),i)}}compose(e,t,n){let i=n;t.includes("#")&&([i]=t.split("#"));const a=ra.for(i),s=ra.for("smithy.ts.sdk.synthetic."+n);e.copyFrom(a),e.copyFrom(s),this.errorRegistry=e}decorateServiceException(e,t={}){if(this.queryCompat){const n=e.Message??t.Message,i=_E(e,t);n&&(i.message=n),i.Error={...i.Error,Type:i.Error?.Type,Code:i.Error?.Code,Message:i.Error?.message??i.Error?.Message??n};const a=i.$metadata.requestId;return a&&(i.RequestId=a),i}return _E(e,t)}setQueryCompatError(e,t){const n=t.headers?.["x-amzn-query-error"];if(e!==void 0&&n!=null){const[i,a]=n.split(";"),s=Object.entries(e),o={Code:i,Type:a};Object.assign(e,o);for(const[l,u]of s)o[l==="message"?"Message":l]=u;delete o.__type,e.Error=o}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code)}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch{return e.find(i=>vi.of(i).getMergedTraits().awsQueryError?.[0]===t)}}}class N1{serdeContext;setSerdeContext(e){this.serdeContext=e}}class dG{from;to;keys;constructor(e,t){this.from=e,this.to=t,this.keys=new Set(Object.keys(this.from).filter(n=>n!=="__type"))}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){const e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t]}}}function hG(r,e,t){if(t?.source){const n=t.source;if(typeof e=="number"&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER||n!==String(e)))return n.includes(".")?new ts(n,"bigDecimal"):BigInt(n)}return e}const pG=(r,e)=>dA(r,e).then(t=>(e?.utf8Encoder??rm)(t)),gG=(r,e)=>pG(r,e).then(t=>{if(t.length)try{return JSON.parse(t)}catch(n){throw n?.name==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:t}),n}return{}}),mG=(r,e)=>{const t=(a,s)=>Object.keys(a).find(o=>o.toLowerCase()===s.toLowerCase()),n=a=>{let s=a;return typeof s=="number"&&(s=s.toString()),s.indexOf(",")>=0&&(s=s.split(",")[0]),s.indexOf(":")>=0&&(s=s.split(":")[0]),s.indexOf("#")>=0&&(s=s.split("#")[1]),s},i=t(r.headers,"x-amzn-errortype");if(i!==void 0)return n(r.headers[i]);if(e&&typeof e=="object"){const a=t(e,"code");if(a&&e[a]!==void 0)return n(e[a]);if(e.__type!==void 0)return n(e.__type)}};class vG extends N1{settings;constructor(e){super(),this.settings=e}async read(e,t){return this._read(e,typeof t=="string"?JSON.parse(t,hG):await gG(t,this.serdeContext))}readObject(e,t){return this._read(e,t)}_read(e,t){const n=t!==null&&typeof t=="object",i=vi.of(e);if(n){if(i.isStructSchema()){const s=t,o=i.isUnionSchema(),l={};let u;const{jsonName:c}=this.settings;c&&(u={});let h;o&&(h=new dG(s,l));for(const[f,d]of i.structIterator()){let g=f;c&&(g=d.getMergedTraits().jsonName??g,u[g]=f),o&&h.mark(g),s[g]!=null&&(l[f]=this._read(d,s[g]))}if(o)h.writeUnknown();else if(typeof s.__type=="string")for(const[f,d]of Object.entries(s)){const g=c?u[f]??f:f;g in l||(l[g]=d)}return l}if(Array.isArray(t)&&i.isListSchema()){const s=i.getValueSchema(),o=[];for(const l of t)o.push(this._read(s,l));return o}if(i.isMapSchema()){const s=i.getValueSchema(),o={};for(const[l,u]of Object.entries(t))o[l]=this._read(s,u);return o}}if(i.isBlobSchema()&&typeof t=="string")return tm(t);const a=i.getMergedTraits().mediaType;if(i.isStringSchema()&&typeof t=="string"&&a)return a==="application/json"||a.endsWith("+json")?go.from(t):t;if(i.isTimestampSchema()&&t!=null)switch(RI(i,this.settings)){case 5:return YV(t);case 6:return DI(t);case 7:return ZV(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(i.isBigIntegerSchema()&&(typeof t=="number"||typeof t=="string"))return BigInt(t);if(i.isBigDecimalSchema()&&t!=null){if(t instanceof ts)return t;const s=t;return s.type==="bigDecimal"&&"string"in s?new ts(s.string,s.type):new ts(String(t),"bigDecimal")}if(i.isNumericSchema()&&typeof t=="string"){switch(t){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return t}if(i.isDocumentSchema())if(n){const s=Array.isArray(t)?[]:{};for(const[o,l]of Object.entries(t))l instanceof ts?s[o]=l:s[o]=this._read(i,l);return s}else return structuredClone(t);return t}}const YE="Ν";class yG{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,t)=>{if(t instanceof ts){const n=`${YE+"nv"+this.counter++}_`+t.string;return this.values.set(`"${n}"`,t.string),n}if(typeof t=="bigint"){const n=t.toString(),i=`${YE+"b"+this.counter++}_`+n;return this.values.set(`"${i}"`,n),i}return t}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(const[t,n]of this.values)e=e.replace(t,n);return e}}class AG extends N1{settings;buffer;useReplacer=!1;rootSchema;constructor(e){super(),this.settings=e}write(e,t){this.rootSchema=vi.of(e),this.buffer=this._write(this.rootSchema,t)}writeDiscriminatedDocument(e,t){this.write(e,t),typeof this.buffer=="object"&&(this.buffer.__type=vi.of(e).getName(!0))}flush(){const{rootSchema:e,useReplacer:t}=this;if(this.rootSchema=void 0,this.useReplacer=!1,e?.isStructSchema()||e?.isDocumentSchema()){if(!t)return JSON.stringify(this.buffer);const n=new yG;return n.replaceInJson(JSON.stringify(this.buffer,n.createReplacer(),0))}return this.buffer}_write(e,t,n){const i=t!==null&&typeof t=="object",a=vi.of(e);if(i){if(a.isStructSchema()){const s=t,o={},{jsonName:l}=this.settings;let u;l&&(u={});for(const[c,h]of a.structIterator()){const f=this._write(h,s[c],a);if(f!==void 0){let d=c;l&&(d=h.getMergedTraits().jsonName??c,u[c]=d),o[d]=f}}if(a.isUnionSchema()&&Object.keys(o).length===0){const{$unknown:c}=s;if(Array.isArray(c)){const[h,f]=c;o[h]=this._write(15,f)}}else if(typeof s.__type=="string")for(const[c,h]of Object.entries(s)){const f=l?u[c]??c:c;f in o||(o[f]=this._write(15,h))}return o}if(Array.isArray(t)&&a.isListSchema()){const s=a.getValueSchema(),o=[],l=!!a.getMergedTraits().sparse;for(const u of t)(l||u!=null)&&o.push(this._write(s,u));return o}if(a.isMapSchema()){const s=a.getValueSchema(),o={},l=!!a.getMergedTraits().sparse;for(const[u,c]of Object.entries(t))(l||c!=null)&&(o[u]=this._write(s,c));return o}if(t instanceof Uint8Array&&(a.isBlobSchema()||a.isDocumentSchema()))return a===this.rootSchema?t:(this.serdeContext?.base64Encoder??wg)(t);if(t instanceof Date&&(a.isTimestampSchema()||a.isDocumentSchema()))switch(RI(a,this.settings)){case 5:return t.toISOString().replace(".000Z","Z");case 6:return QV(t);case 7:return t.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",t),t.getTime()/1e3}t instanceof ts&&(this.useReplacer=!0)}if(!(t===null&&n?.isStructSchema())){if(a.isStringSchema()){if(typeof t>"u"&&a.isIdempotencyToken())return PI();const s=a.getMergedTraits().mediaType;return t!=null&&s&&(s==="application/json"||s.endsWith("+json"))?go.from(t):t}if(typeof t=="number"&&a.isNumericSchema())return Math.abs(t)===1/0||isNaN(t)?String(t):t;if(typeof t=="string"&&a.isBlobSchema())return a===this.rootSchema?t:(this.serdeContext?.base64Encoder??wg)(t);if(typeof t=="bigint"&&(this.useReplacer=!0),a.isDocumentSchema())if(i){const s=Array.isArray(t)?[]:{};for(const[o,l]of Object.entries(t))l instanceof ts?(this.useReplacer=!0,s[o]=l):s[o]=this._write(a,l);return s}else return structuredClone(t);return t}}}class bG extends N1{settings;constructor(e){super(),this.settings=e}createSerializer(){const e=new AG(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){const e=new vG(this.settings);return e.setSerdeContext(this.serdeContext),e}}class CG extends cz{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t}),this.serviceTarget=n,this.codec=a??new bG({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!i,this.mixin=new fG(this.awsQueryCompatible)}async serializeRequest(e,t,n){const i=await super.serializeRequest(e,t,n);return i.path.endsWith("/")||(i.path+="/"),Object.assign(i.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${e.name}`}),this.awsQueryCompatible&&(i.headers["x-amzn-query-mode"]="true"),(Jp(e.input)==="unit"||!i.body)&&(i.body="{}"),i}getPayloadCodec(){return this.codec}async handleError(e,t,n,i,a){this.awsQueryCompatible&&this.mixin.setQueryCompatError(i,n);const s=mG(n,i)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,s,this.options.defaultNamespace);const{errorSchema:o,errorMetadata:l}=await this.mixin.getErrorSchemaOrThrowBaseException(s,this.options.defaultNamespace,n,i,a,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),u=vi.of(o),c=i.message??i.Message??"UnknownError",h=this.compositeErrorRegistry.getErrorCtor(o)??Error,f=new h(c),d={};for(const[g,v]of u.structIterator())i[g]!=null&&(d[g]=this.codec.createDeserializer().readObject(v,i[g]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(i,d),this.mixin.decorateServiceException(Object.assign(f,l,{$fault:u.getMergedTraits().error,message:c},d),i)}}class wG extends CG{constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}const uD="required",Ii="fn",Di="argv",Sc="ref",XE=!0,JE="isSet",Md="booleanEquals",Pu="error",Ja="endpoint",Ts="tree",L1="PartitionResult",U1="getAttr",Mf="stringEquals",KE={[uD]:!1,type:"string"},ZE={[uD]:!0,default:!1,type:"boolean"},e2={[Sc]:"Endpoint"},cD={[Ii]:Md,[Di]:[{[Sc]:"UseFIPS"},!0]},fD={[Ii]:Md,[Di]:[{[Sc]:"UseDualStack"},!0]},ti={},Xf={[Sc]:"Region"},t2={[Ii]:U1,[Di]:[{[Sc]:L1},"supportsFIPS"]},dD={[Sc]:L1},r2={[Ii]:Md,[Di]:[!0,{[Ii]:U1,[Di]:[dD,"supportsDualStack"]}]},n2=[cD],i2=[fD],a2=[Xf],xG={parameters:{Region:KE,UseDualStack:ZE,UseFIPS:ZE,Endpoint:KE},rules:[{conditions:[{[Ii]:JE,[Di]:[e2]}],rules:[{conditions:n2,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:Pu},{conditions:i2,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:Pu},{endpoint:{url:e2,properties:ti,headers:ti},type:Ja}],type:Ts},{conditions:[{[Ii]:JE,[Di]:a2}],rules:[{conditions:[{[Ii]:"aws.partition",[Di]:a2,assign:L1}],rules:[{conditions:[cD,fD],rules:[{conditions:[{[Ii]:Md,[Di]:[XE,t2]},r2],rules:[{conditions:[{[Ii]:Mf,[Di]:[Xf,"us-east-1"]}],endpoint:{url:"https://cognito-idp-fips.us-east-1.amazonaws.com",properties:ti,headers:ti},type:Ja},{conditions:[{[Ii]:Mf,[Di]:[Xf,"us-east-2"]}],endpoint:{url:"https://cognito-idp-fips.us-east-2.amazonaws.com",properties:ti,headers:ti},type:Ja},{conditions:[{[Ii]:Mf,[Di]:[Xf,"us-west-1"]}],endpoint:{url:"https://cognito-idp-fips.us-west-1.amazonaws.com",properties:ti,headers:ti},type:Ja},{conditions:[{[Ii]:Mf,[Di]:[Xf,"us-west-2"]}],endpoint:{url:"https://cognito-idp-fips.us-west-2.amazonaws.com",properties:ti,headers:ti},type:Ja},{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:ti,headers:ti},type:Ja}],type:Ts},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:Pu}],type:Ts},{conditions:n2,rules:[{conditions:[{[Ii]:Md,[Di]:[t2,XE]}],rules:[{endpoint:{url:"https://cognito-idp-fips.{Region}.{PartitionResult#dnsSuffix}",properties:ti,headers:ti},type:Ja}],type:Ts},{error:"FIPS is enabled but this partition does not support FIPS",type:Pu}],type:Ts},{conditions:i2,rules:[{conditions:[r2],rules:[{conditions:[{[Ii]:Mf,[Di]:["aws",{[Ii]:U1,[Di]:[dD,"name"]}]}],endpoint:{url:"https://cognito-idp.{Region}.amazonaws.com",properties:ti,headers:ti},type:Ja},{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:ti,headers:ti},type:Ja}],type:Ts},{error:"DualStack is enabled but this partition does not support DualStack",type:Pu}],type:Ts},{endpoint:{url:"https://cognito-idp.{Region}.{PartitionResult#dnsSuffix}",properties:ti,headers:ti},type:Ja}],type:Ts}],type:Ts},{error:"Invalid Configuration: Missing Region",type:Pu}]},SG=xG,EG=new Cz({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),kG=(r,e={})=>EG.get(r,()=>Vz(SG,{endpointParams:r,logger:e.logger}));Sg.aws=$I;class xt extends Hu{constructor(e){super(e),Object.setPrototypeOf(this,xt.prototype)}}class V1 extends xt{name="AccessDeniedException";$fault="client";constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,V1.prototype)}}class z1 extends xt{name="InternalErrorException";$fault="server";constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),Object.setPrototypeOf(this,z1.prototype)}}class H1 extends xt{name="InvalidParameterException";$fault="client";reasonCode;constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),Object.setPrototypeOf(this,H1.prototype),this.reasonCode=e.reasonCode}}class j1 extends xt{name="NotAuthorizedException";$fault="client";constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,j1.prototype)}}class G1 extends xt{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,G1.prototype)}}class $1 extends xt{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),Object.setPrototypeOf(this,$1.prototype)}}class q1 extends xt{name="UserImportInProgressException";$fault="client";constructor(e){super({name:"UserImportInProgressException",$fault:"client",...e}),Object.setPrototypeOf(this,q1.prototype)}}class Q1 extends xt{name="InternalServerException";$fault="server";constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,Q1.prototype)}}class W1 extends xt{name="LimitExceededException";$fault="client";constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,W1.prototype)}}class Y1 extends xt{name="UserNotFoundException";$fault="client";constructor(e){super({name:"UserNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,Y1.prototype)}}class X1 extends xt{name="InvalidLambdaResponseException";$fault="client";constructor(e){super({name:"InvalidLambdaResponseException",$fault:"client",...e}),Object.setPrototypeOf(this,X1.prototype)}}class J1 extends xt{name="TooManyFailedAttemptsException";$fault="client";constructor(e){super({name:"TooManyFailedAttemptsException",$fault:"client",...e}),Object.setPrototypeOf(this,J1.prototype)}}class K1 extends xt{name="UnexpectedLambdaException";$fault="client";constructor(e){super({name:"UnexpectedLambdaException",$fault:"client",...e}),Object.setPrototypeOf(this,K1.prototype)}}class Z1 extends xt{name="UserLambdaValidationException";$fault="client";constructor(e){super({name:"UserLambdaValidationException",$fault:"client",...e}),Object.setPrototypeOf(this,Z1.prototype)}}class eb extends xt{name="CodeDeliveryFailureException";$fault="client";constructor(e){super({name:"CodeDeliveryFailureException",$fault:"client",...e}),Object.setPrototypeOf(this,eb.prototype)}}class tb extends xt{name="InvalidPasswordException";$fault="client";constructor(e){super({name:"InvalidPasswordException",$fault:"client",...e}),Object.setPrototypeOf(this,tb.prototype)}}class rb extends xt{name="InvalidSmsRoleAccessPolicyException";$fault="client";constructor(e){super({name:"InvalidSmsRoleAccessPolicyException",$fault:"client",...e}),Object.setPrototypeOf(this,rb.prototype)}}class nb extends xt{name="InvalidSmsRoleTrustRelationshipException";$fault="client";constructor(e){super({name:"InvalidSmsRoleTrustRelationshipException",$fault:"client",...e}),Object.setPrototypeOf(this,nb.prototype)}}class ib extends xt{name="PreconditionNotMetException";$fault="client";constructor(e){super({name:"PreconditionNotMetException",$fault:"client",...e}),Object.setPrototypeOf(this,ib.prototype)}}class ab extends xt{name="UnsupportedUserStateException";$fault="client";constructor(e){super({name:"UnsupportedUserStateException",$fault:"client",...e}),Object.setPrototypeOf(this,ab.prototype)}}class sb extends xt{name="UsernameExistsException";$fault="client";constructor(e){super({name:"UsernameExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,sb.prototype)}}class ob extends xt{name="AliasExistsException";$fault="client";constructor(e){super({name:"AliasExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,ob.prototype)}}class lb extends xt{name="InvalidUserPoolConfigurationException";$fault="client";constructor(e){super({name:"InvalidUserPoolConfigurationException",$fault:"client",...e}),Object.setPrototypeOf(this,lb.prototype)}}class ub extends xt{name="InvalidEmailRoleAccessPolicyException";$fault="client";constructor(e){super({name:"InvalidEmailRoleAccessPolicyException",$fault:"client",...e}),Object.setPrototypeOf(this,ub.prototype)}}class cb extends xt{name="MFAMethodNotFoundException";$fault="client";constructor(e){super({name:"MFAMethodNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,cb.prototype)}}class fb extends xt{name="PasswordResetRequiredException";$fault="client";constructor(e){super({name:"PasswordResetRequiredException",$fault:"client",...e}),Object.setPrototypeOf(this,fb.prototype)}}class db extends xt{name="UnsupportedOperationException";$fault="client";constructor(e){super({name:"UnsupportedOperationException",$fault:"client",...e}),Object.setPrototypeOf(this,db.prototype)}}class hb extends xt{name="UserNotConfirmedException";$fault="client";constructor(e){super({name:"UserNotConfirmedException",$fault:"client",...e}),Object.setPrototypeOf(this,hb.prototype)}}class pb extends xt{name="UserPoolAddOnNotEnabledException";$fault="client";constructor(e){super({name:"UserPoolAddOnNotEnabledException",$fault:"client",...e}),Object.setPrototypeOf(this,pb.prototype)}}class gb extends xt{name="CodeMismatchException";$fault="client";constructor(e){super({name:"CodeMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,gb.prototype)}}class mb extends xt{name="ExpiredCodeException";$fault="client";constructor(e){super({name:"ExpiredCodeException",$fault:"client",...e}),Object.setPrototypeOf(this,mb.prototype)}}class vb extends xt{name="PasswordHistoryPolicyViolationException";$fault="client";constructor(e){super({name:"PasswordHistoryPolicyViolationException",$fault:"client",...e}),Object.setPrototypeOf(this,vb.prototype)}}class yb extends xt{name="SoftwareTokenMFANotFoundException";$fault="client";constructor(e){super({name:"SoftwareTokenMFANotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,yb.prototype)}}class Ab extends xt{name="ConcurrentModificationException";$fault="client";constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),Object.setPrototypeOf(this,Ab.prototype)}}class bb extends xt{name="ForbiddenException";$fault="client";constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),Object.setPrototypeOf(this,bb.prototype)}}class Cb extends xt{name="WebAuthnChallengeNotFoundException";$fault="client";constructor(e){super({name:"WebAuthnChallengeNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,Cb.prototype)}}class wb extends xt{name="WebAuthnClientMismatchException";$fault="client";constructor(e){super({name:"WebAuthnClientMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,wb.prototype)}}class xb extends xt{name="WebAuthnCredentialNotSupportedException";$fault="client";constructor(e){super({name:"WebAuthnCredentialNotSupportedException",$fault:"client",...e}),Object.setPrototypeOf(this,xb.prototype)}}class Sb extends xt{name="WebAuthnNotEnabledException";$fault="client";constructor(e){super({name:"WebAuthnNotEnabledException",$fault:"client",...e}),Object.setPrototypeOf(this,Sb.prototype)}}class Eb extends xt{name="WebAuthnOriginNotAllowedException";$fault="client";constructor(e){super({name:"WebAuthnOriginNotAllowedException",$fault:"client",...e}),Object.setPrototypeOf(this,Eb.prototype)}}class kb extends xt{name="WebAuthnRelyingPartyMismatchException";$fault="client";constructor(e){super({name:"WebAuthnRelyingPartyMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,kb.prototype)}}class Fb extends xt{name="DeviceKeyExistsException";$fault="client";constructor(e){super({name:"DeviceKeyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Fb.prototype)}}class Tb extends xt{name="GroupExistsException";$fault="client";constructor(e){super({name:"GroupExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Tb.prototype)}}class Ib extends xt{name="DuplicateProviderException";$fault="client";constructor(e){super({name:"DuplicateProviderException",$fault:"client",...e}),Object.setPrototypeOf(this,Ib.prototype)}}class Db extends xt{name="ManagedLoginBrandingExistsException";$fault="client";constructor(e){super({name:"ManagedLoginBrandingExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Db.prototype)}}class Pb extends xt{name="TermsExistsException";$fault="client";constructor(e){super({name:"TermsExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Pb.prototype)}}class Rb extends xt{name="FeatureUnavailableInTierException";$fault="client";constructor(e){super({name:"FeatureUnavailableInTierException",$fault:"client",...e}),Object.setPrototypeOf(this,Rb.prototype)}}class Ob extends xt{name="TierChangeNotAllowedException";$fault="client";constructor(e){super({name:"TierChangeNotAllowedException",$fault:"client",...e}),Object.setPrototypeOf(this,Ob.prototype)}}class Bb extends xt{name="UserPoolTaggingException";$fault="client";constructor(e){super({name:"UserPoolTaggingException",$fault:"client",...e}),Object.setPrototypeOf(this,Bb.prototype)}}class Mb extends xt{name="InvalidOAuthFlowException";$fault="client";constructor(e){super({name:"InvalidOAuthFlowException",$fault:"client",...e}),Object.setPrototypeOf(this,Mb.prototype)}}class _b extends xt{name="ScopeDoesNotExistException";$fault="client";constructor(e){super({name:"ScopeDoesNotExistException",$fault:"client",...e}),Object.setPrototypeOf(this,_b.prototype)}}class Nb extends xt{name="UnsupportedIdentityProviderException";$fault="client";constructor(e){super({name:"UnsupportedIdentityProviderException",$fault:"client",...e}),Object.setPrototypeOf(this,Nb.prototype)}}class Lb extends xt{name="RefreshTokenReuseException";$fault="client";constructor(e){super({name:"RefreshTokenReuseException",$fault:"client",...e}),Object.setPrototypeOf(this,Lb.prototype)}}class Ub extends xt{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,Ub.prototype)}}class Vb extends xt{name="UnsupportedTokenTypeException";$fault="client";constructor(e){super({name:"UnsupportedTokenTypeException",$fault:"client",...e}),Object.setPrototypeOf(this,Vb.prototype)}}class zb extends xt{name="WebAuthnConfigurationMissingException";$fault="client";constructor(e){super({name:"WebAuthnConfigurationMissingException",$fault:"client",...e}),Object.setPrototypeOf(this,zb.prototype)}}class Hb extends xt{name="EnableSoftwareTokenMFAException";$fault="client";constructor(e){super({name:"EnableSoftwareTokenMFAException",$fault:"client",...e}),Object.setPrototypeOf(this,Hb.prototype)}}const FG="AvailableChallenges",TG="AccessDeniedException",IG="AliasExistsException",DG="AnalyticsEndpointId",PG="AuthFlow",hD="AnalyticsMetadata",RG="AnalyticsMetadataType",OG="AuthParameters",BG="AuthParametersType",pD="AuthenticationResult",MG="AuthenticationResultType",_G="AccessToken",NG="CodeDeliveryFailureException",gD="ClientId",LG="ClientIdType",mD="ClientMetadata",UG="CodeMismatchException",VG="ConcurrentModificationException",jb="ChallengeName",vD="ChallengeParameters",zG="ChallengeResponses",HG="ChallengeResponsesType",jG="DeviceGroupKey",GG="DeviceKey",$G="DeviceKeyExistsException",qG="DuplicateProviderException",QG="ExpiredCodeException",WG="EncodedData",YG="ExpiresIn",XG="EnableSoftwareTokenMFAException",JG="ForbiddenException",KG="FeatureUnavailableInTierException",ZG="GroupExistsException",e$="IpAddress",t$="InitiateAuthRequest",r$="InitiateAuthResponse",n$="InitiateAuth",i$="InternalErrorException",a$="InvalidEmailRoleAccessPolicyException",s$="InvalidLambdaResponseException",o$="InvalidOAuthFlowException",l$="InvalidParameterException",u$="InvalidPasswordException",c$="InternalServerException",f$="InvalidSmsRoleAccessPolicyException",d$="InvalidSmsRoleTrustRelationshipException",h$="IdToken",p$="InvalidUserPoolConfigurationException",g$="LimitExceededException",m$="MFAMethodNotFoundException",v$="ManagedLoginBrandingExistsException",y$="NotAuthorizedException",A$="NewDeviceMetadata",b$="NewDeviceMetadataType",C$="PasswordHistoryPolicyViolationException",w$="PreconditionNotMetException",x$="PasswordResetRequiredException",S$="ResourceNotFoundException",E$="RefreshToken",k$="RespondToAuthChallenge",F$="RespondToAuthChallengeRequest",T$="RespondToAuthChallengeResponse",I$="RefreshTokenReuseException",sm="Session",D$="ScopeDoesNotExistException",P$="SessionType",R$="SoftwareTokenMFANotFoundException",O$="TierChangeNotAllowedException",B$="TermsExistsException",M$="TooManyFailedAttemptsException",_$="TooManyRequestsException",N$="TokenModelType",L$="TokenType",U$="UserContextDataType",yD="UserContextData",V$="UnauthorizedException",z$="UsernameExistsException",H$="UserImportInProgressException",j$="UnsupportedIdentityProviderException",G$="UnexpectedLambdaException",$$="UserLambdaValidationException",q$="UserNotConfirmedException",Q$="UserNotFoundException",W$="UnsupportedOperationException",Y$="UserPoolAddOnNotEnabledException",X$="UserPoolTaggingException",J$="UnsupportedTokenTypeException",K$="UnsupportedUserStateException",Z$="WebAuthnClientMismatchException",eq="WebAuthnConfigurationMissingException",tq="WebAuthnChallengeNotFoundException",rq="WebAuthnCredentialNotSupportedException",nq="WebAuthnNotEnabledException",iq="WebAuthnOriginNotAllowedException",aq="WebAuthnRelyingPartyMismatchException",Ot="client",Ft="error",Bt="httpError",Tt="message",sq="reasonCode",AD="smithy.ts.sdk.synthetic.com.amazonaws.cognitoidentityprovider",bD="server",at="com.amazonaws.cognitoidentityprovider",CD=ra.for(AD);var oq=[-3,AD,"CognitoIdentityProviderServiceException",0,[],[]];CD.registerError(oq,xt);const kt=ra.for(at);var lq=[-3,at,TG,{[Ft]:Ot,[Bt]:403},[Tt],[0]];kt.registerError(lq,V1);var uq=[-3,at,IG,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(uq,ob);var cq=[-3,at,NG,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(cq,eb);var fq=[-3,at,UG,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(fq,gb);var dq=[-3,at,VG,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(dq,Ab);var hq=[-3,at,$G,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(hq,Fb);var pq=[-3,at,qG,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(pq,Ib);var gq=[-3,at,XG,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(gq,Hb);var mq=[-3,at,QG,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(mq,mb);var vq=[-3,at,KG,{[Ft]:Ot,[Bt]:403},[Tt],[0]];kt.registerError(vq,Rb);var yq=[-3,at,JG,{[Ft]:Ot,[Bt]:403},[Tt],[0]];kt.registerError(yq,bb);var Aq=[-3,at,ZG,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Aq,Tb);var bq=[-3,at,i$,{[Ft]:bD},[Tt],[0]];kt.registerError(bq,z1);var Cq=[-3,at,c$,{[Ft]:bD},[Tt],[0]];kt.registerError(Cq,Q1);var wq=[-3,at,a$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(wq,ub);var xq=[-3,at,s$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(xq,X1);var Sq=[-3,at,o$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Sq,Mb);var Eq=[-3,at,l$,{[Ft]:Ot,[Bt]:400},[Tt,sq],[0,0]];kt.registerError(Eq,H1);var kq=[-3,at,u$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(kq,tb);var Fq=[-3,at,f$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Fq,rb);var Tq=[-3,at,d$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Tq,nb);var Iq=[-3,at,p$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Iq,lb);var Dq=[-3,at,g$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Dq,W1);var Pq=[-3,at,v$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Pq,Db);var Rq=[-3,at,m$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Rq,cb);var Oq=[-3,at,y$,{[Ft]:Ot,[Bt]:403},[Tt],[0]];kt.registerError(Oq,j1);var Bq=[-3,at,C$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Bq,vb);var Mq=[-3,at,x$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Mq,fb);var _q=[-3,at,w$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(_q,ib);var Nq=[-3,at,I$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Nq,Lb);var Lq=[-3,at,S$,{[Ft]:Ot,[Bt]:404},[Tt],[0]];kt.registerError(Lq,G1);var Uq=[-3,at,D$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Uq,_b);var Vq=[-3,at,R$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Vq,yb);var zq=[-3,at,B$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(zq,Pb);var Hq=[-3,at,O$,{[Ft]:Ot,[Bt]:403},[Tt],[0]];kt.registerError(Hq,Ob);var jq=[-3,at,M$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(jq,J1);var Gq=[-3,at,_$,{[Ft]:Ot,[Bt]:429},[Tt],[0]];kt.registerError(Gq,$1);var $q=[-3,at,V$,{[Ft]:Ot,[Bt]:401},[Tt],[0]];kt.registerError($q,Ub);var qq=[-3,at,G$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(qq,K1);var Qq=[-3,at,j$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Qq,Nb);var Wq=[-3,at,W$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Wq,db);var Yq=[-3,at,J$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Yq,Vb);var Xq=[-3,at,K$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Xq,ab);var Jq=[-3,at,H$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Jq,q1);var Kq=[-3,at,$$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Kq,Z1);var Zq=[-3,at,z$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(Zq,sb);var eQ=[-3,at,q$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(eQ,hb);var tQ=[-3,at,Q$,{[Ft]:Ot,[Bt]:404},[Tt],[0]];kt.registerError(tQ,Y1);var rQ=[-3,at,Y$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(rQ,pb);var nQ=[-3,at,X$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(nQ,Bb);var iQ=[-3,at,tq,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(iQ,Cb);var aQ=[-3,at,Z$,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(aQ,wb);var sQ=[-3,at,eq,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(sQ,zb);var oQ=[-3,at,rq,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(oQ,xb);var lQ=[-3,at,nq,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(lQ,Sb);var uQ=[-3,at,iq,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(uQ,Eb);var cQ=[-3,at,aq,{[Ft]:Ot,[Bt]:400},[Tt],[0]];kt.registerError(cQ,kb);const fQ=[CD,kt];var wD=[0,at,LG,8,0],om=[0,at,P$,8,0],Yv=[0,at,N$,8,0],xD=[3,at,RG,0,[DG],[0]],SD=[3,at,MG,0,[_G,YG,L$,E$,h$,A$],[[()=>Yv,0],1,0,[()=>Yv,0],[()=>Yv,0],()=>pQ]],dQ=[3,at,t$,0,[PG,gD,OG,mD,hD,yD,sm],[0,[()=>wD,0],[()=>vQ,0],128,()=>xD,[()=>ED,0],[()=>om,0]],2],hQ=[3,at,r$,0,[jb,sm,vD,pD,FG],[0,[()=>om,0],128,[()=>SD,0],64]],pQ=[3,at,b$,0,[GG,jG],[0,0]],gQ=[3,at,F$,0,[gD,jb,sm,zG,hD,yD,mD],[[()=>wD,0],0,[()=>om,0],[()=>yQ,0],()=>xD,[()=>ED,0],128],2],mQ=[3,at,T$,0,[jb,sm,vD,pD],[0,[()=>om,0],128,[()=>SD,0]]],ED=[3,at,U$,8,[e$,WG],[0,0]],vQ=[2,at,BG,8,0,0],yQ=[2,at,HG,8,0,0],AQ=[9,at,n$,0,()=>dQ,()=>hQ],bQ=[9,at,k$,0,()=>gQ,()=>mQ];const CQ=r=>({apiVersion:"2016-04-18",base64Decoder:r?.base64Decoder??tm,base64Encoder:r?.base64Encoder??wg,disableHostPrefix:r?.disableHostPrefix??!1,endpointProvider:r?.endpointProvider??kG,extensions:r?.extensions??[],httpAuthSchemeProvider:r?.httpAuthSchemeProvider??Lj,httpAuthSchemes:r?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new sj},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new hz}],logger:r?.logger??new ZI,protocol:r?.protocol??wG,protocolSettings:r?.protocolSettings??{defaultNamespace:"com.amazonaws.cognitoidentityprovider",errorTypeRegistries:fQ,xmlNamespace:"http://cognito-idp.amazonaws.com/doc/2016-04-18/",version:"2016-04-18",serviceTarget:"AWSCognitoIdentityProviderService"},serviceId:r?.serviceId??"Cognito Identity Provider",urlParser:r?.urlParser??hc,utf8Decoder:r?.utf8Decoder??Dl,utf8Encoder:r?.utf8Encoder??rm}),wQ=r=>{const e=uG(r),t=()=>e().then(jH),n=CQ(r);return{...n,...r,runtime:"browser",defaultsMode:e,bodyLengthChecker:r?.bodyLengthChecker??oG,credentialDefaultProvider:r?.credentialDefaultProvider??(i=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:r?.defaultUserAgentProvider??aG({serviceId:n.serviceId,clientVersion:Hj.version}),maxAttempts:r?.maxAttempts??ld,region:r?.region??sG("Region is missing"),requestHandler:D1.create(r?.requestHandler??t),retryMode:r?.retryMode??(async()=>(await t()).retryMode||Wz),sha256:r?.sha256??iG,streamCollector:r?.streamCollector??SV,useDualstackEndpoint:r?.useDualstackEndpoint??(()=>Promise.resolve(yH)),useFipsEndpoint:r?.useFipsEndpoint??(()=>Promise.resolve(AH))}},xQ=r=>({setRegion(e){r.region=e},region(){return r.region}}),SQ=r=>({region:r.region()}),EQ=r=>{const e=r.httpAuthSchemes;let t=r.httpAuthSchemeProvider,n=r.credentials;return{setHttpAuthScheme(i){const a=e.findIndex(s=>s.schemeId===i.schemeId);a===-1?e.push(i):e.splice(a,1,i)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(i){t=i},httpAuthSchemeProvider(){return t},setCredentials(i){n=i},credentials(){return n}}},kQ=r=>({httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()}),FQ=(r,e)=>{const t=Object.assign(xQ(r),WH(r),J9(r),EQ(r));return e.forEach(n=>n.configure(t)),Object.assign(r,SQ(t),YH(t),K9(t),kQ(t))};class TQ extends zH{config;constructor(...[e]){const t=wQ(e||{});super(t),this.initConfig=t;const n=Vj(t),i=bz(n),a=VH(i),s=wH(a),o=s,l=LH(o),u=Uj(l),c=FQ(u,e?.extensions||[]);this.config=c,this.middlewareStack.use(MV(this.config)),this.middlewareStack.use(vH(this.config)),this.middlewareStack.use(nj(this.config)),this.middlewareStack.use(EH(this.config)),this.middlewareStack.use(rV(this.config)),this.middlewareStack.use(aV(this.config)),this.middlewareStack.use(lV(this.config)),this.middlewareStack.use(hV(this.config,{httpAuthSchemeParametersProvider:_j,identityProviderConfigProvider:async h=>new dz({"aws.auth#sigv4":h.credentials})})),this.middlewareStack.use(yV(this.config))}destroy(){super.destroy()}}class s2 extends M1.classBuilder().ep(oD).m(function(e,t,n,i){return[JI(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","InitiateAuth",{}).n("CognitoIdentityProviderClient","InitiateAuthCommand").sc(AQ).build(){}class IQ extends M1.classBuilder().ep(oD).m(function(e,t,n,i){return[JI(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","RespondToAuthChallenge",{}).n("CognitoIdentityProviderClient","RespondToAuthChallengeCommand").sc(bQ).build(){}class DQ{init(e,t,n){this.cognitoClient=new TQ({region:t}),this.spiffRegion=e,this.userPoolClientId=n}async generateCode(e){const t=await this.cognitoClient?.send(new s2({AuthFlow:"CUSTOM_AUTH",ClientId:this.userPoolClientId,AuthParameters:{USERNAME:e}}));t?.ChallengeName==="CUSTOM_CHALLENGE"&&(this.challengeSession=t.Session)}async verifyCode(e,t,n){const i=await this.cognitoClient?.send(new IQ({ClientId:this.userPoolClientId,ChallengeName:"CUSTOM_CHALLENGE",Session:this.challengeSession,ChallengeResponses:{USERNAME:e,ANSWER:t},ClientMetadata:{partnerId:n,environment:(this.spiffRegion||"").toLowerCase()}}));return i?.ChallengeName==="CUSTOM_CHALLENGE"&&(this.challengeSession=i.Session),i}async refreshTokens(){const e=localStorage.getItem("cognito-tokens");if(!e)throw new Error("Failed to find existing tokens.");const t=JSON.parse(e);return await this.cognitoClient?.send(new s2({AuthFlow:"REFRESH_TOKEN_AUTH",ClientId:this.userPoolClientId,AuthParameters:{REFRESH_TOKEN:t.RefreshToken||""}}))}}const _f=new DQ;var PQ={defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},RQ={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function cd(r){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?cd=function(e){return typeof e}:cd=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cd(r)}function o2(r){return OQ(r)||BQ(r)||MQ(r)||_Q()}function OQ(r){if(Array.isArray(r))return r}function BQ(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function MQ(r,e){if(r){if(typeof r=="string")return l2(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return l2(r,e)}}function l2(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function _Q(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2703
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var NQ={normalizePrecision:function(e){var t=e.reduce(function(n,i){return Math.max(n.getPrecision(),i.getPrecision())});return e.map(function(n){return n.getPrecision()!==t?n.convertPrecision(t):n})},minimum:function(e){var t=o2(e),n=t[0],i=t.slice(1),a=n;return i.forEach(function(s){a=a.lessThan(s)?a:s}),a},maximum:function(e){var t=o2(e),n=t[0],i=t.slice(1),a=n;return i.forEach(function(s){a=a.greaterThan(s)?a:s}),a}};function kD(r){return!isNaN(parseInt(r))&&isFinite(r)}function LQ(r){return kD(r)&&r<=100&&r>=0}function UQ(r){return r.length>0&&r.every(function(e){return e>=0})&&r.some(function(e){return e>0})}function u2(r){return r%2===0}function c2(r){return kD(r)&&!Number.isInteger(r)}function VQ(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=r.toString();if(e.indexOf("e-")>0)return parseInt(e.split("e-")[1]);var t=e.split(".")[1];return t?t.length:0}function Nf(r){return Math.abs(r)%1===.5}function zQ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(t,n){var i=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){i.readyState===4&&(i.status>=200&&i.status<400?t(JSON.parse(i.responseText)):n(new Error(i.statusText)))},onerror:function(){n(new Error("Network error"))}});i.open("GET",r,!0),HQ(i,e.headers),i.send()})}function HQ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(var t in e)r.setRequestHeader(t,e[t]);return r}function Jf(r){return typeof r>"u"}function FD(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".",t={};return Object.entries(r).forEach(function(n){if(cd(n[1])==="object"){var i=FD(n[1]);Object.entries(i).forEach(function(a){t[n[0]+e+a[0]]=a[1]})}else t[n[0]]=n[1]}),t}function jQ(r){return!!r&&(cd(r)==="object"||typeof r=="function")&&typeof r.then=="function"}function TD(){var r=function(n,i){var a=function(l){return Math.pow(10,VQ(l))},s=Math.max(a(n),a(i));return Math.round(n*s)*Math.round(i*s)/(s*s)},e={HALF_ODD:function(n){var i=Math.round(n);return Nf(n)&&u2(i)?i-1:i},HALF_EVEN:function(n){var i=Math.round(n);return Nf(n)?u2(i)?i:i-1:i},HALF_UP:function(n){return Math.round(n)},HALF_DOWN:function(n){return Nf(n)?Math.floor(n):Math.round(n)},HALF_TOWARDS_ZERO:function(n){return Nf(n)?Math.sign(n)*Math.floor(Math.abs(n)):Math.round(n)},HALF_AWAY_FROM_ZERO:function(n){return Nf(n)?Math.sign(n)*Math.ceil(Math.abs(n)):Math.round(n)},DOWN:function(n){return Math.floor(n)}};return{add:function(n,i){return n+i},subtract:function(n,i){return n-i},multiply:function(n,i){return c2(n)||c2(i)?r(n,i):n*i},divide:function(n,i){return n/i},modulo:function(n,i){return n%i},round:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"HALF_EVEN";return e[i](n)}}}var GQ=TD();function $Q(r){var e=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(r);return{getMatches:function(){return e!==null?e.slice(1).filter(function(n){return!Jf(n)}):[]},getMinimumFractionDigits:function(){var n=function(a){return a==="."};return Jf(this.getMatches().find(n))?0:this.getMatches()[GQ.add(this.getMatches().findIndex(n),1)].split("").length},getCurrencyDisplay:function(){var n={USD:"code",dollar:"name",$:"symbol"};return n[this.getMatches().find(function(i){return i==="USD"||i==="dollar"||i==="$"})]},getStyle:function(){return Jf(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!Jf(this.getMatches().find(function(n){return n===","}))}}}function qQ(r){var e=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;for(var s in a)i=i.replace("{{".concat(s,"}}"),a[s]);return i},t=function(i,a){return zQ(e(r.endpoint,{from:i,to:a}),{headers:r.headers})};return{getExchangeRate:function(i,a){return(jQ(r.endpoint)?r.endpoint:t(i,a)).then(function(s){return FD(s)[e(r.propertyPath,{from:i,to:a})]})}}}function _d(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Error;if(!r)throw new t(e)}function QQ(r){_d(LQ(r),"You must provide a numeric value between 0 and 100.",RangeError)}function WQ(r){_d(UQ(r),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function Xv(r){_d(Number.isInteger(r),"You must provide an integer.",TypeError)}var En=TD(),YQ=function r(e){var t=Object.assign({},{amount:r.defaultAmount,currency:r.defaultCurrency,precision:r.defaultPrecision},e),n=t.amount,i=t.currency,a=t.precision;Xv(n),Xv(a);var s=r.globalLocale,o=r.globalFormat,l=r.globalRoundingMode,u=r.globalFormatRoundingMode,c=Object.assign({},r.globalExchangeRatesApi),h=function(g){var v=Object.assign({},Object.assign({},{amount:n,currency:i,precision:a},g),Object.assign({},{locale:this.locale},g));return Object.assign(r({amount:v.amount,currency:v.currency,precision:v.precision}),{locale:v.locale})},f=function(g){_d(this.hasSameCurrency(g),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return n},getCurrency:function(){return i},getLocale:function(){return this.locale||s},setLocale:function(g){return h.call(this,{locale:g})},getPrecision:function(){return a},convertPrecision:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;Xv(g);var y=this.getPrecision(),A=g>y,w=A?En.multiply:En.divide,k=A?[g,y]:[y,g],T=Math.pow(10,En.subtract.apply(En,k));return h.call(this,{amount:En.round(w(this.getAmount(),T),v),precision:g})},add:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return h.call(this,{amount:En.add(v[0].getAmount(),v[1].getAmount()),precision:v[0].getPrecision()})},subtract:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return h.call(this,{amount:En.subtract(v[0].getAmount(),v[1].getAmount()),precision:v[0].getPrecision()})},multiply:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return h.call(this,{amount:En.round(En.multiply(this.getAmount(),g),v)})},divide:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return h.call(this,{amount:En.round(En.divide(this.getAmount(),g),v)})},percentage:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return QQ(g),this.multiply(En.divide(g,100),v)},allocate:function(g){var v=this;WQ(g);for(var y=g.reduce(function(T,S){return En.add(T,S)}),A=this.getAmount(),w=g.map(function(T){var S=Math.floor(En.divide(En.multiply(v.getAmount(),T),y));return A=En.subtract(A,S),h.call(v,{amount:S})}),k=0;A>0;)g[k]>0&&(w[k]=w[k].add(h.call(this,{amount:1})),A=En.subtract(A,1)),k+=1;return w},convert:function(g){var v=this,y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=y.endpoint,w=A===void 0?c.endpoint:A,k=y.propertyPath,T=k===void 0?c.propertyPath||"rates.{{to}}":k,S=y.headers,R=S===void 0?c.headers:S,B=y.roundingMode,G=B===void 0?l:B,$=Object.assign({},{endpoint:w,propertyPath:T,headers:R,roundingMode:G});return qQ($).getExchangeRate(this.getCurrency(),g).then(function(Y){return _d(!Jf(Y),'No rate was found for the destination currency "'.concat(g,'".'),TypeError),h.call(v,{amount:En.round(En.multiply(v.getAmount(),parseFloat(Y)),$.roundingMode),currency:g})})},equalsTo:function(g){return this.hasSameAmount(g)&&this.hasSameCurrency(g)},lessThan:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return v[0].getAmount()<v[1].getAmount()},lessThanOrEqual:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return v[0].getAmount()<=v[1].getAmount()},greaterThan:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return v[0].getAmount()>v[1].getAmount()},greaterThanOrEqual:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return v[0].getAmount()>=v[1].getAmount()},isZero:function(){return this.getAmount()===0},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return En.modulo(this.getAmount(),Math.pow(10,a))!==0},hasCents:function(){return En.modulo(this.getAmount(),Math.pow(10,a))!==0},hasSameCurrency:function(g){return this.getCurrency()===g.getCurrency()},hasSameAmount:function(g){var v=r.normalizePrecision([this,g]);return v[0].getAmount()===v[1].getAmount()},toFormat:function(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:o,v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,y=$Q(g);return this.toRoundedUnit(y.getMinimumFractionDigits(),v).toLocaleString(this.getLocale(),{currencyDisplay:y.getCurrencyDisplay(),useGrouping:y.getUseGrouping(),minimumFractionDigits:y.getMinimumFractionDigits(),style:y.getStyle(),currency:this.getCurrency()})},toUnit:function(){return En.divide(this.getAmount(),Math.pow(10,a))},toRoundedUnit:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,y=Math.pow(10,g);return En.divide(En.round(En.multiply(this.toUnit(),y),v),y)},toObject:function(){return{amount:n,currency:i,precision:a}},toJSON:function(){return this.toObject()}}},XQ=Object.assign(YQ,PQ,RQ,NQ),Ka={},Jv,f2;function JQ(){if(f2)return Jv;f2=1;function r(t){return t}function e(t,a,s){for(var a=a||r,s=s||t,o=0,l=t.length;o<l;o+=1)if(a.call(s,t[o],o))return t[o]}return Jv=e,Jv}var Kv={exports:{}},d2;function KQ(){if(d2)return Kv.exports;d2=1;var r=Kv.exports=function(e,t){if(typeof e=="function"||t)return r.by(e,t);for(var n={object:[],function:[],string:{},number:{},boolean:{},undefined:{}},i=[],a=0;a<e.length;a++){var s=e[a],o=s==="__proto__"?n.objects:n[typeof s]||n.objects;Array.isArray(o)?o.indexOf(s)<0&&(o.push(s),i.push(s)):Object.hasOwnProperty.call(o,s)||(o[s]=!0,i.push(s))}return i};return r.by=function(e,t){if(typeof e=="function"){var n=t;t=e,e=n}for(var i=[],a=0;a<e.length;a++){for(var s=e[a],o=!1,l=0;l<i.length;l++){var u=i[l];if(t.call(i,s,u)){o=!0;break}}o||i.push(s)}return i},Kv.exports}var Zv,h2;function ZQ(){return h2||(h2=1,Zv=[{code:"AED",number:"784",digits:2,currency:"UAE Dirham",countries:["United Arab Emirates (The)"]},{code:"AFN",number:"971",digits:2,currency:"Afghani",countries:["Afghanistan"]},{code:"ALL",number:"008",digits:2,currency:"Lek",countries:["Albania"]},{code:"AMD",number:"051",digits:2,currency:"Armenian Dram",countries:["Armenia"]},{code:"ANG",number:"532",digits:2,currency:"Netherlands Antillean Guilder",countries:["Curaçao","Sint Maarten (Dutch Part)"]},{code:"AOA",number:"973",digits:2,currency:"Kwanza",countries:["Angola"]},{code:"ARS",number:"032",digits:2,currency:"Argentine Peso",countries:["Argentina"]},{code:"AUD",number:"036",digits:2,currency:"Australian Dollar",countries:["Australia","Christmas Island","Cocos (Keeling) Islands (The)","Heard Island and Mcdonald Islands","Kiribati","Nauru","Norfolk Island","Tuvalu"]},{code:"AWG",number:"533",digits:2,currency:"Aruban Florin",countries:["Aruba"]},{code:"AZN",number:"944",digits:2,currency:"Azerbaijan Manat",countries:["Azerbaijan"]},{code:"BAM",number:"977",digits:2,currency:"Convertible Mark",countries:["Bosnia and Herzegovina"]},{code:"BBD",number:"052",digits:2,currency:"Barbados Dollar",countries:["Barbados"]},{code:"BDT",number:"050",digits:2,currency:"Taka",countries:["Bangladesh"]},{code:"BGN",number:"975",digits:2,currency:"Bulgarian Lev",countries:["Bulgaria"]},{code:"BHD",number:"048",digits:3,currency:"Bahraini Dinar",countries:["Bahrain"]},{code:"BIF",number:"108",digits:0,currency:"Burundi Franc",countries:["Burundi"]},{code:"BMD",number:"060",digits:2,currency:"Bermudian Dollar",countries:["Bermuda"]},{code:"BND",number:"096",digits:2,currency:"Brunei Dollar",countries:["Brunei Darussalam"]},{code:"BOB",number:"068",digits:2,currency:"Boliviano",countries:["Bolivia (Plurinational State Of)"]},{code:"BOV",number:"984",digits:2,currency:"Mvdol",countries:["Bolivia (Plurinational State Of)"]},{code:"BRL",number:"986",digits:2,currency:"Brazilian Real",countries:["Brazil"]},{code:"BSD",number:"044",digits:2,currency:"Bahamian Dollar",countries:["Bahamas (The)"]},{code:"BTN",number:"064",digits:2,currency:"Ngultrum",countries:["Bhutan"]},{code:"BWP",number:"072",digits:2,currency:"Pula",countries:["Botswana"]},{code:"BYN",number:"933",digits:2,currency:"Belarusian Ruble",countries:["Belarus"]},{code:"BZD",number:"084",digits:2,currency:"Belize Dollar",countries:["Belize"]},{code:"CAD",number:"124",digits:2,currency:"Canadian Dollar",countries:["Canada"]},{code:"CDF",number:"976",digits:2,currency:"Congolese Franc",countries:["Congo (The Democratic Republic of The)"]},{code:"CHE",number:"947",digits:2,currency:"WIR Euro",countries:["Switzerland"]},{code:"CHF",number:"756",digits:2,currency:"Swiss Franc",countries:["Liechtenstein","Switzerland"]},{code:"CHW",number:"948",digits:2,currency:"WIR Franc",countries:["Switzerland"]},{code:"CLF",number:"990",digits:4,currency:"Unidad de Fomento",countries:["Chile"]},{code:"CLP",number:"152",digits:0,currency:"Chilean Peso",countries:["Chile"]},{code:"CNY",number:"156",digits:2,currency:"Yuan Renminbi",countries:["China"]},{code:"COP",number:"170",digits:2,currency:"Colombian Peso",countries:["Colombia"]},{code:"COU",number:"970",digits:2,currency:"Unidad de Valor Real",countries:["Colombia"]},{code:"CRC",number:"188",digits:2,currency:"Costa Rican Colon",countries:["Costa Rica"]},{code:"CUC",number:"931",digits:2,currency:"Peso Convertible",countries:["Cuba"]},{code:"CUP",number:"192",digits:2,currency:"Cuban Peso",countries:["Cuba"]},{code:"CVE",number:"132",digits:2,currency:"Cabo Verde Escudo",countries:["Cabo Verde"]},{code:"CZK",number:"203",digits:2,currency:"Czech Koruna",countries:["Czechia"]},{code:"DJF",number:"262",digits:0,currency:"Djibouti Franc",countries:["Djibouti"]},{code:"DKK",number:"208",digits:2,currency:"Danish Krone",countries:["Denmark","Faroe Islands (The)","Greenland"]},{code:"DOP",number:"214",digits:2,currency:"Dominican Peso",countries:["Dominican Republic (The)"]},{code:"DZD",number:"012",digits:2,currency:"Algerian Dinar",countries:["Algeria"]},{code:"EGP",number:"818",digits:2,currency:"Egyptian Pound",countries:["Egypt"]},{code:"ERN",number:"232",digits:2,currency:"Nakfa",countries:["Eritrea"]},{code:"ETB",number:"230",digits:2,currency:"Ethiopian Birr",countries:["Ethiopia"]},{code:"EUR",number:"978",digits:2,currency:"Euro",countries:["Åland Islands","Andorra","Austria","Belgium","Croatia","Cyprus","Estonia","European Union","Finland","France","French Guiana","French Southern Territories (The)","Germany","Greece","Guadeloupe","Holy See (The)","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Martinique","Mayotte","Monaco","Montenegro","Netherlands (The)","Portugal","Réunion","Saint Barthélemy","Saint Martin (French Part)","Saint Pierre and Miquelon","San Marino","Slovakia","Slovenia","Spain"]},{code:"FJD",number:"242",digits:2,currency:"Fiji Dollar",countries:["Fiji"]},{code:"FKP",number:"238",digits:2,currency:"Falkland Islands Pound",countries:["Falkland Islands (The) [Malvinas]"]},{code:"GBP",number:"826",digits:2,currency:"Pound Sterling",countries:["Guernsey","Isle of Man","Jersey","United Kingdom of Great Britain and Northern Ireland (The)"]},{code:"GEL",number:"981",digits:2,currency:"Lari",countries:["Georgia"]},{code:"GHS",number:"936",digits:2,currency:"Ghana Cedi",countries:["Ghana"]},{code:"GIP",number:"292",digits:2,currency:"Gibraltar Pound",countries:["Gibraltar"]},{code:"GMD",number:"270",digits:2,currency:"Dalasi",countries:["Gambia (The)"]},{code:"GNF",number:"324",digits:0,currency:"Guinean Franc",countries:["Guinea"]},{code:"GTQ",number:"320",digits:2,currency:"Quetzal",countries:["Guatemala"]},{code:"GYD",number:"328",digits:2,currency:"Guyana Dollar",countries:["Guyana"]},{code:"HKD",number:"344",digits:2,currency:"Hong Kong Dollar",countries:["Hong Kong"]},{code:"HNL",number:"340",digits:2,currency:"Lempira",countries:["Honduras"]},{code:"HTG",number:"332",digits:2,currency:"Gourde",countries:["Haiti"]},{code:"HUF",number:"348",digits:2,currency:"Forint",countries:["Hungary"]},{code:"IDR",number:"360",digits:2,currency:"Rupiah",countries:["Indonesia"]},{code:"ILS",number:"376",digits:2,currency:"New Israeli Sheqel",countries:["Israel"]},{code:"INR",number:"356",digits:2,currency:"Indian Rupee",countries:["Bhutan","India"]},{code:"IQD",number:"368",digits:3,currency:"Iraqi Dinar",countries:["Iraq"]},{code:"IRR",number:"364",digits:2,currency:"Iranian Rial",countries:["Iran (Islamic Republic Of)"]},{code:"ISK",number:"352",digits:0,currency:"Iceland Krona",countries:["Iceland"]},{code:"JMD",number:"388",digits:2,currency:"Jamaican Dollar",countries:["Jamaica"]},{code:"JOD",number:"400",digits:3,currency:"Jordanian Dinar",countries:["Jordan"]},{code:"JPY",number:"392",digits:0,currency:"Yen",countries:["Japan"]},{code:"KES",number:"404",digits:2,currency:"Kenyan Shilling",countries:["Kenya"]},{code:"KGS",number:"417",digits:2,currency:"Som",countries:["Kyrgyzstan"]},{code:"KHR",number:"116",digits:2,currency:"Riel",countries:["Cambodia"]},{code:"KMF",number:"174",digits:0,currency:"Comorian Franc ",countries:["Comoros (The)"]},{code:"KPW",number:"408",digits:2,currency:"North Korean Won",countries:["Korea (The Democratic People’s Republic Of)"]},{code:"KRW",number:"410",digits:0,currency:"Won",countries:["Korea (The Republic Of)"]},{code:"KWD",number:"414",digits:3,currency:"Kuwaiti Dinar",countries:["Kuwait"]},{code:"KYD",number:"136",digits:2,currency:"Cayman Islands Dollar",countries:["Cayman Islands (The)"]},{code:"KZT",number:"398",digits:2,currency:"Tenge",countries:["Kazakhstan"]},{code:"LAK",number:"418",digits:2,currency:"Lao Kip",countries:["Lao People’s Democratic Republic (The)"]},{code:"LBP",number:"422",digits:2,currency:"Lebanese Pound",countries:["Lebanon"]},{code:"LKR",number:"144",digits:2,currency:"Sri Lanka Rupee",countries:["Sri Lanka"]},{code:"LRD",number:"430",digits:2,currency:"Liberian Dollar",countries:["Liberia"]},{code:"LSL",number:"426",digits:2,currency:"Loti",countries:["Lesotho"]},{code:"LYD",number:"434",digits:3,currency:"Libyan Dinar",countries:["Libya"]},{code:"MAD",number:"504",digits:2,currency:"Moroccan Dirham",countries:["Morocco","Western Sahara"]},{code:"MDL",number:"498",digits:2,currency:"Moldovan Leu",countries:["Moldova (The Republic Of)"]},{code:"MGA",number:"969",digits:2,currency:"Malagasy Ariary",countries:["Madagascar"]},{code:"MKD",number:"807",digits:2,currency:"Denar",countries:["North Macedonia"]},{code:"MMK",number:"104",digits:2,currency:"Kyat",countries:["Myanmar"]},{code:"MNT",number:"496",digits:2,currency:"Tugrik",countries:["Mongolia"]},{code:"MOP",number:"446",digits:2,currency:"Pataca",countries:["Macao"]},{code:"MRU",number:"929",digits:2,currency:"Ouguiya",countries:["Mauritania"]},{code:"MUR",number:"480",digits:2,currency:"Mauritius Rupee",countries:["Mauritius"]},{code:"MVR",number:"462",digits:2,currency:"Rufiyaa",countries:["Maldives"]},{code:"MWK",number:"454",digits:2,currency:"Malawi Kwacha",countries:["Malawi"]},{code:"MXN",number:"484",digits:2,currency:"Mexican Peso",countries:["Mexico"]},{code:"MXV",number:"979",digits:2,currency:"Mexican Unidad de Inversion (UDI)",countries:["Mexico"]},{code:"MYR",number:"458",digits:2,currency:"Malaysian Ringgit",countries:["Malaysia"]},{code:"MZN",number:"943",digits:2,currency:"Mozambique Metical",countries:["Mozambique"]},{code:"NAD",number:"516",digits:2,currency:"Namibia Dollar",countries:["Namibia"]},{code:"NGN",number:"566",digits:2,currency:"Naira",countries:["Nigeria"]},{code:"NIO",number:"558",digits:2,currency:"Cordoba Oro",countries:["Nicaragua"]},{code:"NOK",number:"578",digits:2,currency:"Norwegian Krone",countries:["Bouvet Island","Norway","Svalbard and Jan Mayen"]},{code:"NPR",number:"524",digits:2,currency:"Nepalese Rupee",countries:["Nepal"]},{code:"NZD",number:"554",digits:2,currency:"New Zealand Dollar",countries:["Cook Islands (The)","New Zealand","Niue","Pitcairn","Tokelau"]},{code:"OMR",number:"512",digits:3,currency:"Rial Omani",countries:["Oman"]},{code:"PAB",number:"590",digits:2,currency:"Balboa",countries:["Panama"]},{code:"PEN",number:"604",digits:2,currency:"Sol",countries:["Peru"]},{code:"PGK",number:"598",digits:2,currency:"Kina",countries:["Papua New Guinea"]},{code:"PHP",number:"608",digits:2,currency:"Philippine Peso",countries:["Philippines (The)"]},{code:"PKR",number:"586",digits:2,currency:"Pakistan Rupee",countries:["Pakistan"]},{code:"PLN",number:"985",digits:2,currency:"Zloty",countries:["Poland"]},{code:"PYG",number:"600",digits:0,currency:"Guarani",countries:["Paraguay"]},{code:"QAR",number:"634",digits:2,currency:"Qatari Rial",countries:["Qatar"]},{code:"RON",number:"946",digits:2,currency:"Romanian Leu",countries:["Romania"]},{code:"RSD",number:"941",digits:2,currency:"Serbian Dinar",countries:["Serbia"]},{code:"RUB",number:"643",digits:2,currency:"Russian Ruble",countries:["Russian Federation (The)"]},{code:"RWF",number:"646",digits:0,currency:"Rwanda Franc",countries:["Rwanda"]},{code:"SAR",number:"682",digits:2,currency:"Saudi Riyal",countries:["Saudi Arabia"]},{code:"SBD",number:"090",digits:2,currency:"Solomon Islands Dollar",countries:["Solomon Islands"]},{code:"SCR",number:"690",digits:2,currency:"Seychelles Rupee",countries:["Seychelles"]},{code:"SDG",number:"938",digits:2,currency:"Sudanese Pound",countries:["Sudan (The)"]},{code:"SEK",number:"752",digits:2,currency:"Swedish Krona",countries:["Sweden"]},{code:"SGD",number:"702",digits:2,currency:"Singapore Dollar",countries:["Singapore"]},{code:"SHP",number:"654",digits:2,currency:"Saint Helena Pound",countries:["Saint Helena, Ascension and Tristan Da Cunha"]},{code:"SLE",number:"925",digits:2,currency:"Leone",countries:["Sierra Leone"]},{code:"SOS",number:"706",digits:2,currency:"Somali Shilling",countries:["Somalia"]},{code:"SRD",number:"968",digits:2,currency:"Surinam Dollar",countries:["Suriname"]},{code:"SSP",number:"728",digits:2,currency:"South Sudanese Pound",countries:["South Sudan"]},{code:"STN",number:"930",digits:2,currency:"Dobra",countries:["Sao Tome and Principe"]},{code:"SVC",number:"222",digits:2,currency:"El Salvador Colon",countries:["El Salvador"]},{code:"SYP",number:"760",digits:2,currency:"Syrian Pound",countries:["Syrian Arab Republic"]},{code:"SZL",number:"748",digits:2,currency:"Lilangeni",countries:["Eswatini"]},{code:"THB",number:"764",digits:2,currency:"Baht",countries:["Thailand"]},{code:"TJS",number:"972",digits:2,currency:"Somoni",countries:["Tajikistan"]},{code:"TMT",number:"934",digits:2,currency:"Turkmenistan New Manat",countries:["Turkmenistan"]},{code:"TND",number:"788",digits:3,currency:"Tunisian Dinar",countries:["Tunisia"]},{code:"TOP",number:"776",digits:2,currency:"Pa’anga",countries:["Tonga"]},{code:"TRY",number:"949",digits:2,currency:"Turkish Lira",countries:["Türki̇ye"]},{code:"TTD",number:"780",digits:2,currency:"Trinidad and Tobago Dollar",countries:["Trinidad and Tobago"]},{code:"TWD",number:"901",digits:2,currency:"New Taiwan Dollar",countries:["Taiwan (Province of China)"]},{code:"TZS",number:"834",digits:2,currency:"Tanzanian Shilling",countries:["Tanzania, United Republic Of"]},{code:"UAH",number:"980",digits:2,currency:"Hryvnia",countries:["Ukraine"]},{code:"UGX",number:"800",digits:0,currency:"Uganda Shilling",countries:["Uganda"]},{code:"USD",number:"840",digits:2,currency:"US Dollar",countries:["American Samoa","Bonaire, Sint Eustatius and Saba","British Indian Ocean Territory (The)","Ecuador","El Salvador","Guam","Haiti","Marshall Islands (The)","Micronesia (Federated States Of)","Northern Mariana Islands (The)","Palau","Panama","Puerto Rico","Timor-Leste","Turks and Caicos Islands (The)","United States Minor Outlying Islands (The)","United States of America (The)","Virgin Islands (British)","Virgin Islands (u.s.)"]},{code:"USN",number:"997",digits:2,currency:"US Dollar (Next day)",countries:["United States of America (The)"]},{code:"UYI",number:"940",digits:0,currency:"Uruguay Peso en Unidades Indexadas (UI)",countries:["Uruguay"]},{code:"UYU",number:"858",digits:2,currency:"Peso Uruguayo",countries:["Uruguay"]},{code:"UYW",number:"927",digits:4,currency:"Unidad Previsional",countries:["Uruguay"]},{code:"UZS",number:"860",digits:2,currency:"Uzbekistan Sum",countries:["Uzbekistan"]},{code:"VED",number:"926",digits:2,currency:"Bolívar Soberano",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VES",number:"928",digits:2,currency:"Bolívar Soberano",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VND",number:"704",digits:0,currency:"Dong",countries:["Viet Nam"]},{code:"VUV",number:"548",digits:0,currency:"Vatu",countries:["Vanuatu"]},{code:"WST",number:"882",digits:2,currency:"Tala",countries:["Samoa"]},{code:"XAF",number:"950",digits:0,currency:"CFA Franc BEAC",countries:["Cameroon","Central African Republic (The)","Chad","Congo (The)","Equatorial Guinea","Gabon"]},{code:"XAG",number:"961",digits:0,currency:"Silver",countries:["Zz11_silver"]},{code:"XAU",number:"959",digits:0,currency:"Gold",countries:["Zz08_gold"]},{code:"XBA",number:"955",digits:0,currency:"Bond Markets Unit European Composite Unit (EURCO)",countries:["Zz01_bond Markets Unit European_eurco"]},{code:"XBB",number:"956",digits:0,currency:"Bond Markets Unit European Monetary Unit (E.M.U.-6)",countries:["Zz02_bond Markets Unit European_emu-6"]},{code:"XBC",number:"957",digits:0,currency:"Bond Markets Unit European Unit of Account 9 (E.U.A.-9)",countries:["Zz03_bond Markets Unit European_eua-9"]},{code:"XBD",number:"958",digits:0,currency:"Bond Markets Unit European Unit of Account 17 (E.U.A.-17)",countries:["Zz04_bond Markets Unit European_eua-17"]},{code:"XCD",number:"951",digits:2,currency:"East Caribbean Dollar",countries:["Anguilla","Antigua and Barbuda","Dominica","Grenada","Montserrat","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines"]},{code:"XDR",number:"960",digits:0,currency:"SDR (Special Drawing Right)",countries:["International Monetary Fund (Imf) "]},{code:"XOF",number:"952",digits:0,currency:"CFA Franc BCEAO",countries:["Benin","Burkina Faso","Côte D'ivoire","Guinea-Bissau","Mali","Niger (The)","Senegal","Togo"]},{code:"XPD",number:"964",digits:0,currency:"Palladium",countries:["Zz09_palladium"]},{code:"XPF",number:"953",digits:0,currency:"CFP Franc",countries:["French Polynesia","New Caledonia","Wallis and Futuna"]},{code:"XPT",number:"962",digits:0,currency:"Platinum",countries:["Zz10_platinum"]},{code:"XSU",number:"994",digits:0,currency:"Sucre",countries:['Sistema Unitario De Compensacion Regional De Pagos "Sucre"']},{code:"XTS",number:"963",digits:0,currency:"Codes specifically reserved for testing purposes",countries:["Zz06_testing_code"]},{code:"XUA",number:"965",digits:0,currency:"ADB Unit of Account",countries:["Member Countries of the African Development Bank Group"]},{code:"XXX",number:"999",digits:0,currency:"The codes assigned for transactions where no currency is involved",countries:["Zz07_no_currency"]},{code:"YER",number:"886",digits:2,currency:"Yemeni Rial",countries:["Yemen"]},{code:"ZAR",number:"710",digits:2,currency:"Rand",countries:["Lesotho","Namibia","South Africa"]},{code:"ZMW",number:"967",digits:2,currency:"Zambian Kwacha",countries:["Zambia"]},{code:"ZWG",number:"924",digits:2,currency:"Zimbabwe Gold",countries:["Zimbabwe"]}]),Zv}var ey,p2;function eW(){return p2||(p2=1,ey="2024-06-25"),ey}var g2;function tW(){if(g2)return Ka;g2=1;var r=JQ(),e=KQ(),t=ZQ(),n=eW(),i=function(c){return c=c.toUpperCase(),r(t,function(h){return h.code===c})},a=function(c){return c=c.toLowerCase(),t.filter(function(h){return(h.countries.map(function(f){return f.toLowerCase()})||[]).indexOf(c)>-1})},s=function(c){return r(t,function(h){return h.number===String(c)})},o=function(){return t.map(function(c){return c.code})},l=function(){var c=t.map(function(h){return h.number});return c.filter(function(h){if(h)return h})},u=function(){var c=t.filter(function(h){return h.countries}).map(function(h){return h.countries});return e(Array.prototype.concat.apply([],c))};return Ka.code=i,Ka.country=a,Ka.number=s,Ka.codes=o,Ka.numbers=l,Ka.countries=u,Ka.publishDate=n,Ka.data=t,Ka}var m2=tW();class ID{formatCurrencyForDisplay(e,t){const n={amount:t||0,currency:e,precision:this.getPrecisionForCurrency(e)};return XQ(n).toFormat(this.getSpecialFormat(e))}getPrecisionForCurrency(e){const t=e,n=m2.code(t);return n?n.digits:2}getSpecialFormat(e){const t=e;if(m2.code(t)?.code==="CLP")return"USD0,0"}}const v2=new ID;class DD{constructor(e,t,n,i){this.presentmentCurrency=void 0,this.presentmentCurrency=i,this.partnerCurrency=n,this.rateFrom=e,this.rateTo=t}code(){return this.presentmentCurrency?this.presentmentCurrency:this.partnerCurrency}conversionRequired(){return this.presentmentCurrency!==void 0&&this.code()!==this.partnerCurrency}getConvertedSubunits(e){return this.conversionRequired()?Math.ceil(this.subunits(this.units(e,this.partnerCurrency)/this.rateFrom*this.rateTo,this.code())):e}units(e,t){return e/Math.pow(10,v2.getPrecisionForCurrency(t))}subunits(e,t){return e*Math.pow(10,v2.getPrecisionForCurrency(t))}}const rW=async(r,e)=>{const t=await $e.getShadowGraphqlClient().query({query:B3(e?.assets?.metadata||!1),errorPolicy:"all",variables:{ids:r}});if(t.error)throw t.error;if(t.errors)throw t.errors.forEach(i=>console.error(i)),new Error("Unable to read workflows. Consult GraphQL errors.");if(t.data.workflows===void 0||t.data.workflows.length!==r.length)throw new Error(`Unable to read workflows: ${t.errors??"Length mismatch in response"}`);const n=vo(t.data.workflows);return n.forEach(i=>{i.finalizeStepConfig||(i.finalizeStepConfig={}),i.finalizeStepConfig.termsMarkdown=i.finalizeStepConfig.termsMarkdown||i.partner.termsMarkdown}),n},nW=async(r,e)=>{const n=(await e).find(i=>i.id===r);if(!n)throw new Error(`Workflow not found: ${r}`);return n},Gb=async(r,e)=>{const t=r.map(o=>wd.get({id:o,options:e})),n=r.filter((o,l)=>t[l]===void 0);if(n.length===0)return Promise.all(t);const i=rW(n,e),a=n.map(o=>wd.set({id:o,options:e},nW(o,i))),s=t.filter(o=>o!==void 0);return await Promise.all(s.concat(a))},PD=async(r,e)=>(await Gb([r],e))[0],iW=async r=>{const e=await $e.getShadowGraphqlClient().query({query:fF,variables:{ids:r},errorPolicy:"all",fetchPolicy:"no-cache"});return e.errors&&console.error(e.errors),e.data.integrationProducts||[]};class aW{constructor(e){this.activeIntegration=void 0,this.updateTransactionState=async t=>{try{return $e.getShadowGraphqlClient().mutate({...t,mutation:A3})}catch(n){throw console.error(n),new uo("Critical - Unable to synchronize workflow state with server.")}},this.options=e,this.options.applicationKey&&UO(this.options.applicationKey),console.debug("------------------------"),console.debug("Spiff Commerce Core SDK"),console.debug("Version: 40.3.5"),console.debug(`Application Key Provided: ${!!this.options.applicationKey}`),console.debug("------------------------")}configure(e){_s.setHubUrl(e.hubUrl),_s.setServerUrl(e.serverUrl),_s.setServicesApiUrl(e.servicesApiUrl),this.marketplaceThemeInstallId=e.marketplaceThemeInstallId,this.marketplaceThemeInstallConfigurationId=e.marketplaceThemeInstallConfigurationId,this.userPoolClientId=e.userPoolClientId,this.userPoolRegion=e.userPoolRegion,this.spiffRegion=e.spiffRegion,e.bearerAuthenticationToken&&Hk(e.bearerAuthenticationToken),this.options.applicationKey&&this.getIntegration(),this.spiffRegion&&this.userPoolRegion&&this.userPoolClientId&&_f.init(this.spiffRegion,this.userPoolRegion,this.userPoolClientId)}getAssetManager(){return Wn}async getBetaEnabled(){return this.options.enableBetaFeatures?!0:(await this.getIntegration()).partner.beta===!0}getFlowService(){if(!VO())throw new Error("Application key required to use Flow Service.");return new xI}async getCurrencyContext(e){const n=(await this.getIntegration()).partner.currencyCode,a=await $e.getShadowGraphqlClient().query({query:V3,errorPolicy:"all",fetchPolicy:"cache-first",variables:{from:n,to:e}}),{rateFrom:s,rateTo:o}=a.data.currencyConversion;return new DD(s,o,n,e)}async getIntegration(){if(this.activeIntegration)return this.activeIntegration;if(!this.options.applicationKey)throw new Error("Cannot get current Integration without specifying an Application Key.");return this.activeIntegration=RD(this.options.applicationKey),this.activeIntegration}async canUseAddon(e){try{return(await this.getIntegration()).partner.activeAddons?.includes(e)??!1}catch(t){return console.error(t),!1}}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(e){const t=xr.getMap("transactionCustomerIds");t?.has(e)&&(t.delete(e),xr.setMap("transactionCustomerIds",t))}async customerHasBundleTemplates(e){const i=(await $e.getShadowGraphqlClient().query({query:Pp,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;return i.id?i.hasBundleTemplates??!1:!1}getStakeholderTypeForTransaction(e){const t=this.customer?.stakeholders?.find(n=>n.transaction?.id===e);if(t)return t.type}async getOrCreateCustomer(e){this.customer=void 0;const t=$e.getShadowGraphqlClient(),i=(await t.query({query:Pp,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;if(!i.id){const o=(await t.mutate({mutation:Q9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:e}}})).data?.customerCreate;if(!o)throw new Error("Unable to create customer.");return this.storeCustomer(o),this.customer=o,{customer:o,isAuthenticated:!1}}this.storeCustomer(i);const a=await this.reloadLoggedInCustomer();return{customer:this.customer||i,isAuthenticated:a}}getCustomer(){return this.customer}async reloadLoggedInCustomer(){const e=localStorage.getItem("last-refreshed-cognito-tokens"),t=localStorage.getItem("cognito-tokens"),n=localStorage.getItem("cognito-email");if(!e||!t||!n)return!1;const i=JSON.parse(t),a=new Date().getTime()/1e3;if(!i.ExpiresIn||i.ExpiresIn<a-parseInt(e)){const l=await _f.refreshTokens();if(l?.AuthenticationResult)localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),i.AccessToken=l.AuthenticationResult.AccessToken,localStorage.setItem("cognito-tokens",JSON.stringify(i));else return this.logOut(),console.error("Failed to refresh tokens."),!1}const o=(await $e.getShadowGraphqlClient().query({query:Pp,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:n}})).data.customer;return o.id?(this.customer=o,!0):(console.error("Failed to get customer."),!1)}async generateVerificationCode(e){await $e.getShadowGraphqlClient().mutate({mutation:W9,variables:{emailAddress:e}}),await _f.generateCode(e)}async verifyCode(e,t){const n=(await this.getIntegration()).partner.id||"",i=await _f.verifyCode(e,t,n);if(i?.AuthenticationResult){localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),localStorage.setItem("cognito-tokens",JSON.stringify(i.AuthenticationResult)),localStorage.setItem("cognito-email",e);const s=(await $e.getShadowGraphqlClient().query({query:Pp,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;if(!s.id)throw new Error("Failed to get customer.");return this.customer=s,!0}else throw new Error}async logOut(){localStorage.removeItem("last-refreshed-cognito-tokens"),localStorage.removeItem("cognito-tokens"),localStorage.removeItem("cognito-email"),this.clearCustomer()}async loggedInBearerToken(){const e=localStorage.getItem("last-refreshed-cognito-tokens"),t=localStorage.getItem("cognito-tokens");if(!e||!t)throw new Error("No token data in storage.");const n=JSON.parse(t),i=new Date().getTime()/1e3,a=!n?.AccessToken||Ag(n.AccessToken);if(!n.ExpiresIn||n.ExpiresIn<i-parseInt(e)||a){const s=await _f.refreshTokens();if(s?.AuthenticationResult)localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),n.AccessToken=s.AuthenticationResult.AccessToken,localStorage.setItem("cognito-tokens",JSON.stringify(n));else throw this.logOut(),new Error("Failed to refresh tokens.")}if(!n.AccessToken)throw new Error("No bearer token in storage.");return n.AccessToken}async getCustomerMetafields(){if(!this.customer?.id)throw new Error("Customer must be logged in before calling this function.");return(await $e.getShadowGraphqlClient().query({query:Y9,variables:{id:this.customer.id}})).data.metafields}async getNewBundle(e,t,n){const a=(await $e.getShadowGraphqlClient().mutate({mutation:_U(n?.graphql?.productCollection?.eagerFetchProducts||!1),variables:{collectionId:e,initialMetadata:t?Object.entries(t).map((u,c)=>({key:u[0],value:u[1]})):void 0,marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId},fetchPolicy:"no-cache"})).data?.bundleCreate;if(!a?.id)throw new Error("Unable to create bundle");const s=xr.getMap("bundlePartnerIds")||new Map;s.set(a.id,a.partner.id),xr.setMap("bundlePartnerIds",s);const o=xr.getMap("bundleOwnerIds")||new Map;o.set(a.id,a.bundleOwnerId),xr.setMap("bundleOwnerIds",o);const l=new vE(this,a,void 0,void 0,a.bundleOwnerId,{eagerFetchProducts:n?.graphql?.productCollection?.eagerFetchProducts});return await l.getInitializationPromise(),l}async getExistingBundle(e,t,n,i,a){const o=xr.getMap("bundleOwnerIds")?.get(e),l={};try{const g=await this.loggedInBearerToken();l.Authorization=`Bearer ${g}`}catch{const y=Object.entries(localStorage).find(([w,k])=>w.startsWith("CognitoIdentityServiceProvider")&&w.endsWith("idToken"))?.[0]||"",A=localStorage.getItem(y);A&&!Ag(A)&&(l.Authorization=`Bearer ${A}`)}const u={bundleOwnerId:o,...l,...i?.graphql?.additionalHeaders},c=await $e.getShadowGraphqlClient().query({query:PU(i?.graphql?.productCollection?.eagerFetchProducts||!1),variables:{id:e},fetchPolicy:"no-cache",context:{headers:u}});if(!c.data?.bundles||c.data?.bundles.length===0||!c.data?.bundles[0])throw new Error(`Unable to find bundle: ${e}`);const h=c.data?.bundles[0],f=xr.getMap("bundlePartnerIds")||new Map;f.set(h.id,h.partner.id),xr.setMap("bundlePartnerIds",f);const d=new vE(this,h,t,n,o,{additionalHeaders:i?.graphql?.additionalHeaders,eagerFetchProducts:i?.graphql?.productCollection?.eagerFetchProducts,existingGlobalPropertyState:c.data.globalPropertyState,readonly:i?.readonly},a);return await d.getInitializationPromise(),d}async duplicateBundle(e,t,n,i){const s={...await BD(e),...i?.graphql?.additionalHeaders},l=(await $e.getShadowGraphqlClient().mutate({mutation:NU(),variables:{id:e,template:t,marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId,duplicateTransactions:n},context:{headers:s},fetchPolicy:"no-cache"})).data?.bundleDuplicate;if(!l?.id)throw new Error("Unable to duplicate bundle");const u=xr.getMap("bundlePartnerIds")||new Map;u.set(l.id,l.partner.id),xr.setMap("bundlePartnerIds",u);const c=xr.getMap("bundleOwnerIds")||new Map;return c.set(l.id,l.bundleOwnerId),xr.setMap("bundleOwnerIds",c),async()=>await this.getExistingBundle(l.id,void 0,void 0,{graphql:{productCollection:{eagerFetchProducts:i?.graphql?.productCollection?.eagerFetchProducts||!1}}})}async getBundlesForCustomer(e){if(!this.customer?.id)throw new Error("Customer not authenticated.");const{includeMetadata:t,...n}=e;return(await $e.getShadowGraphqlClient().query({query:WU(t??!1),variables:{...n,id:this.customer.id},fetchPolicy:"no-cache"})).data.customerBundlesFeed}async getBundleStakeholders(){if(!this.customer)throw new Error("Customer not authenticated.");const e=await $e.getShadowGraphqlClient().query({query:RU,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!e.data?.customers||e.data.customers.length===0)throw new Error("Unable to find customer.");const n=e.data.customers[0].bundleStakeholders||[],i=xr.getMap("bundlePartnerIds")||new Map;return n.forEach(a=>{a.bundle?.id&&a.bundle.partner?.id&&i.set(a.bundle.id,a.bundle.partner.id)}),xr.setMap("bundlePartnerIds",i),n}async getWorkflowExperience(e,t){if(!e)throw new Error("getWorkflowExperience has been called without an options object! This is not supported.");const n=await this.getWorkflowExperiences([e],e.graphql),i=n[0],a=i.getWorkflow();return t&&!a&&console.error("No workflow instantiated when trying to create preview service."),t&&a&&await i.getWorkflowManager().injectIntoPreviewService(t(a)),n[0]}async getWorkflowExperiences(e,t,n,i){if(e.length===0)throw new uo("No options provided!");const a=e.map((Y,X)=>({option:Y,index:X})),s=a.filter(Y=>Y.option.type==="transaction"),o=a.filter(Y=>Y.option.type==="integration"||Y.option.type==="external"||Y.option.type==="blank"),l=50,u=sA(s,l),c=sA(o,l);let h=0;const f=$e.getShadowGraphqlClient(),d=async Y=>{if(Y.length===0)return[];const X=Y.map(oe=>oe.option.transactionId),J=await f.query({query:y3,variables:{ids:X},errorPolicy:"all",fetchPolicy:"no-cache"}),W=J.data.transactions;if(h=h+W.length,i&&i(h,s.length),W.length!==Y.length){const oe=J.errors?.[0]?.message||"Unknown error";throw new uo(`Not all transactions were found: ${oe}`)}return!this.activeIntegration&&W[0].integrationProduct?.integration&&(this.activeIntegration=Promise.resolve(W[0].integrationProduct.integration)),W.map((oe,se)=>({transaction:oe,workflowId:oe.workflowId,readOnly:Y.find(he=>he.option.transactionId===oe.id)?.option.readOnly??!1,index:Y[se].index}))},g=async Y=>{if(Y.length===0)return[];const X=await f.mutate({mutation:v3,variables:{inputs:Y.map(W=>({integrationProductId:W.option.type==="integration"?W.option.integrationProductId:void 0,externalIntegrationId:W.option.type==="external"?W.option.externalIntegrationId:void 0,externalProductId:W.option.type==="external"?W.option.externalProductId:void 0,workflowId:W.option.workflowId,designName:W.option.designName,claim:!0,quantity:W.option.quantity,recipient:W.option.recipient})),marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId},errorPolicy:"all",fetchPolicy:"no-cache"}),J=X.data?.transactionCreateMany;if(!J||J.length===0){const W=X.errors?.[0]?.message||"Unknown error";throw new uo(`Failed to create transactions: ${W}`)}return h=h+J.length,i&&i(h,s.length),J.map((W,oe)=>({transaction:W,workflowId:W.workflowId,readOnly:!1,index:Y[oe].index}))},v=(await Promise.all([...u.map(d),...c.map(g)])).flat(),y=[...new Set(v.map(Y=>Y.transaction.integrationProductId))].filter(Y=>Y!==void 0),A=[...new Set(v.map(Y=>Y.workflowId))].filter(Y=>Y!==void 0),[w,k]=await Promise.all([(async()=>y.length>0?await iW(y):[])(),(async()=>A.length>0?await Gb(A,t):[])()]),T=new Map(w.map(Y=>[Y.id,Y])),S=new Map(k.map(Y=>[Y.id,Y])),R=v.map(async Y=>{const{transaction:X,workflowId:J,readOnly:W,index:oe}=Y,se=J?S.get(J):void 0,he=e[oe];if(X.integrationProductId){const K=T.get(X.integrationProductId);X.integrationProduct=K,X.product=K?.product,X.integrationProduct||console.error("failed to find transaction's product")}const ye=xr.getMap("transactionOwnerIds")||new Map;!ye.get(X.id)&&X.transactionOwnerId&&(ye.set(X.id,X.transactionOwnerId),xr.setMap("transactionOwnerIds",ye));const Ue=ye.get(X.id)||void 0,Oe=new X9({onMutate:()=>({context:{transactionOwnerId:Ue,bundleOwnerId:t?.bundleOwnerId}}),onQuery:()=>({context:{transactionOwnerId:Ue,bundleOwnerId:t?.bundleOwnerId}})}),Te={workflow:se,transaction:X,singleVariantsRenderable:he?.workflowConfiguration?.singleVariantsRenderable,stateMutationFunc:W?async()=>{throw new nn("State mutation is forbidden in read only mode!")}:async K=>this.updateTransactionState({...K,context:{transactionOwnerId:Ue,bundleOwnerId:t?.bundleOwnerId}}),graphQlClient:()=>Oe,readOnly:W,isReloadedTransaction:he.type==="transaction"};if(he.type==="transaction"&&X.workflowState){const K=JSON.parse(X.workflowState);await tA(K),Te.reloadedState=K}else if(!W&&he.workflowState){const K=JSON.parse(he.workflowState);await tA(K),Te.reloadedState=K}return Te.delayWorkflowStateSync=!0,{experienceOptions:Te,index:oe,options:he}}),G=(await Promise.all(R)).sort((Y,X)=>Y.index-X.index);let $=[];for(const Y of G){const{experienceOptions:X,options:J}=Y,W=new vI(this,X);await W.getWorkflowManager().getInitializationPromise(),n&&n(),J.type!=="transaction"&&this.customer&&await W.attachCustomerDetails({email:this.customer.emailAddress}),$=[...$,W],W.getWorkflowManager().setWorkflowStateSyncEnabled(!0)}return $}storeCustomer(e){const t=xr.getMap("partnerCustomerIds")||new Map;t.set(e.partner.id,e.id),xr.setMap("partnerCustomerIds",t)}async getIntegrationProductById(e,t){const a=(await $e.getShadowGraphqlClient().query({query:k3(t),variables:{ids:[e]},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.integrationProducts;if(!a||a.length===0||!a[0]?.id)throw new Error("Integration product not found.");return new uA(a[0])}async getIntegrationProductFromExternalIds(e,t,n){const s=(await $e.getShadowGraphqlClient().query({query:F3(n),variables:{externalProductId:t,externalIntegrationId:e},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.integrationProductFromExternalIds;if(!s?.id)throw new Error("Integration product not found.");return new uA(s)}async getIntegrationProduct(e){return e.type==="integration"?this.getIntegrationProductById(e.integrationProductId):this.getIntegrationProductFromExternalIds(e.externalIntegrationId,e.externalProductId)}async getShareActionsForTransaction(e){const n=(xr.getMap("transactionOwnerIds")||new Map).get(e)||void 0,i=await $e.getShadowGraphqlClient().query({query:S3,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e},context:{transactionOwnerId:n}});if(!i.data.transactions||i.data.transactions.length!==1)throw new Error(`Failed to fetch share actions for transaction: ${e}`);return i.data.transactions[0].transactionShareActions}async placeOrder(e){const t=await $e.getShadowGraphqlClient().mutate({mutation:U3,variables:{orderItems:e}});if(t.errors)throw new Error(t.errors[0].message);if(!t.data)throw new Error("Failed to create order: No order data in response.");return{id:t.data.orderCreate.id,internalId:t.data.orderCreate.internalId}}}const RD=async(r,e)=>(await $e.getShadowGraphqlClient().query({query:_3,errorPolicy:"all",fetchPolicy:"no-cache",context:{headers:{"x-application-key":r},skipIntegrationCheck:!0},variables:{themeConfigurationId:e}})).data.currentIntegration,sW=async r=>{const t=await $e.getShadowGraphqlClient().query({query:x3,errorPolicy:"all",fetchPolicy:"network-only",variables:{id:r}});if(t.data.transactions.length!==0)return t.data.transactions[0]},oW=async(r,e)=>(await $e.getShadowGraphqlClient().query({query:M3,errorPolicy:"all",variables:{themeConfigurationId:r,themeInstallId:e}})).data?.marketplaceThemeInstallConfiguration,lW=async r=>(await $e.getShadowGraphqlClient().query({query:L3,errorPolicy:"all",variables:{id:r}})).data?.bundles?.[0]?.marketplaceThemeInstallConfiguration,uW=async r=>(await $e.getShadowGraphqlClient().query({query:N3,errorPolicy:"all",variables:{id:r}})).data?.transactions?.[0]?.marketplaceThemeInstallConfiguration;async function OD(){const r={};try{const e=await this.loggedInBearerToken();r.Authorization=`Bearer ${e}`}catch{const n=Object.entries(localStorage).find(([a,s])=>a.startsWith("CognitoIdentityServiceProvider")&&a.endsWith("idToken"))?.[0]||"",i=localStorage.getItem(n);i&&!Ag(i)&&(r.Authorization=`Bearer ${i}`)}return r}async function BD(r){const t=xr.getMap("bundleOwnerIds")?.get(r),n=await OD();return{bundleOwnerId:t,...n}}async function cW(r){const t=xr.getMap("transactionOwnerIds")?.get(r),n=await OD();return{transactionOwnerId:t,...n}}const fW=async r=>{const e=await BD(r),t=await $e.getShadowGraphqlClient().mutate({mutation:n9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r},context:{headers:e}});if(t.data?.bundleDelete!==r)throw new Error(`Failed to delete bundle: ${t.errors}`)},dW=async r=>{const e=await cW(r),t=await $e.getShadowGraphqlClient().mutate({mutation:i9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{ids:[r]},context:{headers:e}});if(!t.data?.transactions||t.data.transactions.length!==1||t.data.transactions[0].id!==r)throw new Error(`Failed to find transaction to read bundle id: ${JSON.stringify(t.errors)}`);return t.data.transactions[0].bundle?.id};function MD(r,e,t,n){const i=t.width*r.zoom,a=t.height*r.zoom;if(n){const o=r,l=Math.max(e.width/t.width,e.height/t.height);o.zoom=Math.max(l,r.zoom);const u=t.width*o.zoom,c=t.height*o.zoom;return o.x=Bp(r.x,e.width-u,0),o.y=Bp(r.y,e.height-c,0),o}const s=r;return s.x=Bp(s.x,-i,e.width),s.y=Bp(s.y,-a,e.height),s}function Bp(r,e,t){return Math.min(Math.max(r,e),t)}class _D{constructor(e,t){this.minZoomScale=[.03],this.maxZoomScale=[20],this._debouncedUpdateFrameOffsets=mI(this.updateFrameOffsets,200),this.targetElements=[],this.onFrameDataChangeListeners=[],this.onZoomChangeListeners=[],this.forceImageCover=e,this.initialZoom=t,this.thresholdSettings={useThreshold:!1,invertThreshold:!1,threshold:128,thresholdSaturation:.5}}connectWorkflowManager(e,t){t&&e.addStepSpecificStorageCallback(async n=>{if(n){const i=n;if(i.currentFrameSources){let a=!1;for(let s=0;s<i.currentFrameSources.length;s++){const o=i.currentFrameSources[s],l=await th(o),u=this.frameData?this.frameData[s]:void 0;xd(l,u)||(this.frameData||(this.frameData=new Array(i.currentFrameSources.length)),this.frameData[s]=l,a=!0)}a&&(this.onFrameDataChangeListeners.forEach(s=>s(this.frameData)),this.frameData&&this.imageData&&(this.recalculateOffsets(this.imageData),this.updateOffsets(this.offsets),this.recalculateZoomLimits(this.imageData,this.frameData)))}}},t),this.workflowManager=e,this.stepName=t}setTargetElements(e){this.targetElements=e}getFrameData(){return this.frameData}setFrameData(e){if(!e){this.frameData=void 0;return}e.forEach((t,n)=>{const i=Vu.get(t);i&&(this.frameData||(this.frameData=new Array(e.length)),this.frameData[n]=i)})}getImageData(){return this.imageData}getImageSrc(){if(this.imageData){if(this.imageData.svg){const e=Hg(this.imageData.svg,this.imageData.colors||{},!1);return Vg(e)}return this.imageData.src}}getOffsets(){return this.offsets}setOffsets(e){this.offsets=e}setZoom(e,t,n,i){if(this.imageData&&this.offsets&&this.frameData){(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length));const a=this.frameData.map((s,o)=>{const l=(t[o]-this.offsets[o].x)/this.offsets[o].zoom,u=(n[o]-this.offsets[o].y)/this.offsets[o].zoom,c=t[o]-l*e[o],h=n[o]-u*e[o];return{x:c,y:h,zoom:this.imageData.width*e[o]/this.imageData.width}});this.updateOffsets(a,i),this.onZoomChangeListeners.forEach(s=>s(e))}}setPatternData(e,t=!0){this.imageData=e,e&&this.frameData&&((t||!this.offsets)&&this.recalculateOffsets(e),this.updateOffsets(this.offsets,void 0,!0)),this.imageData&&this.frameData&&this.recalculateZoomLimits(this.imageData,this.frameData)}updateOffsets(e,t,n){const i=this.imageData;if(!i||!this.frameData)return;if(this.frameData.length!==e.length)throw new nn("Frame data and offsets are not the same length. This is a bug. Please report it.");if(!this.offsets.some((s,o)=>!(e[o].x===s.x&&e[o].y===s.y&&e[o].zoom===s.zoom))&&!n){t&&t();return}(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length)),this.frameData.forEach((s,o)=>{this.offsets[o]=MD(e[o],s,this.imageData,this.forceImageCover)}),this._debouncedUpdateFrameOffsets(this.offsets,i,this.frameData,this.thresholdSettings,t)}getThresholdSettings(){return this.thresholdSettings}setThresholdSettings(e){this.thresholdSettings=e,this.imageData&&this.frameData&&this._debouncedUpdateFrameOffsets(this.offsets,this.imageData,this.frameData,e)}onFrameDataChanged(e){e(this.frameData),this.onFrameDataChangeListeners.push(e)}onZoom(e){this.onZoomChangeListeners.push(e)}updateFrameOffsets(e,t,n,i,a){if(!n||n.length===0||n.some(l=>!l))throw new nn("Frame data not set. This is a bug");if(!this.workflowManager)throw new nn("No workflow manager set, cannot update offsets.");const s=this.workflowManager.getRegionElements(this.stepName||""),o=this.workflowManager.getCommandDispatcher();this.targetElements.forEach((l,u)=>{let c=s.find(h=>h.id===l)?.regionIndex??u;c>=e.length&&(c=u),o(new Rn([new rL(l,t,e[c]),new nL(l,i.useThreshold,i.invertThreshold,i.threshold,i.thresholdSaturation)]))}),this.stepName&&this.workflowManager.updateStorage(this.stepName,{frameOffsetsList:e}),a&&a()}recalculateZoomLimits(e,t){(this.minZoomScale.length!==t.length||this.maxZoomScale.length!==t.length)&&(this.minZoomScale=new Array(t.length),this.maxZoomScale=new Array(t.length)),t.forEach((n,i)=>{const a=Math.max(n.width/e.width,n.height/e.height);this.forceImageCover?(this.minZoomScale[i]=a,this.maxZoomScale[i]=a*2.5):(this.minZoomScale[i]=a/10,this.maxZoomScale[i]=a*2.5)})}recalculateOffsets(e){this.frameData&&((!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length)),this.frameData.forEach((t,n)=>{this.offsets[n]=p1(e,t,this.initialZoom&&!this.forceImageCover?{scale:this.initialZoom}:void 0,this.forceImageCover)}),this._debouncedUpdateFrameOffsets(this.offsets,e,this.frameData,this.thresholdSettings))}}class hW{traversableScenes(){throw new Error("Method not implemented.")}updateRecipient(e,t,n,i,a,s,o,l,u,c,h,f,d,g,v,y,A){throw new Error("Method not implemented.")}approveTransaction(e){throw new Error("Method not implemented.")}rejectTransaction(e){throw new Error("Method not implemented.")}getClient(){return this.client??{}}getWorkflowExperience(){return{}}setClient(e){this.client=e}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}async reset(){}updateStateWithServer(e){}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(e){}addPoller(e){}addConfirmCallback(e){}addEditedCallback(e){}addElementsCallback(e){}addInformationResultCallback(e){}addInitCallback(e){}addMakingAdjustmentsCallback(e){}addMandatoryCallback(e){}addMetadataCallback(e){}addSelectionCallback(e){}addStepSpecificStorageCallback(e,t){}addStorageCallback(e){}getCommandDispatcher(){return e=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getRegionElements(e){return[]}getSerializedStep(e,t){}getStepSpecificServices(e){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getInitialOptionIds(){return new Promise(()=>new Set)}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(e){}markUpdateCompleted(e){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}getStepSelections(){return{}}setCurrentAdjustingStepId(e){}setEditedStatus(e,t){}setInformationResults(e){}setMandatoryFulfilled(e,t){}async setSelectionsAndElements(e,t,n){}toggleDesignConfirmed(){}updateMetadata(e,t){}async updateStorage(e,t){}injectIntoPreviewService(e){return Promise.resolve()}ejectFromPreviewService(){}setWorkflowStateSyncEnabled(e){}async updateTransactionShareActions(){}addValidationCallback(e){}setStepError(e,t,n){}getStepErrors(e){}getValidationErrors(){return{steps:new Map}}async updateTransactionStakeholders(){}getStepTags(e){return[]}}var ND=(r=>(r.SelectFrame="SelectFrame",r.SelectImage="SelectImage",r.Position="Position",r))(ND||{});class LD extends Qi{constructor(e,t,n){super(e,t,n);const i=t.data;this.frameService=new _D(i.forceImageCover,i.initialZoomLevel),this.frameService.connectWorkflowManager(e,t.stepName)}selectVariant(e){const t=this.manager.getRegionElements(this.step.stepName);return lo.selectVariant(this.step,e.getResource(),t,this.manager,n=>this.setUpdateState(n))}onFrameDataChanged(e){this.frameService&&this.frameService.onFrameDataChanged(t=>{t&&e(t)})}async selectImage(e,t=!0,n=!0){if(await lo.selectImage(this.step,e,this.manager,n),t){const i=this.manager.getStepStorage(this.step.stepName)?.framePatternData||{};this.manager.updateStorage(this.step.stepName,{framePatternData:{...i,originalAssetKey:e.key,backgroundRemovedAssetKey:void 0,useOriginalAsset:void 0}})}}async canUseAdvancedImageManipulation(){return this.manager.getClient().canUseAddon(Mg.AdvancedImageManipulation)}async canRemoveBackground(){return await this.canUseAdvancedImageManipulation()&&this.hasOriginalImageSelection()&&!!this.frameService?.getImageData()?.src&&!this.frameService?.getImageData()?.svg}async removeBackgroundFromImageSelection(e=!0){if(!await this.canUseAdvancedImageManipulation())throw new Error("The current Integration does not have access to the Background Remover. Please call canUseAdvancedImageManipulation to ensure you disable this feature when appropriate.");const t=await this.getOriginalImageSelection();if(!t)throw new Error("You must supply an image selection before attempting to remove the background.");const n=await Wn.removeBackgroundFromAsset(t);e&&await lo.selectImage(this.step,n,this.manager,!1);const i=this.manager.getStepStorage(this.step.stepName)?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...i,backgroundRemovedAssetKey:n.key,useOriginalAsset:!e}}),n}async vectorize(e,t=void 0){const n=e??await this.getOriginalImageSelection();if(!n)throw new Error("You must supply an image selection before attempting to vectorize the image.");const i=await Wn.vectorizeAsset(n,t);await this.selectImage(i,e!==void 0);const a=this.manager.getStepStorage(this.step.stepName)?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...a,vectorizedAssetKey:i.key,useOriginalAsset:!1}}),i}async getBackgroundRemovedImageSelection(){const e=this.manager.getStepStorage(this.step.stepName)?.framePatternData?.backgroundRemovedAssetKey;if(e)return Wn.getLocalOrFromServer(e)}async getVectorizedImageSelection(){const e=this.manager.getStepStorage(this.step.stepName)?.framePatternData?.vectorizedAssetKey;if(e)return Wn.getLocalOrFromServer(e)}hasOriginalImageSelection(){return!!this.manager.getStepStorage(this.step.stepName)?.framePatternData?.originalAssetKey}hasBackgroundRemovedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.backgroundRemovedAssetKey}hasVectorizedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.vectorizedAssetKey}async changeColors(e){await lo.changeColors(this.step,this.manager,e)}getImageData(){if(this.frameService)return this.frameService.getImageData()}async getColorOption(){return await ft.ensureFullOption(this.step.data.colorOption)}getAvailableColors(){return this.step.data.colorPickerEnabled?lo.availableColors(this.step,this.manager):Promise.resolve([])}isColorPickerEnabled(){return this.step.data.colorPickerEnabled??!1}async getOriginalImageColors(){const e=this.getImageData();return e?.svg?(await Oa(e.svg)).colors:void 0}getShouldVectorize(){return this.step.data.shouldVectorize??!1}getVectorizeMaxColors(){return this.step.data.vectorizeMaxColors}getMaxAllowedColors(){return this.step.data.maxColors}getUniqueColorCount(){return lo.getUniqueColorCount(this.step,this.manager)}getCurrentFrameStep(e,t,n,i){return i&&i.length>1&&e===void 0?"SelectFrame":t||n||this.getImageData()?"Position":"SelectImage"}getFrameService(){return this.frameService}hasOverlayImageKey(){return this.step.data.overlayImageKey}hasOverlayImageUrl(){return this.step.data.overlayImageUrl}getWhitelistedExtensions(){return[...this.step.data.whitelistedExtensions,...this.step.data.whitelistedExtensions.includes(".jpg")?[".jpeg"]:[]]}async getOriginalImageSelection(){const e=this.manager.getStepStorage(this.step.stepName)?.framePatternData?.originalAssetKey;if(e)return Wn.getLocalOrFromServer(e)}getUseOriginalImageSelection(){return this.getFrameStepStorage()?.framePatternData?.useOriginalAsset??!1}async setUseOriginalImageSelection(e){const t=this.getFrameStepStorage()?.framePatternData||{};if(t.useOriginalAsset===e)return;const n=await this.getOriginalImageSelection();if(!n)throw new Error("You must provide an image selection before calling setUseOriginalImageSelection");if(e)await this.selectImage(n,!1,!1);else{const i=await this.getBackgroundRemovedImageSelection();if(!i)throw new Error("You must call removeBackgroundFromImageSelection before attempting to apply the image.");await this.selectImage(i,!1,!1)}this.manager.updateStorage(this.step.stepName,{framePatternData:{...t,useOriginalAsset:e}})}getFrameStepStorage(){return this.manager.getStepStorage(this.step.stepName)}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}const pW=Fe`
2703
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var NQ={normalizePrecision:function(e){var t=e.reduce(function(n,i){return Math.max(n.getPrecision(),i.getPrecision())});return e.map(function(n){return n.getPrecision()!==t?n.convertPrecision(t):n})},minimum:function(e){var t=o2(e),n=t[0],i=t.slice(1),a=n;return i.forEach(function(s){a=a.lessThan(s)?a:s}),a},maximum:function(e){var t=o2(e),n=t[0],i=t.slice(1),a=n;return i.forEach(function(s){a=a.greaterThan(s)?a:s}),a}};function kD(r){return!isNaN(parseInt(r))&&isFinite(r)}function LQ(r){return kD(r)&&r<=100&&r>=0}function UQ(r){return r.length>0&&r.every(function(e){return e>=0})&&r.some(function(e){return e>0})}function u2(r){return r%2===0}function c2(r){return kD(r)&&!Number.isInteger(r)}function VQ(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=r.toString();if(e.indexOf("e-")>0)return parseInt(e.split("e-")[1]);var t=e.split(".")[1];return t?t.length:0}function Nf(r){return Math.abs(r)%1===.5}function zQ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(t,n){var i=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){i.readyState===4&&(i.status>=200&&i.status<400?t(JSON.parse(i.responseText)):n(new Error(i.statusText)))},onerror:function(){n(new Error("Network error"))}});i.open("GET",r,!0),HQ(i,e.headers),i.send()})}function HQ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(var t in e)r.setRequestHeader(t,e[t]);return r}function Jf(r){return typeof r>"u"}function FD(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".",t={};return Object.entries(r).forEach(function(n){if(cd(n[1])==="object"){var i=FD(n[1]);Object.entries(i).forEach(function(a){t[n[0]+e+a[0]]=a[1]})}else t[n[0]]=n[1]}),t}function jQ(r){return!!r&&(cd(r)==="object"||typeof r=="function")&&typeof r.then=="function"}function TD(){var r=function(n,i){var a=function(l){return Math.pow(10,VQ(l))},s=Math.max(a(n),a(i));return Math.round(n*s)*Math.round(i*s)/(s*s)},e={HALF_ODD:function(n){var i=Math.round(n);return Nf(n)&&u2(i)?i-1:i},HALF_EVEN:function(n){var i=Math.round(n);return Nf(n)?u2(i)?i:i-1:i},HALF_UP:function(n){return Math.round(n)},HALF_DOWN:function(n){return Nf(n)?Math.floor(n):Math.round(n)},HALF_TOWARDS_ZERO:function(n){return Nf(n)?Math.sign(n)*Math.floor(Math.abs(n)):Math.round(n)},HALF_AWAY_FROM_ZERO:function(n){return Nf(n)?Math.sign(n)*Math.ceil(Math.abs(n)):Math.round(n)},DOWN:function(n){return Math.floor(n)}};return{add:function(n,i){return n+i},subtract:function(n,i){return n-i},multiply:function(n,i){return c2(n)||c2(i)?r(n,i):n*i},divide:function(n,i){return n/i},modulo:function(n,i){return n%i},round:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"HALF_EVEN";return e[i](n)}}}var GQ=TD();function $Q(r){var e=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(r);return{getMatches:function(){return e!==null?e.slice(1).filter(function(n){return!Jf(n)}):[]},getMinimumFractionDigits:function(){var n=function(a){return a==="."};return Jf(this.getMatches().find(n))?0:this.getMatches()[GQ.add(this.getMatches().findIndex(n),1)].split("").length},getCurrencyDisplay:function(){var n={USD:"code",dollar:"name",$:"symbol"};return n[this.getMatches().find(function(i){return i==="USD"||i==="dollar"||i==="$"})]},getStyle:function(){return Jf(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!Jf(this.getMatches().find(function(n){return n===","}))}}}function qQ(r){var e=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;for(var s in a)i=i.replace("{{".concat(s,"}}"),a[s]);return i},t=function(i,a){return zQ(e(r.endpoint,{from:i,to:a}),{headers:r.headers})};return{getExchangeRate:function(i,a){return(jQ(r.endpoint)?r.endpoint:t(i,a)).then(function(s){return FD(s)[e(r.propertyPath,{from:i,to:a})]})}}}function _d(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Error;if(!r)throw new t(e)}function QQ(r){_d(LQ(r),"You must provide a numeric value between 0 and 100.",RangeError)}function WQ(r){_d(UQ(r),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function Xv(r){_d(Number.isInteger(r),"You must provide an integer.",TypeError)}var En=TD(),YQ=function r(e){var t=Object.assign({},{amount:r.defaultAmount,currency:r.defaultCurrency,precision:r.defaultPrecision},e),n=t.amount,i=t.currency,a=t.precision;Xv(n),Xv(a);var s=r.globalLocale,o=r.globalFormat,l=r.globalRoundingMode,u=r.globalFormatRoundingMode,c=Object.assign({},r.globalExchangeRatesApi),h=function(g){var v=Object.assign({},Object.assign({},{amount:n,currency:i,precision:a},g),Object.assign({},{locale:this.locale},g));return Object.assign(r({amount:v.amount,currency:v.currency,precision:v.precision}),{locale:v.locale})},f=function(g){_d(this.hasSameCurrency(g),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return n},getCurrency:function(){return i},getLocale:function(){return this.locale||s},setLocale:function(g){return h.call(this,{locale:g})},getPrecision:function(){return a},convertPrecision:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;Xv(g);var y=this.getPrecision(),A=g>y,w=A?En.multiply:En.divide,k=A?[g,y]:[y,g],T=Math.pow(10,En.subtract.apply(En,k));return h.call(this,{amount:En.round(w(this.getAmount(),T),v),precision:g})},add:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return h.call(this,{amount:En.add(v[0].getAmount(),v[1].getAmount()),precision:v[0].getPrecision()})},subtract:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return h.call(this,{amount:En.subtract(v[0].getAmount(),v[1].getAmount()),precision:v[0].getPrecision()})},multiply:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return h.call(this,{amount:En.round(En.multiply(this.getAmount(),g),v)})},divide:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return h.call(this,{amount:En.round(En.divide(this.getAmount(),g),v)})},percentage:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return QQ(g),this.multiply(En.divide(g,100),v)},allocate:function(g){var v=this;WQ(g);for(var y=g.reduce(function(T,S){return En.add(T,S)}),A=this.getAmount(),w=g.map(function(T){var S=Math.floor(En.divide(En.multiply(v.getAmount(),T),y));return A=En.subtract(A,S),h.call(v,{amount:S})}),k=0;A>0;)g[k]>0&&(w[k]=w[k].add(h.call(this,{amount:1})),A=En.subtract(A,1)),k+=1;return w},convert:function(g){var v=this,y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=y.endpoint,w=A===void 0?c.endpoint:A,k=y.propertyPath,T=k===void 0?c.propertyPath||"rates.{{to}}":k,S=y.headers,R=S===void 0?c.headers:S,B=y.roundingMode,G=B===void 0?l:B,$=Object.assign({},{endpoint:w,propertyPath:T,headers:R,roundingMode:G});return qQ($).getExchangeRate(this.getCurrency(),g).then(function(Y){return _d(!Jf(Y),'No rate was found for the destination currency "'.concat(g,'".'),TypeError),h.call(v,{amount:En.round(En.multiply(v.getAmount(),parseFloat(Y)),$.roundingMode),currency:g})})},equalsTo:function(g){return this.hasSameAmount(g)&&this.hasSameCurrency(g)},lessThan:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return v[0].getAmount()<v[1].getAmount()},lessThanOrEqual:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return v[0].getAmount()<=v[1].getAmount()},greaterThan:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return v[0].getAmount()>v[1].getAmount()},greaterThanOrEqual:function(g){f.call(this,g);var v=r.normalizePrecision([this,g]);return v[0].getAmount()>=v[1].getAmount()},isZero:function(){return this.getAmount()===0},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return En.modulo(this.getAmount(),Math.pow(10,a))!==0},hasCents:function(){return En.modulo(this.getAmount(),Math.pow(10,a))!==0},hasSameCurrency:function(g){return this.getCurrency()===g.getCurrency()},hasSameAmount:function(g){var v=r.normalizePrecision([this,g]);return v[0].getAmount()===v[1].getAmount()},toFormat:function(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:o,v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,y=$Q(g);return this.toRoundedUnit(y.getMinimumFractionDigits(),v).toLocaleString(this.getLocale(),{currencyDisplay:y.getCurrencyDisplay(),useGrouping:y.getUseGrouping(),minimumFractionDigits:y.getMinimumFractionDigits(),style:y.getStyle(),currency:this.getCurrency()})},toUnit:function(){return En.divide(this.getAmount(),Math.pow(10,a))},toRoundedUnit:function(g){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,y=Math.pow(10,g);return En.divide(En.round(En.multiply(this.toUnit(),y),v),y)},toObject:function(){return{amount:n,currency:i,precision:a}},toJSON:function(){return this.toObject()}}},XQ=Object.assign(YQ,PQ,RQ,NQ),Ka={},Jv,f2;function JQ(){if(f2)return Jv;f2=1;function r(t){return t}function e(t,a,s){for(var a=a||r,s=s||t,o=0,l=t.length;o<l;o+=1)if(a.call(s,t[o],o))return t[o]}return Jv=e,Jv}var Kv={exports:{}},d2;function KQ(){if(d2)return Kv.exports;d2=1;var r=Kv.exports=function(e,t){if(typeof e=="function"||t)return r.by(e,t);for(var n={object:[],function:[],string:{},number:{},boolean:{},undefined:{}},i=[],a=0;a<e.length;a++){var s=e[a],o=s==="__proto__"?n.objects:n[typeof s]||n.objects;Array.isArray(o)?o.indexOf(s)<0&&(o.push(s),i.push(s)):Object.hasOwnProperty.call(o,s)||(o[s]=!0,i.push(s))}return i};return r.by=function(e,t){if(typeof e=="function"){var n=t;t=e,e=n}for(var i=[],a=0;a<e.length;a++){for(var s=e[a],o=!1,l=0;l<i.length;l++){var u=i[l];if(t.call(i,s,u)){o=!0;break}}o||i.push(s)}return i},Kv.exports}var Zv,h2;function ZQ(){return h2||(h2=1,Zv=[{code:"AED",number:"784",digits:2,currency:"UAE Dirham",countries:["United Arab Emirates (The)"]},{code:"AFN",number:"971",digits:2,currency:"Afghani",countries:["Afghanistan"]},{code:"ALL",number:"008",digits:2,currency:"Lek",countries:["Albania"]},{code:"AMD",number:"051",digits:2,currency:"Armenian Dram",countries:["Armenia"]},{code:"ANG",number:"532",digits:2,currency:"Netherlands Antillean Guilder",countries:["Curaçao","Sint Maarten (Dutch Part)"]},{code:"AOA",number:"973",digits:2,currency:"Kwanza",countries:["Angola"]},{code:"ARS",number:"032",digits:2,currency:"Argentine Peso",countries:["Argentina"]},{code:"AUD",number:"036",digits:2,currency:"Australian Dollar",countries:["Australia","Christmas Island","Cocos (Keeling) Islands (The)","Heard Island and Mcdonald Islands","Kiribati","Nauru","Norfolk Island","Tuvalu"]},{code:"AWG",number:"533",digits:2,currency:"Aruban Florin",countries:["Aruba"]},{code:"AZN",number:"944",digits:2,currency:"Azerbaijan Manat",countries:["Azerbaijan"]},{code:"BAM",number:"977",digits:2,currency:"Convertible Mark",countries:["Bosnia and Herzegovina"]},{code:"BBD",number:"052",digits:2,currency:"Barbados Dollar",countries:["Barbados"]},{code:"BDT",number:"050",digits:2,currency:"Taka",countries:["Bangladesh"]},{code:"BGN",number:"975",digits:2,currency:"Bulgarian Lev",countries:["Bulgaria"]},{code:"BHD",number:"048",digits:3,currency:"Bahraini Dinar",countries:["Bahrain"]},{code:"BIF",number:"108",digits:0,currency:"Burundi Franc",countries:["Burundi"]},{code:"BMD",number:"060",digits:2,currency:"Bermudian Dollar",countries:["Bermuda"]},{code:"BND",number:"096",digits:2,currency:"Brunei Dollar",countries:["Brunei Darussalam"]},{code:"BOB",number:"068",digits:2,currency:"Boliviano",countries:["Bolivia (Plurinational State Of)"]},{code:"BOV",number:"984",digits:2,currency:"Mvdol",countries:["Bolivia (Plurinational State Of)"]},{code:"BRL",number:"986",digits:2,currency:"Brazilian Real",countries:["Brazil"]},{code:"BSD",number:"044",digits:2,currency:"Bahamian Dollar",countries:["Bahamas (The)"]},{code:"BTN",number:"064",digits:2,currency:"Ngultrum",countries:["Bhutan"]},{code:"BWP",number:"072",digits:2,currency:"Pula",countries:["Botswana"]},{code:"BYN",number:"933",digits:2,currency:"Belarusian Ruble",countries:["Belarus"]},{code:"BZD",number:"084",digits:2,currency:"Belize Dollar",countries:["Belize"]},{code:"CAD",number:"124",digits:2,currency:"Canadian Dollar",countries:["Canada"]},{code:"CDF",number:"976",digits:2,currency:"Congolese Franc",countries:["Congo (The Democratic Republic of The)"]},{code:"CHE",number:"947",digits:2,currency:"WIR Euro",countries:["Switzerland"]},{code:"CHF",number:"756",digits:2,currency:"Swiss Franc",countries:["Liechtenstein","Switzerland"]},{code:"CHW",number:"948",digits:2,currency:"WIR Franc",countries:["Switzerland"]},{code:"CLF",number:"990",digits:4,currency:"Unidad de Fomento",countries:["Chile"]},{code:"CLP",number:"152",digits:0,currency:"Chilean Peso",countries:["Chile"]},{code:"CNY",number:"156",digits:2,currency:"Yuan Renminbi",countries:["China"]},{code:"COP",number:"170",digits:2,currency:"Colombian Peso",countries:["Colombia"]},{code:"COU",number:"970",digits:2,currency:"Unidad de Valor Real",countries:["Colombia"]},{code:"CRC",number:"188",digits:2,currency:"Costa Rican Colon",countries:["Costa Rica"]},{code:"CUC",number:"931",digits:2,currency:"Peso Convertible",countries:["Cuba"]},{code:"CUP",number:"192",digits:2,currency:"Cuban Peso",countries:["Cuba"]},{code:"CVE",number:"132",digits:2,currency:"Cabo Verde Escudo",countries:["Cabo Verde"]},{code:"CZK",number:"203",digits:2,currency:"Czech Koruna",countries:["Czechia"]},{code:"DJF",number:"262",digits:0,currency:"Djibouti Franc",countries:["Djibouti"]},{code:"DKK",number:"208",digits:2,currency:"Danish Krone",countries:["Denmark","Faroe Islands (The)","Greenland"]},{code:"DOP",number:"214",digits:2,currency:"Dominican Peso",countries:["Dominican Republic (The)"]},{code:"DZD",number:"012",digits:2,currency:"Algerian Dinar",countries:["Algeria"]},{code:"EGP",number:"818",digits:2,currency:"Egyptian Pound",countries:["Egypt"]},{code:"ERN",number:"232",digits:2,currency:"Nakfa",countries:["Eritrea"]},{code:"ETB",number:"230",digits:2,currency:"Ethiopian Birr",countries:["Ethiopia"]},{code:"EUR",number:"978",digits:2,currency:"Euro",countries:["Åland Islands","Andorra","Austria","Belgium","Croatia","Cyprus","Estonia","European Union","Finland","France","French Guiana","French Southern Territories (The)","Germany","Greece","Guadeloupe","Holy See (The)","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Martinique","Mayotte","Monaco","Montenegro","Netherlands (The)","Portugal","Réunion","Saint Barthélemy","Saint Martin (French Part)","Saint Pierre and Miquelon","San Marino","Slovakia","Slovenia","Spain"]},{code:"FJD",number:"242",digits:2,currency:"Fiji Dollar",countries:["Fiji"]},{code:"FKP",number:"238",digits:2,currency:"Falkland Islands Pound",countries:["Falkland Islands (The) [Malvinas]"]},{code:"GBP",number:"826",digits:2,currency:"Pound Sterling",countries:["Guernsey","Isle of Man","Jersey","United Kingdom of Great Britain and Northern Ireland (The)"]},{code:"GEL",number:"981",digits:2,currency:"Lari",countries:["Georgia"]},{code:"GHS",number:"936",digits:2,currency:"Ghana Cedi",countries:["Ghana"]},{code:"GIP",number:"292",digits:2,currency:"Gibraltar Pound",countries:["Gibraltar"]},{code:"GMD",number:"270",digits:2,currency:"Dalasi",countries:["Gambia (The)"]},{code:"GNF",number:"324",digits:0,currency:"Guinean Franc",countries:["Guinea"]},{code:"GTQ",number:"320",digits:2,currency:"Quetzal",countries:["Guatemala"]},{code:"GYD",number:"328",digits:2,currency:"Guyana Dollar",countries:["Guyana"]},{code:"HKD",number:"344",digits:2,currency:"Hong Kong Dollar",countries:["Hong Kong"]},{code:"HNL",number:"340",digits:2,currency:"Lempira",countries:["Honduras"]},{code:"HTG",number:"332",digits:2,currency:"Gourde",countries:["Haiti"]},{code:"HUF",number:"348",digits:2,currency:"Forint",countries:["Hungary"]},{code:"IDR",number:"360",digits:2,currency:"Rupiah",countries:["Indonesia"]},{code:"ILS",number:"376",digits:2,currency:"New Israeli Sheqel",countries:["Israel"]},{code:"INR",number:"356",digits:2,currency:"Indian Rupee",countries:["Bhutan","India"]},{code:"IQD",number:"368",digits:3,currency:"Iraqi Dinar",countries:["Iraq"]},{code:"IRR",number:"364",digits:2,currency:"Iranian Rial",countries:["Iran (Islamic Republic Of)"]},{code:"ISK",number:"352",digits:0,currency:"Iceland Krona",countries:["Iceland"]},{code:"JMD",number:"388",digits:2,currency:"Jamaican Dollar",countries:["Jamaica"]},{code:"JOD",number:"400",digits:3,currency:"Jordanian Dinar",countries:["Jordan"]},{code:"JPY",number:"392",digits:0,currency:"Yen",countries:["Japan"]},{code:"KES",number:"404",digits:2,currency:"Kenyan Shilling",countries:["Kenya"]},{code:"KGS",number:"417",digits:2,currency:"Som",countries:["Kyrgyzstan"]},{code:"KHR",number:"116",digits:2,currency:"Riel",countries:["Cambodia"]},{code:"KMF",number:"174",digits:0,currency:"Comorian Franc ",countries:["Comoros (The)"]},{code:"KPW",number:"408",digits:2,currency:"North Korean Won",countries:["Korea (The Democratic People’s Republic Of)"]},{code:"KRW",number:"410",digits:0,currency:"Won",countries:["Korea (The Republic Of)"]},{code:"KWD",number:"414",digits:3,currency:"Kuwaiti Dinar",countries:["Kuwait"]},{code:"KYD",number:"136",digits:2,currency:"Cayman Islands Dollar",countries:["Cayman Islands (The)"]},{code:"KZT",number:"398",digits:2,currency:"Tenge",countries:["Kazakhstan"]},{code:"LAK",number:"418",digits:2,currency:"Lao Kip",countries:["Lao People’s Democratic Republic (The)"]},{code:"LBP",number:"422",digits:2,currency:"Lebanese Pound",countries:["Lebanon"]},{code:"LKR",number:"144",digits:2,currency:"Sri Lanka Rupee",countries:["Sri Lanka"]},{code:"LRD",number:"430",digits:2,currency:"Liberian Dollar",countries:["Liberia"]},{code:"LSL",number:"426",digits:2,currency:"Loti",countries:["Lesotho"]},{code:"LYD",number:"434",digits:3,currency:"Libyan Dinar",countries:["Libya"]},{code:"MAD",number:"504",digits:2,currency:"Moroccan Dirham",countries:["Morocco","Western Sahara"]},{code:"MDL",number:"498",digits:2,currency:"Moldovan Leu",countries:["Moldova (The Republic Of)"]},{code:"MGA",number:"969",digits:2,currency:"Malagasy Ariary",countries:["Madagascar"]},{code:"MKD",number:"807",digits:2,currency:"Denar",countries:["North Macedonia"]},{code:"MMK",number:"104",digits:2,currency:"Kyat",countries:["Myanmar"]},{code:"MNT",number:"496",digits:2,currency:"Tugrik",countries:["Mongolia"]},{code:"MOP",number:"446",digits:2,currency:"Pataca",countries:["Macao"]},{code:"MRU",number:"929",digits:2,currency:"Ouguiya",countries:["Mauritania"]},{code:"MUR",number:"480",digits:2,currency:"Mauritius Rupee",countries:["Mauritius"]},{code:"MVR",number:"462",digits:2,currency:"Rufiyaa",countries:["Maldives"]},{code:"MWK",number:"454",digits:2,currency:"Malawi Kwacha",countries:["Malawi"]},{code:"MXN",number:"484",digits:2,currency:"Mexican Peso",countries:["Mexico"]},{code:"MXV",number:"979",digits:2,currency:"Mexican Unidad de Inversion (UDI)",countries:["Mexico"]},{code:"MYR",number:"458",digits:2,currency:"Malaysian Ringgit",countries:["Malaysia"]},{code:"MZN",number:"943",digits:2,currency:"Mozambique Metical",countries:["Mozambique"]},{code:"NAD",number:"516",digits:2,currency:"Namibia Dollar",countries:["Namibia"]},{code:"NGN",number:"566",digits:2,currency:"Naira",countries:["Nigeria"]},{code:"NIO",number:"558",digits:2,currency:"Cordoba Oro",countries:["Nicaragua"]},{code:"NOK",number:"578",digits:2,currency:"Norwegian Krone",countries:["Bouvet Island","Norway","Svalbard and Jan Mayen"]},{code:"NPR",number:"524",digits:2,currency:"Nepalese Rupee",countries:["Nepal"]},{code:"NZD",number:"554",digits:2,currency:"New Zealand Dollar",countries:["Cook Islands (The)","New Zealand","Niue","Pitcairn","Tokelau"]},{code:"OMR",number:"512",digits:3,currency:"Rial Omani",countries:["Oman"]},{code:"PAB",number:"590",digits:2,currency:"Balboa",countries:["Panama"]},{code:"PEN",number:"604",digits:2,currency:"Sol",countries:["Peru"]},{code:"PGK",number:"598",digits:2,currency:"Kina",countries:["Papua New Guinea"]},{code:"PHP",number:"608",digits:2,currency:"Philippine Peso",countries:["Philippines (The)"]},{code:"PKR",number:"586",digits:2,currency:"Pakistan Rupee",countries:["Pakistan"]},{code:"PLN",number:"985",digits:2,currency:"Zloty",countries:["Poland"]},{code:"PYG",number:"600",digits:0,currency:"Guarani",countries:["Paraguay"]},{code:"QAR",number:"634",digits:2,currency:"Qatari Rial",countries:["Qatar"]},{code:"RON",number:"946",digits:2,currency:"Romanian Leu",countries:["Romania"]},{code:"RSD",number:"941",digits:2,currency:"Serbian Dinar",countries:["Serbia"]},{code:"RUB",number:"643",digits:2,currency:"Russian Ruble",countries:["Russian Federation (The)"]},{code:"RWF",number:"646",digits:0,currency:"Rwanda Franc",countries:["Rwanda"]},{code:"SAR",number:"682",digits:2,currency:"Saudi Riyal",countries:["Saudi Arabia"]},{code:"SBD",number:"090",digits:2,currency:"Solomon Islands Dollar",countries:["Solomon Islands"]},{code:"SCR",number:"690",digits:2,currency:"Seychelles Rupee",countries:["Seychelles"]},{code:"SDG",number:"938",digits:2,currency:"Sudanese Pound",countries:["Sudan (The)"]},{code:"SEK",number:"752",digits:2,currency:"Swedish Krona",countries:["Sweden"]},{code:"SGD",number:"702",digits:2,currency:"Singapore Dollar",countries:["Singapore"]},{code:"SHP",number:"654",digits:2,currency:"Saint Helena Pound",countries:["Saint Helena, Ascension and Tristan Da Cunha"]},{code:"SLE",number:"925",digits:2,currency:"Leone",countries:["Sierra Leone"]},{code:"SOS",number:"706",digits:2,currency:"Somali Shilling",countries:["Somalia"]},{code:"SRD",number:"968",digits:2,currency:"Surinam Dollar",countries:["Suriname"]},{code:"SSP",number:"728",digits:2,currency:"South Sudanese Pound",countries:["South Sudan"]},{code:"STN",number:"930",digits:2,currency:"Dobra",countries:["Sao Tome and Principe"]},{code:"SVC",number:"222",digits:2,currency:"El Salvador Colon",countries:["El Salvador"]},{code:"SYP",number:"760",digits:2,currency:"Syrian Pound",countries:["Syrian Arab Republic"]},{code:"SZL",number:"748",digits:2,currency:"Lilangeni",countries:["Eswatini"]},{code:"THB",number:"764",digits:2,currency:"Baht",countries:["Thailand"]},{code:"TJS",number:"972",digits:2,currency:"Somoni",countries:["Tajikistan"]},{code:"TMT",number:"934",digits:2,currency:"Turkmenistan New Manat",countries:["Turkmenistan"]},{code:"TND",number:"788",digits:3,currency:"Tunisian Dinar",countries:["Tunisia"]},{code:"TOP",number:"776",digits:2,currency:"Pa’anga",countries:["Tonga"]},{code:"TRY",number:"949",digits:2,currency:"Turkish Lira",countries:["Türki̇ye"]},{code:"TTD",number:"780",digits:2,currency:"Trinidad and Tobago Dollar",countries:["Trinidad and Tobago"]},{code:"TWD",number:"901",digits:2,currency:"New Taiwan Dollar",countries:["Taiwan (Province of China)"]},{code:"TZS",number:"834",digits:2,currency:"Tanzanian Shilling",countries:["Tanzania, United Republic Of"]},{code:"UAH",number:"980",digits:2,currency:"Hryvnia",countries:["Ukraine"]},{code:"UGX",number:"800",digits:0,currency:"Uganda Shilling",countries:["Uganda"]},{code:"USD",number:"840",digits:2,currency:"US Dollar",countries:["American Samoa","Bonaire, Sint Eustatius and Saba","British Indian Ocean Territory (The)","Ecuador","El Salvador","Guam","Haiti","Marshall Islands (The)","Micronesia (Federated States Of)","Northern Mariana Islands (The)","Palau","Panama","Puerto Rico","Timor-Leste","Turks and Caicos Islands (The)","United States Minor Outlying Islands (The)","United States of America (The)","Virgin Islands (British)","Virgin Islands (u.s.)"]},{code:"USN",number:"997",digits:2,currency:"US Dollar (Next day)",countries:["United States of America (The)"]},{code:"UYI",number:"940",digits:0,currency:"Uruguay Peso en Unidades Indexadas (UI)",countries:["Uruguay"]},{code:"UYU",number:"858",digits:2,currency:"Peso Uruguayo",countries:["Uruguay"]},{code:"UYW",number:"927",digits:4,currency:"Unidad Previsional",countries:["Uruguay"]},{code:"UZS",number:"860",digits:2,currency:"Uzbekistan Sum",countries:["Uzbekistan"]},{code:"VED",number:"926",digits:2,currency:"Bolívar Soberano",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VES",number:"928",digits:2,currency:"Bolívar Soberano",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VND",number:"704",digits:0,currency:"Dong",countries:["Viet Nam"]},{code:"VUV",number:"548",digits:0,currency:"Vatu",countries:["Vanuatu"]},{code:"WST",number:"882",digits:2,currency:"Tala",countries:["Samoa"]},{code:"XAF",number:"950",digits:0,currency:"CFA Franc BEAC",countries:["Cameroon","Central African Republic (The)","Chad","Congo (The)","Equatorial Guinea","Gabon"]},{code:"XAG",number:"961",digits:0,currency:"Silver",countries:["Zz11_silver"]},{code:"XAU",number:"959",digits:0,currency:"Gold",countries:["Zz08_gold"]},{code:"XBA",number:"955",digits:0,currency:"Bond Markets Unit European Composite Unit (EURCO)",countries:["Zz01_bond Markets Unit European_eurco"]},{code:"XBB",number:"956",digits:0,currency:"Bond Markets Unit European Monetary Unit (E.M.U.-6)",countries:["Zz02_bond Markets Unit European_emu-6"]},{code:"XBC",number:"957",digits:0,currency:"Bond Markets Unit European Unit of Account 9 (E.U.A.-9)",countries:["Zz03_bond Markets Unit European_eua-9"]},{code:"XBD",number:"958",digits:0,currency:"Bond Markets Unit European Unit of Account 17 (E.U.A.-17)",countries:["Zz04_bond Markets Unit European_eua-17"]},{code:"XCD",number:"951",digits:2,currency:"East Caribbean Dollar",countries:["Anguilla","Antigua and Barbuda","Dominica","Grenada","Montserrat","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines"]},{code:"XDR",number:"960",digits:0,currency:"SDR (Special Drawing Right)",countries:["International Monetary Fund (Imf) "]},{code:"XOF",number:"952",digits:0,currency:"CFA Franc BCEAO",countries:["Benin","Burkina Faso","Côte D'ivoire","Guinea-Bissau","Mali","Niger (The)","Senegal","Togo"]},{code:"XPD",number:"964",digits:0,currency:"Palladium",countries:["Zz09_palladium"]},{code:"XPF",number:"953",digits:0,currency:"CFP Franc",countries:["French Polynesia","New Caledonia","Wallis and Futuna"]},{code:"XPT",number:"962",digits:0,currency:"Platinum",countries:["Zz10_platinum"]},{code:"XSU",number:"994",digits:0,currency:"Sucre",countries:['Sistema Unitario De Compensacion Regional De Pagos "Sucre"']},{code:"XTS",number:"963",digits:0,currency:"Codes specifically reserved for testing purposes",countries:["Zz06_testing_code"]},{code:"XUA",number:"965",digits:0,currency:"ADB Unit of Account",countries:["Member Countries of the African Development Bank Group"]},{code:"XXX",number:"999",digits:0,currency:"The codes assigned for transactions where no currency is involved",countries:["Zz07_no_currency"]},{code:"YER",number:"886",digits:2,currency:"Yemeni Rial",countries:["Yemen"]},{code:"ZAR",number:"710",digits:2,currency:"Rand",countries:["Lesotho","Namibia","South Africa"]},{code:"ZMW",number:"967",digits:2,currency:"Zambian Kwacha",countries:["Zambia"]},{code:"ZWG",number:"924",digits:2,currency:"Zimbabwe Gold",countries:["Zimbabwe"]}]),Zv}var ey,p2;function eW(){return p2||(p2=1,ey="2024-06-25"),ey}var g2;function tW(){if(g2)return Ka;g2=1;var r=JQ(),e=KQ(),t=ZQ(),n=eW(),i=function(c){return c=c.toUpperCase(),r(t,function(h){return h.code===c})},a=function(c){return c=c.toLowerCase(),t.filter(function(h){return(h.countries.map(function(f){return f.toLowerCase()})||[]).indexOf(c)>-1})},s=function(c){return r(t,function(h){return h.number===String(c)})},o=function(){return t.map(function(c){return c.code})},l=function(){var c=t.map(function(h){return h.number});return c.filter(function(h){if(h)return h})},u=function(){var c=t.filter(function(h){return h.countries}).map(function(h){return h.countries});return e(Array.prototype.concat.apply([],c))};return Ka.code=i,Ka.country=a,Ka.number=s,Ka.codes=o,Ka.numbers=l,Ka.countries=u,Ka.publishDate=n,Ka.data=t,Ka}var m2=tW();class ID{formatCurrencyForDisplay(e,t){const n={amount:t||0,currency:e,precision:this.getPrecisionForCurrency(e)};return XQ(n).toFormat(this.getSpecialFormat(e))}getPrecisionForCurrency(e){const t=e,n=m2.code(t);return n?n.digits:2}getSpecialFormat(e){const t=e;if(m2.code(t)?.code==="CLP")return"USD0,0"}}const v2=new ID;class DD{constructor(e,t,n,i){this.presentmentCurrency=void 0,this.presentmentCurrency=i,this.partnerCurrency=n,this.rateFrom=e,this.rateTo=t}code(){return this.presentmentCurrency?this.presentmentCurrency:this.partnerCurrency}conversionRequired(){return this.presentmentCurrency!==void 0&&this.code()!==this.partnerCurrency}getConvertedSubunits(e){return this.conversionRequired()?Math.ceil(this.subunits(this.units(e,this.partnerCurrency)/this.rateFrom*this.rateTo,this.code())):e}units(e,t){return e/Math.pow(10,v2.getPrecisionForCurrency(t))}subunits(e,t){return e*Math.pow(10,v2.getPrecisionForCurrency(t))}}const rW=async(r,e)=>{const t=await $e.getShadowGraphqlClient().query({query:B3(e?.assets?.metadata||!1),errorPolicy:"all",variables:{ids:r}});if(t.error)throw t.error;if(t.errors)throw t.errors.forEach(i=>console.error(i)),new Error("Unable to read workflows. Consult GraphQL errors.");if(t.data.workflows===void 0||t.data.workflows.length!==r.length)throw new Error(`Unable to read workflows: ${t.errors??"Length mismatch in response"}`);const n=vo(t.data.workflows);return n.forEach(i=>{i.finalizeStepConfig||(i.finalizeStepConfig={}),i.finalizeStepConfig.termsMarkdown=i.finalizeStepConfig.termsMarkdown||i.partner.termsMarkdown}),n},nW=async(r,e)=>{const n=(await e).find(i=>i.id===r);if(!n)throw new Error(`Workflow not found: ${r}`);return n},Gb=async(r,e)=>{const t=r.map(o=>wd.get({id:o,options:e})),n=r.filter((o,l)=>t[l]===void 0);if(n.length===0)return Promise.all(t);const i=rW(n,e),a=n.map(o=>wd.set({id:o,options:e},nW(o,i))),s=t.filter(o=>o!==void 0);return await Promise.all(s.concat(a))},PD=async(r,e)=>(await Gb([r],e))[0],iW=async r=>{const e=await $e.getShadowGraphqlClient().query({query:fF,variables:{ids:r},errorPolicy:"all",fetchPolicy:"no-cache"});return e.errors&&console.error(e.errors),e.data.integrationProducts||[]};class aW{constructor(e){this.activeIntegration=void 0,this.updateTransactionState=async t=>{try{return $e.getShadowGraphqlClient().mutate({...t,mutation:A3})}catch(n){throw console.error(n),new uo("Critical - Unable to synchronize workflow state with server.")}},this.options=e,this.options.applicationKey&&UO(this.options.applicationKey),console.debug("------------------------"),console.debug("Spiff Commerce Core SDK"),console.debug("Version: 40.3.7"),console.debug(`Application Key Provided: ${!!this.options.applicationKey}`),console.debug("------------------------")}configure(e){_s.setHubUrl(e.hubUrl),_s.setServerUrl(e.serverUrl),_s.setServicesApiUrl(e.servicesApiUrl),this.marketplaceThemeInstallId=e.marketplaceThemeInstallId,this.marketplaceThemeInstallConfigurationId=e.marketplaceThemeInstallConfigurationId,this.userPoolClientId=e.userPoolClientId,this.userPoolRegion=e.userPoolRegion,this.spiffRegion=e.spiffRegion,e.bearerAuthenticationToken&&Hk(e.bearerAuthenticationToken),this.options.applicationKey&&this.getIntegration(),this.spiffRegion&&this.userPoolRegion&&this.userPoolClientId&&_f.init(this.spiffRegion,this.userPoolRegion,this.userPoolClientId)}getAssetManager(){return Wn}async getBetaEnabled(){return this.options.enableBetaFeatures?!0:(await this.getIntegration()).partner.beta===!0}getFlowService(){if(!VO())throw new Error("Application key required to use Flow Service.");return new xI}async getCurrencyContext(e){const n=(await this.getIntegration()).partner.currencyCode,a=await $e.getShadowGraphqlClient().query({query:V3,errorPolicy:"all",fetchPolicy:"cache-first",variables:{from:n,to:e}}),{rateFrom:s,rateTo:o}=a.data.currencyConversion;return new DD(s,o,n,e)}async getIntegration(){if(this.activeIntegration)return this.activeIntegration;if(!this.options.applicationKey)throw new Error("Cannot get current Integration without specifying an Application Key.");return this.activeIntegration=RD(this.options.applicationKey),this.activeIntegration}async canUseAddon(e){try{return(await this.getIntegration()).partner.activeAddons?.includes(e)??!1}catch(t){return console.error(t),!1}}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(e){const t=xr.getMap("transactionCustomerIds");t?.has(e)&&(t.delete(e),xr.setMap("transactionCustomerIds",t))}async customerHasBundleTemplates(e){const i=(await $e.getShadowGraphqlClient().query({query:Pp,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;return i.id?i.hasBundleTemplates??!1:!1}getStakeholderTypeForTransaction(e){const t=this.customer?.stakeholders?.find(n=>n.transaction?.id===e);if(t)return t.type}async getOrCreateCustomer(e){this.customer=void 0;const t=$e.getShadowGraphqlClient(),i=(await t.query({query:Pp,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;if(!i.id){const o=(await t.mutate({mutation:Q9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:e}}})).data?.customerCreate;if(!o)throw new Error("Unable to create customer.");return this.storeCustomer(o),this.customer=o,{customer:o,isAuthenticated:!1}}this.storeCustomer(i);const a=await this.reloadLoggedInCustomer();return{customer:this.customer||i,isAuthenticated:a}}getCustomer(){return this.customer}async reloadLoggedInCustomer(){const e=localStorage.getItem("last-refreshed-cognito-tokens"),t=localStorage.getItem("cognito-tokens"),n=localStorage.getItem("cognito-email");if(!e||!t||!n)return!1;const i=JSON.parse(t),a=new Date().getTime()/1e3;if(!i.ExpiresIn||i.ExpiresIn<a-parseInt(e)){const l=await _f.refreshTokens();if(l?.AuthenticationResult)localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),i.AccessToken=l.AuthenticationResult.AccessToken,localStorage.setItem("cognito-tokens",JSON.stringify(i));else return this.logOut(),console.error("Failed to refresh tokens."),!1}const o=(await $e.getShadowGraphqlClient().query({query:Pp,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:n}})).data.customer;return o.id?(this.customer=o,!0):(console.error("Failed to get customer."),!1)}async generateVerificationCode(e){await $e.getShadowGraphqlClient().mutate({mutation:W9,variables:{emailAddress:e}}),await _f.generateCode(e)}async verifyCode(e,t){const n=(await this.getIntegration()).partner.id||"",i=await _f.verifyCode(e,t,n);if(i?.AuthenticationResult){localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),localStorage.setItem("cognito-tokens",JSON.stringify(i.AuthenticationResult)),localStorage.setItem("cognito-email",e);const s=(await $e.getShadowGraphqlClient().query({query:Pp,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;if(!s.id)throw new Error("Failed to get customer.");return this.customer=s,!0}else throw new Error}async logOut(){localStorage.removeItem("last-refreshed-cognito-tokens"),localStorage.removeItem("cognito-tokens"),localStorage.removeItem("cognito-email"),this.clearCustomer()}async loggedInBearerToken(){const e=localStorage.getItem("last-refreshed-cognito-tokens"),t=localStorage.getItem("cognito-tokens");if(!e||!t)throw new Error("No token data in storage.");const n=JSON.parse(t),i=new Date().getTime()/1e3,a=!n?.AccessToken||Ag(n.AccessToken);if(!n.ExpiresIn||n.ExpiresIn<i-parseInt(e)||a){const s=await _f.refreshTokens();if(s?.AuthenticationResult)localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),n.AccessToken=s.AuthenticationResult.AccessToken,localStorage.setItem("cognito-tokens",JSON.stringify(n));else throw this.logOut(),new Error("Failed to refresh tokens.")}if(!n.AccessToken)throw new Error("No bearer token in storage.");return n.AccessToken}async getCustomerMetafields(){if(!this.customer?.id)throw new Error("Customer must be logged in before calling this function.");return(await $e.getShadowGraphqlClient().query({query:Y9,variables:{id:this.customer.id}})).data.metafields}async getNewBundle(e,t,n){const a=(await $e.getShadowGraphqlClient().mutate({mutation:_U(n?.graphql?.productCollection?.eagerFetchProducts||!1),variables:{collectionId:e,initialMetadata:t?Object.entries(t).map((u,c)=>({key:u[0],value:u[1]})):void 0,marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId},fetchPolicy:"no-cache"})).data?.bundleCreate;if(!a?.id)throw new Error("Unable to create bundle");const s=xr.getMap("bundlePartnerIds")||new Map;s.set(a.id,a.partner.id),xr.setMap("bundlePartnerIds",s);const o=xr.getMap("bundleOwnerIds")||new Map;o.set(a.id,a.bundleOwnerId),xr.setMap("bundleOwnerIds",o);const l=new vE(this,a,void 0,void 0,a.bundleOwnerId,{eagerFetchProducts:n?.graphql?.productCollection?.eagerFetchProducts});return await l.getInitializationPromise(),l}async getExistingBundle(e,t,n,i,a){const o=xr.getMap("bundleOwnerIds")?.get(e),l={};try{const g=await this.loggedInBearerToken();l.Authorization=`Bearer ${g}`}catch{const y=Object.entries(localStorage).find(([w,k])=>w.startsWith("CognitoIdentityServiceProvider")&&w.endsWith("idToken"))?.[0]||"",A=localStorage.getItem(y);A&&!Ag(A)&&(l.Authorization=`Bearer ${A}`)}const u={bundleOwnerId:o,...l,...i?.graphql?.additionalHeaders},c=await $e.getShadowGraphqlClient().query({query:PU(i?.graphql?.productCollection?.eagerFetchProducts||!1),variables:{id:e},fetchPolicy:"no-cache",context:{headers:u}});if(!c.data?.bundles||c.data?.bundles.length===0||!c.data?.bundles[0])throw new Error(`Unable to find bundle: ${e}`);const h=c.data?.bundles[0],f=xr.getMap("bundlePartnerIds")||new Map;f.set(h.id,h.partner.id),xr.setMap("bundlePartnerIds",f);const d=new vE(this,h,t,n,o,{additionalHeaders:i?.graphql?.additionalHeaders,eagerFetchProducts:i?.graphql?.productCollection?.eagerFetchProducts,existingGlobalPropertyState:c.data.globalPropertyState,readonly:i?.readonly},a);return await d.getInitializationPromise(),d}async duplicateBundle(e,t,n,i){const s={...await BD(e),...i?.graphql?.additionalHeaders},l=(await $e.getShadowGraphqlClient().mutate({mutation:NU(),variables:{id:e,template:t,marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId,duplicateTransactions:n},context:{headers:s},fetchPolicy:"no-cache"})).data?.bundleDuplicate;if(!l?.id)throw new Error("Unable to duplicate bundle");const u=xr.getMap("bundlePartnerIds")||new Map;u.set(l.id,l.partner.id),xr.setMap("bundlePartnerIds",u);const c=xr.getMap("bundleOwnerIds")||new Map;return c.set(l.id,l.bundleOwnerId),xr.setMap("bundleOwnerIds",c),async()=>await this.getExistingBundle(l.id,void 0,void 0,{graphql:{productCollection:{eagerFetchProducts:i?.graphql?.productCollection?.eagerFetchProducts||!1}}})}async getBundlesForCustomer(e){if(!this.customer?.id)throw new Error("Customer not authenticated.");const{includeMetadata:t,...n}=e;return(await $e.getShadowGraphqlClient().query({query:WU(t??!1),variables:{...n,id:this.customer.id},fetchPolicy:"no-cache"})).data.customerBundlesFeed}async getBundleStakeholders(){if(!this.customer)throw new Error("Customer not authenticated.");const e=await $e.getShadowGraphqlClient().query({query:RU,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!e.data?.customers||e.data.customers.length===0)throw new Error("Unable to find customer.");const n=e.data.customers[0].bundleStakeholders||[],i=xr.getMap("bundlePartnerIds")||new Map;return n.forEach(a=>{a.bundle?.id&&a.bundle.partner?.id&&i.set(a.bundle.id,a.bundle.partner.id)}),xr.setMap("bundlePartnerIds",i),n}async getWorkflowExperience(e,t){if(!e)throw new Error("getWorkflowExperience has been called without an options object! This is not supported.");const n=await this.getWorkflowExperiences([e],e.graphql),i=n[0],a=i.getWorkflow();return t&&!a&&console.error("No workflow instantiated when trying to create preview service."),t&&a&&await i.getWorkflowManager().injectIntoPreviewService(t(a)),n[0]}async getWorkflowExperiences(e,t,n,i){if(e.length===0)throw new uo("No options provided!");const a=e.map((Y,X)=>({option:Y,index:X})),s=a.filter(Y=>Y.option.type==="transaction"),o=a.filter(Y=>Y.option.type==="integration"||Y.option.type==="external"||Y.option.type==="blank"),l=50,u=sA(s,l),c=sA(o,l);let h=0;const f=$e.getShadowGraphqlClient(),d=async Y=>{if(Y.length===0)return[];const X=Y.map(oe=>oe.option.transactionId),J=await f.query({query:y3,variables:{ids:X},errorPolicy:"all",fetchPolicy:"no-cache"}),W=J.data.transactions;if(h=h+W.length,i&&i(h,s.length),W.length!==Y.length){const oe=J.errors?.[0]?.message||"Unknown error";throw new uo(`Not all transactions were found: ${oe}`)}return!this.activeIntegration&&W[0].integrationProduct?.integration&&(this.activeIntegration=Promise.resolve(W[0].integrationProduct.integration)),W.map((oe,se)=>({transaction:oe,workflowId:oe.workflowId,readOnly:Y.find(he=>he.option.transactionId===oe.id)?.option.readOnly??!1,index:Y[se].index}))},g=async Y=>{if(Y.length===0)return[];const X=await f.mutate({mutation:v3,variables:{inputs:Y.map(W=>({integrationProductId:W.option.type==="integration"?W.option.integrationProductId:void 0,externalIntegrationId:W.option.type==="external"?W.option.externalIntegrationId:void 0,externalProductId:W.option.type==="external"?W.option.externalProductId:void 0,workflowId:W.option.workflowId,designName:W.option.designName,claim:!0,quantity:W.option.quantity,recipient:W.option.recipient})),marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId},errorPolicy:"all",fetchPolicy:"no-cache"}),J=X.data?.transactionCreateMany;if(!J||J.length===0){const W=X.errors?.[0]?.message||"Unknown error";throw new uo(`Failed to create transactions: ${W}`)}return h=h+J.length,i&&i(h,s.length),J.map((W,oe)=>({transaction:W,workflowId:W.workflowId,readOnly:!1,index:Y[oe].index}))},v=(await Promise.all([...u.map(d),...c.map(g)])).flat(),y=[...new Set(v.map(Y=>Y.transaction.integrationProductId))].filter(Y=>Y!==void 0),A=[...new Set(v.map(Y=>Y.workflowId))].filter(Y=>Y!==void 0),[w,k]=await Promise.all([(async()=>y.length>0?await iW(y):[])(),(async()=>A.length>0?await Gb(A,t):[])()]),T=new Map(w.map(Y=>[Y.id,Y])),S=new Map(k.map(Y=>[Y.id,Y])),R=v.map(async Y=>{const{transaction:X,workflowId:J,readOnly:W,index:oe}=Y,se=J?S.get(J):void 0,he=e[oe];if(X.integrationProductId){const K=T.get(X.integrationProductId);X.integrationProduct=K,X.product=K?.product,X.integrationProduct||console.error("failed to find transaction's product")}const ye=xr.getMap("transactionOwnerIds")||new Map;!ye.get(X.id)&&X.transactionOwnerId&&(ye.set(X.id,X.transactionOwnerId),xr.setMap("transactionOwnerIds",ye));const Ue=ye.get(X.id)||void 0,Oe=new X9({onMutate:()=>({context:{transactionOwnerId:Ue,bundleOwnerId:t?.bundleOwnerId}}),onQuery:()=>({context:{transactionOwnerId:Ue,bundleOwnerId:t?.bundleOwnerId}})}),Te={workflow:se,transaction:X,singleVariantsRenderable:he?.workflowConfiguration?.singleVariantsRenderable,stateMutationFunc:W?async()=>{throw new nn("State mutation is forbidden in read only mode!")}:async K=>this.updateTransactionState({...K,context:{transactionOwnerId:Ue,bundleOwnerId:t?.bundleOwnerId}}),graphQlClient:()=>Oe,readOnly:W,isReloadedTransaction:he.type==="transaction"};if(he.type==="transaction"&&X.workflowState){const K=JSON.parse(X.workflowState);await tA(K),Te.reloadedState=K}else if(!W&&he.workflowState){const K=JSON.parse(he.workflowState);await tA(K),Te.reloadedState=K}return Te.delayWorkflowStateSync=!0,{experienceOptions:Te,index:oe,options:he}}),G=(await Promise.all(R)).sort((Y,X)=>Y.index-X.index);let $=[];for(const Y of G){const{experienceOptions:X,options:J}=Y,W=new vI(this,X);await W.getWorkflowManager().getInitializationPromise(),n&&n(),J.type!=="transaction"&&this.customer&&await W.attachCustomerDetails({email:this.customer.emailAddress}),$=[...$,W],W.getWorkflowManager().setWorkflowStateSyncEnabled(!0)}return $}storeCustomer(e){const t=xr.getMap("partnerCustomerIds")||new Map;t.set(e.partner.id,e.id),xr.setMap("partnerCustomerIds",t)}async getIntegrationProductById(e,t){const a=(await $e.getShadowGraphqlClient().query({query:k3(t),variables:{ids:[e]},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.integrationProducts;if(!a||a.length===0||!a[0]?.id)throw new Error("Integration product not found.");return new uA(a[0])}async getIntegrationProductFromExternalIds(e,t,n){const s=(await $e.getShadowGraphqlClient().query({query:F3(n),variables:{externalProductId:t,externalIntegrationId:e},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.integrationProductFromExternalIds;if(!s?.id)throw new Error("Integration product not found.");return new uA(s)}async getIntegrationProduct(e){return e.type==="integration"?this.getIntegrationProductById(e.integrationProductId):this.getIntegrationProductFromExternalIds(e.externalIntegrationId,e.externalProductId)}async getShareActionsForTransaction(e){const n=(xr.getMap("transactionOwnerIds")||new Map).get(e)||void 0,i=await $e.getShadowGraphqlClient().query({query:S3,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e},context:{transactionOwnerId:n}});if(!i.data.transactions||i.data.transactions.length!==1)throw new Error(`Failed to fetch share actions for transaction: ${e}`);return i.data.transactions[0].transactionShareActions}async placeOrder(e){const t=await $e.getShadowGraphqlClient().mutate({mutation:U3,variables:{orderItems:e}});if(t.errors)throw new Error(t.errors[0].message);if(!t.data)throw new Error("Failed to create order: No order data in response.");return{id:t.data.orderCreate.id,internalId:t.data.orderCreate.internalId}}}const RD=async(r,e)=>(await $e.getShadowGraphqlClient().query({query:_3,errorPolicy:"all",fetchPolicy:"no-cache",context:{headers:{"x-application-key":r},skipIntegrationCheck:!0},variables:{themeConfigurationId:e}})).data.currentIntegration,sW=async r=>{const t=await $e.getShadowGraphqlClient().query({query:x3,errorPolicy:"all",fetchPolicy:"network-only",variables:{id:r}});if(t.data.transactions.length!==0)return t.data.transactions[0]},oW=async(r,e)=>(await $e.getShadowGraphqlClient().query({query:M3,errorPolicy:"all",variables:{themeConfigurationId:r,themeInstallId:e}})).data?.marketplaceThemeInstallConfiguration,lW=async r=>(await $e.getShadowGraphqlClient().query({query:L3,errorPolicy:"all",variables:{id:r}})).data?.bundles?.[0]?.marketplaceThemeInstallConfiguration,uW=async r=>(await $e.getShadowGraphqlClient().query({query:N3,errorPolicy:"all",variables:{id:r}})).data?.transactions?.[0]?.marketplaceThemeInstallConfiguration;async function OD(){const r={};try{const e=await this.loggedInBearerToken();r.Authorization=`Bearer ${e}`}catch{const n=Object.entries(localStorage).find(([a,s])=>a.startsWith("CognitoIdentityServiceProvider")&&a.endsWith("idToken"))?.[0]||"",i=localStorage.getItem(n);i&&!Ag(i)&&(r.Authorization=`Bearer ${i}`)}return r}async function BD(r){const t=xr.getMap("bundleOwnerIds")?.get(r),n=await OD();return{bundleOwnerId:t,...n}}async function cW(r){const t=xr.getMap("transactionOwnerIds")?.get(r),n=await OD();return{transactionOwnerId:t,...n}}const fW=async r=>{const e=await BD(r),t=await $e.getShadowGraphqlClient().mutate({mutation:n9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r},context:{headers:e}});if(t.data?.bundleDelete!==r)throw new Error(`Failed to delete bundle: ${t.errors}`)},dW=async r=>{const e=await cW(r),t=await $e.getShadowGraphqlClient().mutate({mutation:i9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{ids:[r]},context:{headers:e}});if(!t.data?.transactions||t.data.transactions.length!==1||t.data.transactions[0].id!==r)throw new Error(`Failed to find transaction to read bundle id: ${JSON.stringify(t.errors)}`);return t.data.transactions[0].bundle?.id};function MD(r,e,t,n){const i=t.width*r.zoom,a=t.height*r.zoom;if(n){const o=r,l=Math.max(e.width/t.width,e.height/t.height);o.zoom=Math.max(l,r.zoom);const u=t.width*o.zoom,c=t.height*o.zoom;return o.x=Bp(r.x,e.width-u,0),o.y=Bp(r.y,e.height-c,0),o}const s=r;return s.x=Bp(s.x,-i,e.width),s.y=Bp(s.y,-a,e.height),s}function Bp(r,e,t){return Math.min(Math.max(r,e),t)}class _D{constructor(e,t){this.minZoomScale=[.03],this.maxZoomScale=[20],this._debouncedUpdateFrameOffsets=mI(this.updateFrameOffsets,200),this.targetElements=[],this.onFrameDataChangeListeners=[],this.onZoomChangeListeners=[],this.forceImageCover=e,this.initialZoom=t,this.thresholdSettings={useThreshold:!1,invertThreshold:!1,threshold:128,thresholdSaturation:.5}}connectWorkflowManager(e,t){t&&e.addStepSpecificStorageCallback(async n=>{if(n){const i=n;if(i.currentFrameSources){let a=!1;for(let s=0;s<i.currentFrameSources.length;s++){const o=i.currentFrameSources[s],l=await th(o),u=this.frameData?this.frameData[s]:void 0;xd(l,u)||(this.frameData||(this.frameData=new Array(i.currentFrameSources.length)),this.frameData[s]=l,a=!0)}a&&(this.onFrameDataChangeListeners.forEach(s=>s(this.frameData)),this.frameData&&this.imageData&&(this.recalculateOffsets(this.imageData),this.updateOffsets(this.offsets),this.recalculateZoomLimits(this.imageData,this.frameData)))}}},t),this.workflowManager=e,this.stepName=t}setTargetElements(e){this.targetElements=e}getFrameData(){return this.frameData}setFrameData(e){if(!e){this.frameData=void 0;return}e.forEach((t,n)=>{const i=Vu.get(t);i&&(this.frameData||(this.frameData=new Array(e.length)),this.frameData[n]=i)})}getImageData(){return this.imageData}getImageSrc(){if(this.imageData){if(this.imageData.svg){const e=Hg(this.imageData.svg,this.imageData.colors||{},!1);return Vg(e)}return this.imageData.src}}getOffsets(){return this.offsets}setOffsets(e){this.offsets=e}setZoom(e,t,n,i){if(this.imageData&&this.offsets&&this.frameData){(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length));const a=this.frameData.map((s,o)=>{const l=(t[o]-this.offsets[o].x)/this.offsets[o].zoom,u=(n[o]-this.offsets[o].y)/this.offsets[o].zoom,c=t[o]-l*e[o],h=n[o]-u*e[o];return{x:c,y:h,zoom:this.imageData.width*e[o]/this.imageData.width}});this.updateOffsets(a,i),this.onZoomChangeListeners.forEach(s=>s(e))}}setPatternData(e,t=!0){this.imageData=e,e&&this.frameData&&((t||!this.offsets)&&this.recalculateOffsets(e),this.updateOffsets(this.offsets,void 0,!0)),this.imageData&&this.frameData&&this.recalculateZoomLimits(this.imageData,this.frameData)}updateOffsets(e,t,n){const i=this.imageData;if(!i||!this.frameData)return;if(this.frameData.length!==e.length)throw new nn("Frame data and offsets are not the same length. This is a bug. Please report it.");if(!this.offsets.some((s,o)=>!(e[o].x===s.x&&e[o].y===s.y&&e[o].zoom===s.zoom))&&!n){t&&t();return}(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length)),this.frameData.forEach((s,o)=>{this.offsets[o]=MD(e[o],s,this.imageData,this.forceImageCover)}),this._debouncedUpdateFrameOffsets(this.offsets,i,this.frameData,this.thresholdSettings,t)}getThresholdSettings(){return this.thresholdSettings}setThresholdSettings(e){this.thresholdSettings=e,this.imageData&&this.frameData&&this._debouncedUpdateFrameOffsets(this.offsets,this.imageData,this.frameData,e)}onFrameDataChanged(e){e(this.frameData),this.onFrameDataChangeListeners.push(e)}onZoom(e){this.onZoomChangeListeners.push(e)}updateFrameOffsets(e,t,n,i,a){if(!n||n.length===0||n.some(l=>!l))throw new nn("Frame data not set. This is a bug");if(!this.workflowManager)throw new nn("No workflow manager set, cannot update offsets.");const s=this.workflowManager.getRegionElements(this.stepName||""),o=this.workflowManager.getCommandDispatcher();this.targetElements.forEach((l,u)=>{let c=s.find(h=>h.id===l)?.regionIndex??u;c>=e.length&&(c=u),o(new Rn([new rL(l,t,e[c]),new nL(l,i.useThreshold,i.invertThreshold,i.threshold,i.thresholdSaturation)]))}),this.stepName&&this.workflowManager.updateStorage(this.stepName,{frameOffsetsList:e}),a&&a()}recalculateZoomLimits(e,t){(this.minZoomScale.length!==t.length||this.maxZoomScale.length!==t.length)&&(this.minZoomScale=new Array(t.length),this.maxZoomScale=new Array(t.length)),t.forEach((n,i)=>{const a=Math.max(n.width/e.width,n.height/e.height);this.forceImageCover?(this.minZoomScale[i]=a,this.maxZoomScale[i]=a*2.5):(this.minZoomScale[i]=a/10,this.maxZoomScale[i]=a*2.5)})}recalculateOffsets(e){this.frameData&&((!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length)),this.frameData.forEach((t,n)=>{this.offsets[n]=p1(e,t,this.initialZoom&&!this.forceImageCover?{scale:this.initialZoom}:void 0,this.forceImageCover)}),this._debouncedUpdateFrameOffsets(this.offsets,e,this.frameData,this.thresholdSettings))}}class hW{traversableScenes(){throw new Error("Method not implemented.")}updateRecipient(e,t,n,i,a,s,o,l,u,c,h,f,d,g,v,y,A){throw new Error("Method not implemented.")}approveTransaction(e){throw new Error("Method not implemented.")}rejectTransaction(e){throw new Error("Method not implemented.")}getClient(){return this.client??{}}getWorkflowExperience(){return{}}setClient(e){this.client=e}getInitializationPromise(){return Promise.resolve()}isInitialized(){return!0}getInformationResults(){return[]}async reset(){}updateStateWithServer(e){}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(e){}addPoller(e){}addConfirmCallback(e){}addEditedCallback(e){}addElementsCallback(e){}addInformationResultCallback(e){}addInitCallback(e){}addMakingAdjustmentsCallback(e){}addMandatoryCallback(e){}addMetadataCallback(e){}addSelectionCallback(e){}addStepSpecificStorageCallback(e,t){}addStorageCallback(e){}getCommandDispatcher(){return e=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getRegionElements(e){return[]}getSerializedStep(e,t){}getStepSpecificServices(e){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getInitialOptionIds(){return new Promise(()=>new Set)}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(e){}markUpdateCompleted(e){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}getStepSelections(){return{}}setCurrentAdjustingStepId(e){}setEditedStatus(e,t){}setInformationResults(e){}setMandatoryFulfilled(e,t){}async setSelectionsAndElements(e,t,n){}toggleDesignConfirmed(){}updateMetadata(e,t){}async updateStorage(e,t){}injectIntoPreviewService(e){return Promise.resolve()}ejectFromPreviewService(){}setWorkflowStateSyncEnabled(e){}async updateTransactionShareActions(){}addValidationCallback(e){}setStepError(e,t,n){}getStepErrors(e){}getValidationErrors(){return{steps:new Map}}async updateTransactionStakeholders(){}getStepTags(e){return[]}}var ND=(r=>(r.SelectFrame="SelectFrame",r.SelectImage="SelectImage",r.Position="Position",r))(ND||{});class LD extends Qi{constructor(e,t,n){super(e,t,n);const i=t.data;this.frameService=new _D(i.forceImageCover,i.initialZoomLevel),this.frameService.connectWorkflowManager(e,t.stepName)}selectVariant(e){const t=this.manager.getRegionElements(this.step.stepName);return lo.selectVariant(this.step,e.getResource(),t,this.manager,n=>this.setUpdateState(n))}onFrameDataChanged(e){this.frameService&&this.frameService.onFrameDataChanged(t=>{t&&e(t)})}async selectImage(e,t=!0,n=!0){if(await lo.selectImage(this.step,e,this.manager,n),t){const i=this.manager.getStepStorage(this.step.stepName)?.framePatternData||{};this.manager.updateStorage(this.step.stepName,{framePatternData:{...i,originalAssetKey:e.key,backgroundRemovedAssetKey:void 0,useOriginalAsset:void 0}})}}async canUseAdvancedImageManipulation(){return this.manager.getClient().canUseAddon(Mg.AdvancedImageManipulation)}async canRemoveBackground(){return await this.canUseAdvancedImageManipulation()&&this.hasOriginalImageSelection()&&!!this.frameService?.getImageData()?.src&&!this.frameService?.getImageData()?.svg}async removeBackgroundFromImageSelection(e=!0){if(!await this.canUseAdvancedImageManipulation())throw new Error("The current Integration does not have access to the Background Remover. Please call canUseAdvancedImageManipulation to ensure you disable this feature when appropriate.");const t=await this.getOriginalImageSelection();if(!t)throw new Error("You must supply an image selection before attempting to remove the background.");const n=await Wn.removeBackgroundFromAsset(t);e&&await lo.selectImage(this.step,n,this.manager,!1);const i=this.manager.getStepStorage(this.step.stepName)?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...i,backgroundRemovedAssetKey:n.key,useOriginalAsset:!e}}),n}async vectorize(e,t=void 0){const n=e??await this.getOriginalImageSelection();if(!n)throw new Error("You must supply an image selection before attempting to vectorize the image.");const i=await Wn.vectorizeAsset(n,t);await this.selectImage(i,e!==void 0);const a=this.manager.getStepStorage(this.step.stepName)?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...a,vectorizedAssetKey:i.key,useOriginalAsset:!1}}),i}async getBackgroundRemovedImageSelection(){const e=this.manager.getStepStorage(this.step.stepName)?.framePatternData?.backgroundRemovedAssetKey;if(e)return Wn.getLocalOrFromServer(e)}async getVectorizedImageSelection(){const e=this.manager.getStepStorage(this.step.stepName)?.framePatternData?.vectorizedAssetKey;if(e)return Wn.getLocalOrFromServer(e)}hasOriginalImageSelection(){return!!this.manager.getStepStorage(this.step.stepName)?.framePatternData?.originalAssetKey}hasBackgroundRemovedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.backgroundRemovedAssetKey}hasVectorizedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.vectorizedAssetKey}async changeColors(e){await lo.changeColors(this.step,this.manager,e)}getImageData(){if(this.frameService)return this.frameService.getImageData()}async getColorOption(){return await ft.ensureFullOption(this.step.data.colorOption)}getAvailableColors(){return this.step.data.colorPickerEnabled?lo.availableColors(this.step,this.manager):Promise.resolve([])}isColorPickerEnabled(){return this.step.data.colorPickerEnabled??!1}async getOriginalImageColors(){const e=this.getImageData();return e?.svg?(await Oa(e.svg)).colors:void 0}getShouldVectorize(){return this.step.data.shouldVectorize??!1}getVectorizeMaxColors(){return this.step.data.vectorizeMaxColors}getMaxAllowedColors(){return this.step.data.maxColors}getUniqueColorCount(){return lo.getUniqueColorCount(this.step,this.manager)}getCurrentFrameStep(e,t,n,i){return i&&i.length>1&&e===void 0?"SelectFrame":t||n||this.getImageData()?"Position":"SelectImage"}getFrameService(){return this.frameService}hasOverlayImageKey(){return this.step.data.overlayImageKey}hasOverlayImageUrl(){return this.step.data.overlayImageUrl}getWhitelistedExtensions(){return[...this.step.data.whitelistedExtensions,...this.step.data.whitelistedExtensions.includes(".jpg")?[".jpeg"]:[]]}async getOriginalImageSelection(){const e=this.manager.getStepStorage(this.step.stepName)?.framePatternData?.originalAssetKey;if(e)return Wn.getLocalOrFromServer(e)}getUseOriginalImageSelection(){return this.getFrameStepStorage()?.framePatternData?.useOriginalAsset??!1}async setUseOriginalImageSelection(e){const t=this.getFrameStepStorage()?.framePatternData||{};if(t.useOriginalAsset===e)return;const n=await this.getOriginalImageSelection();if(!n)throw new Error("You must provide an image selection before calling setUseOriginalImageSelection");if(e)await this.selectImage(n,!1,!1);else{const i=await this.getBackgroundRemovedImageSelection();if(!i)throw new Error("You must call removeBackgroundFromImageSelection before attempting to apply the image.");await this.selectImage(i,!1,!1)}this.manager.updateStorage(this.step.stepName,{framePatternData:{...t,useOriginalAsset:e}})}getFrameStepStorage(){return this.manager.getStepStorage(this.step.stepName)}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}const pW=Fe`
2704
2704
  query GetLoggedInCustomer($email: String!) {
2705
2705
  customer(emailAddress: $email) {
2706
2706
  id
@@ -2903,4 +2903,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
2903
2903
  }
2904
2904
  }
2905
2905
  `,GW=async r=>(await $e.getShadowGraphqlClient().query({query:jW,variables:{ids:r}})).data.integrationProducts;exports.AddonHandle=Mg;exports.AddressValidationJobStatus=zD;exports.AddressValidationResultConfirmationLevel=VD;exports.AddressValidationStatus=LA;exports.ArrayInput=q9;exports.AspectType=zn;exports.AssetNotFoundError=So;exports.AssetType=yd;exports.BringForwardCommand=lL;exports.BringToBackCommand=oL;exports.BringToFrontCommand=sL;exports.BundleDesignCreationCartAddMode=Dk;exports.CanvasCommand=Fn;exports.CollectionProduct=Qf;exports.ColorOptionGlobalPropertyHandle=oA;exports.CommandContext=LT;exports.ConversionDataType=td;exports.CreateElementCommand=ai;exports.CreateLayoutCommand=v1;exports.CurrencyContext=DD;exports.CurrencyService=ID;exports.DeleteElementCommand=Nl;exports.DigitalContentStepHandle=hI;exports.FileUploadGlobalPropertyHandle=yI;exports.FlowExecutionNodeResult=Wf;exports.FlowExecutionResult=SI;exports.FlowService=xI;exports.FontAlignmentCommand=GT;exports.FontColorCommand=HT;exports.FontSizeCommand=jT;exports.FontSourceCommand=rA;exports.FrameService=_D;exports.FrameStep=ND;exports.FrameStepHandle=LD;exports.GlobalPropertyHandle=em;exports.GroupCommand=Rn;exports.IllustrationStepHandle=aI;exports.InformationMessageType=rh;exports.InformationStepHandle=dI;exports.IntegrationProduct=uA;exports.IntegrationType=Rk;exports.LayoutElementFactory=K7;exports.LayoutElementType=Zt;exports.LayoutNotFoundError=Ai;exports.LayoutRenderingPurpose=nc;exports.MaterialStepHandle=sI;exports.MisconfigurationError=ns;exports.MockWorkflowManager=hW;exports.ModelStepHandle=oI;exports.ModuleStepHandle=pI;exports.MoveCommand=Z7;exports.ObjectInput=I1;exports.ObjectInputType=EI;exports.OptionGlobalPropertyHandle=k1;exports.OptionNotFoundError=Ad;exports.ParseError=wl;exports.PictureStepHandle=lI;exports.ProductCameraRig=Ok;exports.ProductCollection=F1;exports.ProductCollectionProductSortKey=wI;exports.ProductWorkflow=Yu;exports.PromiseQueue=Wg;exports.QuestionStepHandle=uI;exports.QueueablePromise=Qg;exports.ResizeCommand=tL;exports.ResourceNotFoundError=ic;exports.RotateCommand=eL;exports.ScaleAxis=gi;exports.SendBackwardsCommand=uL;exports.ShapeStepHandle=cI;exports.ShareActionType=Pk;exports.SpiffCommerceClient=aW;exports.StakeholderType=UA;exports.StepAspectType=Ik;exports.StepHandle=Qi;exports.StepType=Je;exports.TextAlgorithm=Rl;exports.TextChangeCommand=$T;exports.TextGlobalPropertyHandle=AI;exports.TextInput=$9;exports.TextStepHandle=fI;exports.UnhandledBehaviorError=nn;exports.UnitOfMeasurement=Bk;exports.UpdateImageSourceCommand=iL;exports.Variant=Da;exports.WorkflowExperienceEventType=bg;exports.WorkflowExperienceImpl=vI;exports.amtChannelsForAspect=bI;exports.assetService=Wn;exports.browserColorToHex=eF;exports.cmPerPixel=D_;exports.currentDirection=F_;exports.dataUrlFromExternalUrl=DO;exports.deleteBundle=fW;exports.designService=Xp;exports.determineCorrectFontSizeAndLines=ad;exports.digitalContentStepService=A1;exports.domParser=os;exports.duplicateBundle=SW;exports.duplicateTransaction=EW;exports.fetchAsString=ia;exports.findAngle=b_;exports.findElement=Nn;exports.findPmsColors=WB;exports.frameDataCache=Vu;exports.frameStepService=lo;exports.fromUtf8=Dl;exports.generate=Ar;exports.generateCommands=rI;exports.generateSVGWithUnknownColors=Oa;exports.generateStateFromDesignInputSteps=EU;exports.getAddressValidationJobs=UW;exports.getAttributesFromArrayBuffer=Hd;exports.getAxisAlignedBoundingBox=A_;exports.getBoundedOffsets=MD;exports.getBundleIdForTransaction=dW;exports.getBundleThemeConfiguration=lW;exports.getCustomer=kW;exports.getCustomerBundles=FW;exports.getElementVertices=T_;exports.getFrameData=th;exports.getGlobalPropertyStateForBundle=IU;exports.getIntegration=RD;exports.getIntegrationProducts=GW;exports.getNEPoint=E_;exports.getNWPoint=S_;exports.getOrderedTransactions=DW;exports.getOverrideThemeConfiguration=oW;exports.getPointOfRotation=x_;exports.getProductCollections=U9;exports.getSEPoint=k_;exports.getSvgElement=Jg;exports.getTemplateBundles=RW;exports.getTemplateTransactions=PW;exports.getTransaction=sW;exports.getTransactionThemeConfiguration=uW;exports.getTransactionsForBundle=TW;exports.getTransformedAssetURL=jg;exports.getTrueCoordinates=w_;exports.getUnorderedTransactions=IW;exports.getValidationJobsForWorkflowExperiences=LW;exports.getWorkflow=PD;exports.getWorkflows=Gb;exports.graphQlManager=$e;exports.illustrationStepService=id;exports.isCloseToValue=C_;exports.loadFont=_l;exports.matchHexToPms=$B;exports.materialStepService=b1;exports.metafieldManager=Cg;exports.mmPerPixel=I_;exports.modelStepService=C1;exports.modifySVGColors=Hg;exports.moduleStepService=w1;exports.nameBundle=wW;exports.nameTransaction=xW;exports.optionService=ft;exports.outlineFontsInSvg=o7;exports.overrideWorkflowExperienceRecipientAddress=HW;exports.patternImageDataCache=Bs;exports.persistenceService=xr;exports.pictureStepService=x1;exports.pmsToRgb=GB;exports.promiseCache=wd;exports.questionStepService=S1;exports.registerFetchImplementation=EO;exports.registerWindowImplementation=SO;exports.rehydrateSerializedLayout=tA;exports.rgbToPms=Zk;exports.rotateAroundPoint=$f;exports.sanitizeSvgTree=zg;exports.setBearerAuthenticationToken=Hk;exports.setCanvasModule=zA;exports.shapeStepService=zu;exports.shortenUrl=JT;exports.spiffCoreConfiguration=_s;exports.stepAspectValuesToDesignInputSteps=SU;exports.svgColorValueToDefinition=Ny;exports.svgStringDimensions=m1;exports.svgToDataUrl=Vg;exports.textStepService=ui;exports.toUtf8=rm;exports.toast=ZT;exports.validateWorkflowExperienceRecipient=VW;exports.validateWorkflowExperienceRecipients=zW;exports.xmlSerializer=Ro;
2906
- //# sourceMappingURL=index-Fm4XiPgH.cjs.map
2906
+ //# sourceMappingURL=index-VO6zw72N.cjs.map