@commercetools/ts-client 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @commercetools/ts-client
2
2
 
3
+ ## 2.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#803](https://github.com/commercetools/commercetools-sdk-typescript/pull/803) [`94a35e7`](https://github.com/commercetools/commercetools-sdk-typescript/commit/94a35e78924ce63df8727d95ddfaed071cd90140) Thanks [@ajimae](https://github.com/ajimae)! - Fix type error in executor function headers options
8
+
3
9
  ## 2.0.3
4
10
 
5
11
  ### Patch Changes
@@ -686,7 +686,7 @@ async function executeRequest$1(options) {
686
686
  headers: {
687
687
  Authorization: `Basic ${basicAuth}`,
688
688
  'Content-Type': 'application/x-www-form-urlencoded',
689
- 'Conent-Length': _.Buffer.byteLength(body).toString()
689
+ 'Content-Length': _.Buffer.byteLength(body).toString()
690
690
  },
691
691
  httpClient,
692
692
  body
@@ -1252,7 +1252,7 @@ function createQueueMiddleware$1({
1252
1252
 
1253
1253
  var packageJson = {
1254
1254
  name: "@commercetools/ts-client",
1255
- version: "2.0.3",
1255
+ version: "2.0.4",
1256
1256
  engines: {
1257
1257
  node: ">=14"
1258
1258
  },
@@ -677,7 +677,7 @@ async function executeRequest$1(options) {
677
677
  headers: {
678
678
  Authorization: `Basic ${basicAuth}`,
679
679
  'Content-Type': 'application/x-www-form-urlencoded',
680
- 'Conent-Length': Buffer.byteLength(body).toString()
680
+ 'Content-Length': Buffer.byteLength(body).toString()
681
681
  },
682
682
  httpClient,
683
683
  body
@@ -1243,7 +1243,7 @@ function createQueueMiddleware$1({
1243
1243
 
1244
1244
  var packageJson = {
1245
1245
  name: "@commercetools/ts-client",
1246
- version: "2.0.3",
1246
+ version: "2.0.4",
1247
1247
  engines: {
1248
1248
  node: ">=14"
1249
1249
  },
@@ -686,7 +686,7 @@ async function executeRequest$1(options) {
686
686
  headers: {
687
687
  Authorization: `Basic ${basicAuth}`,
688
688
  'Content-Type': 'application/x-www-form-urlencoded',
689
- 'Conent-Length': _.Buffer.byteLength(body).toString()
689
+ 'Content-Length': _.Buffer.byteLength(body).toString()
690
690
  },
691
691
  httpClient,
692
692
  body
@@ -1252,7 +1252,7 @@ function createQueueMiddleware$1({
1252
1252
 
1253
1253
  var packageJson = {
1254
1254
  name: "@commercetools/ts-client",
1255
- version: "2.0.3",
1255
+ version: "2.0.4",
1256
1256
  engines: {
1257
1257
  node: ">=14"
1258
1258
  },
@@ -686,7 +686,7 @@ async function executeRequest$1(options) {
686
686
  headers: {
687
687
  Authorization: `Basic ${basicAuth}`,
688
688
  'Content-Type': 'application/x-www-form-urlencoded',
689
- 'Conent-Length': _.Buffer.byteLength(body).toString()
689
+ 'Content-Length': _.Buffer.byteLength(body).toString()
690
690
  },
691
691
  httpClient,
692
692
  body
@@ -1252,7 +1252,7 @@ function createQueueMiddleware$1({
1252
1252
 
1253
1253
  var packageJson = {
1254
1254
  name: "@commercetools/ts-client",
1255
- version: "2.0.3",
1255
+ version: "2.0.4",
1256
1256
  engines: {
1257
1257
  node: ">=14"
1258
1258
  },
@@ -677,7 +677,7 @@ async function executeRequest$1(options) {
677
677
  headers: {
678
678
  Authorization: `Basic ${basicAuth}`,
679
679
  'Content-Type': 'application/x-www-form-urlencoded',
680
- 'Conent-Length': Buffer.byteLength(body).toString()
680
+ 'Content-Length': Buffer.byteLength(body).toString()
681
681
  },
682
682
  httpClient,
683
683
  body
@@ -1243,7 +1243,7 @@ function createQueueMiddleware$1({
1243
1243
 
1244
1244
  var packageJson = {
1245
1245
  name: "@commercetools/ts-client",
1246
- version: "2.0.3",
1246
+ version: "2.0.4",
1247
1247
  engines: {
1248
1248
  node: ">=14"
1249
1249
  },
@@ -1,4 +1,4 @@
1
- var window;(window||={})["@commercetools/ts-client"]=(()=>{var Jt=Object.create;var xe=Object.defineProperty;var Xt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var er=Object.getPrototypeOf,tr=Object.prototype.hasOwnProperty;var ue=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),De=(r,e)=>{for(var t in e)xe(r,t,{get:e[t],enumerable:!0})},dt=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Zt(e))!tr.call(r,n)&&n!==t&&xe(r,n,{get:()=>e[n],enumerable:!(i=Xt(e,n))||i.enumerable});return r};var q=(r,e,t)=>(t=r!=null?Jt(er(r)):{},dt(e||!r||!r.__esModule?xe(t,"default",{value:r,enumerable:!0}):t,r)),rr=r=>dt(xe({},"__esModule",{value:!0}),r);var le=ue((z,ht)=>{"use strict";var ir=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},D=ir();ht.exports=z=D.fetch;D.fetch&&(z.default=D.fetch.bind(D));z.Headers=D.Headers;z.Request=D.Request;z.Response=D.Response});var xt=ue(Ue=>{"use strict";Ue.byteLength=br;Ue.toByteArray=Ur;Ue.fromByteArray=_r;var F=[],T=[],Ir=typeof Uint8Array<"u"?Uint8Array:Array,Je="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($=0,yt=Je.length;$<yt;++$)F[$]=Je[$],T[Je.charCodeAt($)]=$;var $,yt;T[45]=62;T[95]=63;function gt(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function br(r){var e=gt(r),t=e[0],i=e[1];return(t+i)*3/4-i}function Fr(r,e,t){return(e+t)*3/4-t}function Ur(r){var e,t=gt(r),i=t[0],n=t[1],o=new Ir(Fr(r,i,n)),s=0,l=n>0?i-4:i,c;for(c=0;c<l;c+=4)e=T[r.charCodeAt(c)]<<18|T[r.charCodeAt(c+1)]<<12|T[r.charCodeAt(c+2)]<<6|T[r.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return n===2&&(e=T[r.charCodeAt(c)]<<2|T[r.charCodeAt(c+1)]>>4,o[s++]=e&255),n===1&&(e=T[r.charCodeAt(c)]<<10|T[r.charCodeAt(c+1)]<<4|T[r.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function kr(r){return F[r>>18&63]+F[r>>12&63]+F[r>>6&63]+F[r&63]}function Sr(r,e,t){for(var i,n=[],o=e;o<t;o+=3)i=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),n.push(kr(i));return n.join("")}function _r(r){for(var e,t=r.length,i=t%3,n=[],o=16383,s=0,l=t-i;s<l;s+=o)n.push(Sr(r,s,s+o>l?l:s+o));return i===1?(e=r[t-1],n.push(F[e>>2]+F[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(F[e>>10]+F[e>>4&63]+F[e<<2&63]+"=")),n.join("")}});var Mt=ue(Xe=>{Xe.read=function(r,e,t,i,n){var o,s,l=n*8-i-1,c=(1<<l)-1,h=c>>1,u=-7,d=t?n-1:0,f=t?-1:1,p=r[e+d];for(d+=f,o=p&(1<<-u)-1,p>>=-u,u+=l;u>0;o=o*256+r[e+d],d+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=i;u>0;s=s*256+r[e+d],d+=f,u-=8);if(o===0)o=1-h;else{if(o===c)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-h}return(p?-1:1)*s*Math.pow(2,o-i)};Xe.write=function(r,e,t,i,n,o){var s,l,c,h=o*8-n-1,u=(1<<h)-1,d=u>>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,w=i?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+d>=1?e+=f/c:e+=f*Math.pow(2,1-d),e*c>=2&&(s++,c/=2),s+d>=u?(l=0,s=u):s+d>=1?(l=(e*c-1)*Math.pow(2,n),s=s+d):(l=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;r[t+p]=l&255,p+=w,l/=256,n-=8);for(s=s<<n|l,h+=n;h>0;r[t+p]=s&255,p+=w,s/=256,h-=8);r[t+p-w]|=E*128}});var _e=ue(Z=>{"use strict";var Ze=xt(),J=Mt(),Et=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Z.Buffer=a;Z.SlowBuffer=jr;Z.INSPECT_MAX_BYTES=50;var ke=2147483647;Z.kMaxLength=ke;a.TYPED_ARRAY_SUPPORT=qr();!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function qr(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function _(r){if(r>ke)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,a.prototype),e}function a(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return it(r)}return Tt(r,e,t)}a.poolSize=8192;function Tt(r,e,t){if(typeof r=="string")return Pr(r,e);if(ArrayBuffer.isView(r))return Nr(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(U(r,ArrayBuffer)||r&&U(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(U(r,SharedArrayBuffer)||r&&U(r.buffer,SharedArrayBuffer)))return tt(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return a.from(i,e,t);let n=Lr(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return a.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}a.from=function(r,e,t){return Tt(r,e,t)};Object.setPrototypeOf(a.prototype,Uint8Array.prototype);Object.setPrototypeOf(a,Uint8Array);function Bt(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function Or(r,e,t){return Bt(r),r<=0?_(r):e!==void 0?typeof t=="string"?_(r).fill(e,t):_(r).fill(e):_(r)}a.alloc=function(r,e,t){return Or(r,e,t)};function it(r){return Bt(r),_(r<0?0:nt(r)|0)}a.allocUnsafe=function(r){return it(r)};a.allocUnsafeSlow=function(r){return it(r)};function Pr(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=It(r,e)|0,i=_(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function et(r){let e=r.length<0?0:nt(r.length)|0,t=_(e);for(let i=0;i<e;i+=1)t[i]=r[i]&255;return t}function Nr(r){if(U(r,Uint8Array)){let e=new Uint8Array(r);return tt(e.buffer,e.byteOffset,e.byteLength)}return et(r)}function tt(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&t===void 0?i=new Uint8Array(r):t===void 0?i=new Uint8Array(r,e):i=new Uint8Array(r,e,t),Object.setPrototypeOf(i,a.prototype),i}function Lr(r){if(a.isBuffer(r)){let e=nt(r.length)|0,t=_(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||st(r.length)?_(0):et(r);if(r.type==="Buffer"&&Array.isArray(r.data))return et(r.data)}function nt(r){if(r>=ke)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ke.toString(16)+" bytes");return r|0}function jr(r){return+r!=r&&(r=0),a.alloc(+r)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype};a.compare=function(e,t){if(U(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),U(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let o=0,s=Math.min(i,n);o<s;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0};a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let i;if(t===void 0)for(t=0,i=0;i<e.length;++i)t+=e[i].length;let n=a.allocUnsafe(t),o=0;for(i=0;i<e.length;++i){let s=e[i];if(U(s,Uint8Array))o+s.length>n.length?(a.isBuffer(s)||(s=a.from(s)),s.copy(n,o)):Uint8Array.prototype.set.call(n,s,o);else if(a.isBuffer(s))s.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return n};function It(r,e){if(a.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||U(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return rt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Pt(r).length;default:if(n)return i?-1:rt(r).length;e=(""+e).toLowerCase(),n=!0}}a.byteLength=It;function Dr(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Yr(this,e,t);case"utf8":case"utf-8":return Ft(this,e,t);case"ascii":return Qr(this,e,t);case"latin1":case"binary":return Gr(this,e,t);case"base64":return Vr(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jr(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}a.prototype._isBuffer=!0;function v(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)v(this,t,t+1);return this};a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this};a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this};a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ft(this,0,e):Dr.apply(this,arguments)};a.prototype.toLocaleString=a.prototype.toString;a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0};a.prototype.inspect=function(){let e="",t=Z.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Et&&(a.prototype[Et]=a.prototype.inspect);a.prototype.compare=function(e,t,i,n,o){if(U(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===e)return 0;let s=o-n,l=i-t,c=Math.min(s,l),h=this.slice(n,o),u=e.slice(t,i);for(let d=0;d<c;++d)if(h[d]!==u[d]){s=h[d],l=u[d];break}return s<l?-1:l<s?1:0};function bt(r,e,t,i,n){if(r.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,st(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=a.from(e,i)),a.isBuffer(e))return e.length===0?-1:Ct(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Ct(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function Ct(r,e,t,i,n){let o=1,s=r.length,l=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,s/=2,l/=2,t/=2}function c(u,d){return o===1?u[d]:u.readUInt16BE(d*o)}let h;if(n){let u=-1;for(h=t;h<s;h++)if(c(r,h)===c(e,u===-1?0:h-u)){if(u===-1&&(u=h),h-u+1===l)return u*o}else u!==-1&&(h-=h-u),u=-1}else for(t+l>s&&(t=s-l),h=t;h>=0;h--){let u=!0;for(let d=0;d<l;d++)if(c(r,h+d)!==c(e,d)){u=!1;break}if(u)return h}return-1}a.prototype.includes=function(e,t,i){return this.indexOf(e,t,i)!==-1};a.prototype.indexOf=function(e,t,i){return bt(this,e,t,i,!0)};a.prototype.lastIndexOf=function(e,t,i){return bt(this,e,t,i,!1)};function Hr(r,e,t,i){t=Number(t)||0;let n=r.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;let o=e.length;i>o/2&&(i=o/2);let s;for(s=0;s<i;++s){let l=parseInt(e.substr(s*2,2),16);if(st(l))return s;r[t+s]=l}return s}function $r(r,e,t,i){return Se(rt(e,r.length-t),r,t,i)}function vr(r,e,t,i){return Se(ti(e),r,t,i)}function Kr(r,e,t,i){return Se(Pt(e),r,t,i)}function Wr(r,e,t,i){return Se(ri(e,r.length-t),r,t,i)}a.prototype.write=function(e,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((i===void 0||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return Hr(this,e,t,i);case"utf8":case"utf-8":return $r(this,e,t,i);case"ascii":case"latin1":case"binary":return vr(this,e,t,i);case"base64":return Kr(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wr(this,e,t,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Vr(r,e,t){return e===0&&t===r.length?Ze.fromByteArray(r):Ze.fromByteArray(r.slice(e,t))}function Ft(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n<t;){let o=r[n],s=null,l=o>239?4:o>223?3:o>191?2:1;if(n+l<=t){let c,h,u,d;switch(l){case 1:o<128&&(s=o);break;case 2:c=r[n+1],(c&192)===128&&(d=(o&31)<<6|c&63,d>127&&(s=d));break;case 3:c=r[n+1],h=r[n+2],(c&192)===128&&(h&192)===128&&(d=(o&15)<<12|(c&63)<<6|h&63,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:c=r[n+1],h=r[n+2],u=r[n+3],(c&192)===128&&(h&192)===128&&(u&192)===128&&(d=(o&15)<<18|(c&63)<<12|(h&63)<<6|u&63,d>65535&&d<1114112&&(s=d))}}s===null?(s=65533,l=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=l}return zr(i)}var At=4096;function zr(r){let e=r.length;if(e<=At)return String.fromCharCode.apply(String,r);let t="",i=0;for(;i<e;)t+=String.fromCharCode.apply(String,r.slice(i,i+=At));return t}function Qr(r,e,t){let i="";t=Math.min(r.length,t);for(let n=e;n<t;++n)i+=String.fromCharCode(r[n]&127);return i}function Gr(r,e,t){let i="";t=Math.min(r.length,t);for(let n=e;n<t;++n)i+=String.fromCharCode(r[n]);return i}function Yr(r,e,t){let i=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>i)&&(t=i);let n="";for(let o=e;o<t;++o)n+=ii[r[o]];return n}function Jr(r,e,t){let i=r.slice(e,t),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}a.prototype.slice=function(e,t){let i=this.length;e=~~e,t=t===void 0?i:~~t,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n};function y(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||y(e,t,this.length);let n=this[e],o=1,s=0;for(;++s<t&&(o*=256);)n+=this[e+s]*o;return n};a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||y(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n};a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||y(e,1,this.length),this[e]};a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||y(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||y(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||y(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readBigUInt64LE=P(function(e){e=e>>>0,X(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&de(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});a.prototype.readBigUInt64BE=P(function(e){e=e>>>0,X(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&de(e,this.length-8);let n=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});a.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||y(e,t,this.length);let n=this[e],o=1,s=0;for(;++s<t&&(o*=256);)n+=this[e+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};a.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||y(e,t,this.length);let n=t,o=1,s=this[e+--n];for(;n>0&&(o*=256);)s+=this[e+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s};a.prototype.readInt8=function(e,t){return e=e>>>0,t||y(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,t){e=e>>>0,t||y(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};a.prototype.readInt16BE=function(e,t){e=e>>>0,t||y(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readBigInt64LE=P(function(e){e=e>>>0,X(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&de(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});a.prototype.readBigInt64BE=P(function(e){e=e>>>0,X(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&de(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||y(e,4,this.length),J.read(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||y(e,4,this.length),J.read(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||y(e,8,this.length),J.read(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||y(e,8,this.length),J.read(this,e,!1,52,8)};function A(r,e,t,i,n,o){if(!a.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(t+i>r.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;A(this,e,t,i,l,0)}let o=1,s=0;for(this[t]=e&255;++s<i&&(o*=256);)this[t+s]=e/o&255;return t+i};a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;A(this,e,t,i,l,0)}let o=i-1,s=1;for(this[t+o]=e&255;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+i};a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,1,255,0),this[t]=e&255,t+1};a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Ut(r,e,t,i,n){Ot(e,i,n,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,t}function kt(r,e,t,i,n){Ot(e,i,n,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=s,s=s>>8,r[t+2]=s,s=s>>8,r[t+1]=s,s=s>>8,r[t]=s,t+8}a.prototype.writeBigUInt64LE=P(function(e,t=0){return Ut(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeBigUInt64BE=P(function(e,t=0){return kt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let c=Math.pow(2,8*i-1);A(this,e,t,i,c-1,-c)}let o=0,s=1,l=0;for(this[t]=e&255;++o<i&&(s*=256);)e<0&&l===0&&this[t+o-1]!==0&&(l=1),this[t+o]=(e/s>>0)-l&255;return t+i};a.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let c=Math.pow(2,8*i-1);A(this,e,t,i,c-1,-c)}let o=i-1,s=1,l=0;for(this[t+o]=e&255;--o>=0&&(s*=256);)e<0&&l===0&&this[t+o+1]!==0&&(l=1),this[t+o]=(e/s>>0)-l&255;return t+i};a.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};a.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};a.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};a.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};a.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};a.prototype.writeBigInt64LE=P(function(e,t=0){return Ut(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});a.prototype.writeBigInt64BE=P(function(e,t=0){return kt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function St(r,e,t,i,n,o){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function _t(r,e,t,i,n){return e=+e,t=t>>>0,n||St(r,e,t,4,34028234663852886e22,-34028234663852886e22),J.write(r,e,t,i,23,4),t+4}a.prototype.writeFloatLE=function(e,t,i){return _t(this,e,t,!0,i)};a.prototype.writeFloatBE=function(e,t,i){return _t(this,e,t,!1,i)};function qt(r,e,t,i,n){return e=+e,t=t>>>0,n||St(r,e,t,8,17976931348623157e292,-17976931348623157e292),J.write(r,e,t,i,52,8),t+8}a.prototype.writeDoubleLE=function(e,t,i){return qt(this,e,t,!0,i)};a.prototype.writeDoubleBE=function(e,t,i){return qt(this,e,t,!1,i)};a.prototype.copy=function(e,t,i,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);let o=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),t),o};a.prototype.fill=function(e,t,i,n){if(typeof e=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let s=e.charCodeAt(0);(n==="utf8"&&s<128||n==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<i;++o)this[o]=e;else{let s=a.isBuffer(e)?e:a.from(e,n),l=s.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=s[o%l]}return this};var Y={};function ot(r,e,t){Y[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}ot("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ot("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);ot("ERR_OUT_OF_RANGE",function(r,e,t){let i=`The value of "${r}" is out of range.`,n=t;return Number.isInteger(t)&&Math.abs(t)>2**32?n=Rt(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=Rt(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Rt(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function Xr(r,e,t){X(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&de(e,r.length-(t+1))}function Ot(r,e,t,i,n,o){if(r>t||r<e){let s=typeof e=="bigint"?"n":"",l;throw o>3?e===0||e===BigInt(0)?l=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:l=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:l=`>= ${e}${s} and <= ${t}${s}`,new Y.ERR_OUT_OF_RANGE("value",l,r)}Xr(i,n,o)}function X(r,e){if(typeof r!="number")throw new Y.ERR_INVALID_ARG_TYPE(e,"number",r)}function de(r,e,t){throw Math.floor(r)!==r?(X(r,t),new Y.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Y.ERR_BUFFER_OUT_OF_BOUNDS:new Y.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var Zr=/[^+/0-9A-Za-z-_]/g;function ei(r){if(r=r.split("=")[0],r=r.trim().replace(Zr,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function rt(r,e){e=e||1/0;let t,i=r.length,n=null,o=[];for(let s=0;s<i;++s){if(t=r.charCodeAt(s),t>55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function ti(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function ri(r,e){let t,i,n,o=[];for(let s=0;s<r.length&&!((e-=2)<0);++s)t=r.charCodeAt(s),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function Pt(r){return Ze.toByteArray(ei(r))}function Se(r,e,t,i){let n;for(n=0;n<i&&!(n+t>=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function U(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function st(r){return r!==r}var ii=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function P(r){return typeof BigInt>"u"?ni:r}function ni(){throw new Error("BigInt not supported")}});var Wt=ue((ao,Ne)=>{"use strict";var{AbortController:Kt,AbortSignal:li}=typeof self<"u"?self:typeof window<"u"?window:void 0;Ne.exports=Kt;Ne.exports.AbortSignal=li;Ne.exports.default=Kt});var Ai={};De(Ai,{ClientBuilder:()=>oe,Process:()=>Le,createAuthMiddlewareForAnonymousSessionFlow:()=>ee,createAuthMiddlewareForClientCredentialsFlow:()=>te,createAuthMiddlewareForExistingTokenFlow:()=>re,createAuthMiddlewareForPasswordFlow:()=>ie,createAuthMiddlewareForRefreshTokenFlow:()=>ne,createClient:()=>K,createConcurrentModificationMiddleware:()=>he,createCorrelationIdMiddleware:()=>fe,createHttpMiddleware:()=>pe,createLoggerMiddleware:()=>we,createQueueMiddleware:()=>me,createUserAgentMiddleware:()=>ye});var W=q(le());var ct={};De(ct,{createAuthMiddlewareForAnonymousSessionFlow:()=>ee,createAuthMiddlewareForClientCredentialsFlow:()=>te,createAuthMiddlewareForExistingTokenFlow:()=>re,createAuthMiddlewareForPasswordFlow:()=>ie,createAuthMiddlewareForRefreshTokenFlow:()=>ne,createConcurrentModificationMiddleware:()=>he,createCorrelationIdMiddleware:()=>fe,createErrorMiddleware:()=>lt,createHttpMiddleware:()=>pe,createLoggerMiddleware:()=>we,createQueueMiddleware:()=>me,createUserAgentMiddleware:()=>ye});var Dt=q(le());var I={};De(I,{CONCURRENCT_REQUEST:()=>or,CTP_API_URL:()=>sr,CTP_AUTH_URL:()=>ar,DEFAULT_HEADERS:()=>He,HEADERS_CONTENT_TYPES:()=>nr});var nr=["application/json","application/graphql"],or=20,sr="https://api.europe-west1.gcp.commercetools.com",ar="https://auth.europe-west1.gcp.commercetools.com",He=["content-type","access-control-allow-origin","access-control-allow-headers","access-control-allow-methods","access-control-expose-headers","access-control-max-ag","x-correlation-id","server-timing","date","server","transfer-encoding","access-control-max-age","content-encoding","x-envoy-upstream-service-time","via","alt-svc","connection"];function S(r,e,t={}){this.status=this.statusCode=this.code=r,this.message=e,Object.assign(this,t),this.name=this.constructor.name,this.constructor.prototype.__proto__=Error.prototype,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function ft(...r){S.call(this,0,...r)}function pt(...r){S.call(this,...r)}function ur(...r){S.call(this,400,...r)}function lr(...r){S.call(this,401,...r)}function cr(...r){S.call(this,403,...r)}function dr(...r){S.call(this,404,...r)}function hr(...r){S.call(this,409,...r)}function fr(...r){S.call(this,500,...r)}function pr(...r){S.call(this,503,...r)}function $e(r){switch(r){case 0:return ft;case 400:return ur;case 401:return lr;case 403:return cr;case 404:return dr;case 409:return hr;case 500:return fr;case 503:return pr;default:return}}function wr({statusCode:r,message:e,...t}){let i=e||"Unexpected non-JSON error response";r===404&&(i=`URI not found: ${t.originalRequest?.uri||t.uri}`);let n=$e(r);return n?new n(i,t):new pt(r,i,t)}var Me=wr;function mr(r,e){return[503,...r].includes(e?.status||e?.statusCode)}async function yr(r,e){async function t(){return await r({...e,headers:{...e.headers}})}return t().catch(i=>Promise.reject(i))}async function Q(r){let{url:e,httpClient:t,...i}=r;return await yr(async o=>{let{enableRetry:s,retryConfig:l,abortController:c}=i,{retryCodes:h=[],maxDelay:u=1/0,maxRetries:d=3,backoff:f=!0,retryDelay:p=200,retryOnAbort:w=!0}=l||{},E,B,g=0;ve(h);async function M(){return t(e,{...i,...o,headers:{...i.headers,...o.headers,"Accept-Encoding":"application/json"},...i.body?{data:i.body}:{},withCredentials:o.credentialsMode==="include"})}async function C(){let k=async(j,se)=>{let ae={};try{if(ae=await M(),ae.status>299&&mr(j,ae))return{_response:ae,shouldRetry:!0}}catch(je){if(je.name.includes("AbortError")&&se)return{_response:je,shouldRetry:!0};throw je}return{_response:ae,shouldRetry:!1}},L=w||!c||!c.signal,{_response:ge,shouldRetry:V}=await k(h,L);for(;s&&V&&g<d;){g++;let j=await k(h,L);ge=j._response,V=j.shouldRetry;let se=Ee({retryCount:g,retryDelay:p,maxRetries:d,backoff:f,maxDelay:u});await Ce(se)}return ge}let m=await C();try{m.text&&typeof m.text=="function"?(E=await m.text(),B=JSON.parse(E)):B=m.data||m}catch{B=E}return{data:B,retryCount:g,statusCode:m.status||m.statusCode||B.statusCode,headers:m.headers}},{})}var x=[];for(Ae=0;Ae<256;++Ae)x.push((Ae+256).toString(16).slice(1));var Ae;function wt(r,e=0){return(x[r[e+0]]+x[r[e+1]]+x[r[e+2]]+x[r[e+3]]+"-"+x[r[e+4]]+x[r[e+5]]+"-"+x[r[e+6]]+x[r[e+7]]+"-"+x[r[e+8]]+x[r[e+9]]+"-"+x[r[e+10]]+x[r[e+11]]+x[r[e+12]]+x[r[e+13]]+x[r[e+14]]+x[r[e+15]]).toLowerCase()}var Re,gr=new Uint8Array(16);function Ke(){if(!Re&&(Re=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Re))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Re(gr)}var xr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),We={randomUUID:xr};function Mr(r,e,t){if(We.randomUUID&&!e&&!r)return We.randomUUID();r=r||{};var i=r.random||(r.rng||Ke)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(var n=0;n<16;++n)e[t+n]=i[n];return e}return wt(i)}var Ve=Mr;function Te(){return Ve()}function Er(r){return He.reduce((e,t)=>{let i=r[t]?r[t]:typeof r.get=="function"?r.get(t):null;return i&&(e[t]=i),e},{})}function b(r){if(!r)return null;if(r.raw&&typeof r.raw=="function")return r.raw();if(!r.forEach)return Er(r);let e={};return r.forEach((t,i)=>e[i]=t)}function ce(r){return r!=null&&r.constructor!=null&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function H(r){let e=Object.assign({},r);return e?.headers&&(e.headers.Authorization&&(e.headers.Authorization="Bearer ********"),e.headers.authorization&&(e.headers.authorization="Bearer ********")),e}function G(r,e){return{...e,headers:{...e.headers,Authorization:`Bearer ${r}`}}}var ze=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];function Ee({retryCount:r,retryDelay:e,backoff:t,maxDelay:i}){return t&&r!==0?Math.min(Math.round((Math.random()+1)*e*2**r),i):e}Math.min(Math.round((Math.random()+1)*200*2**10),1/0);function Ce(r){return new Promise(e=>{setTimeout(e,r)})}function O(r){if(!r?.credentials?.clientId||!r.projectKey||!r.host)throw new Error("Missing required options.");return{clientId:r.credentials.clientId,host:r.host,projectKey:r.projectKey}}function Be(r){return Date.now()+r*1e3-5*60*1e3}function R(r){let e=r;return{get:t=>e,set:(t,i)=>{e=t}}}function mt(r){return typeof r<"u"&&r!==null}function Cr(r){return mt(r)?typeof r=="string"?r:Object.fromEntries(Object.entries(r).filter(([e,t])=>![null,void 0,""].includes(t))):""}function Ar(r){let e={},t=new URLSearchParams(r);for(let i of t.keys())t.getAll(i).length>1?e[i]=t.getAll(i):e[i]=t.get(i);return e}function Rr(r){if(r=Cr(r),!r)return"";let e=new URLSearchParams(r);for(let[t,i]of Object.entries(r))Array.isArray(i)&&(e.delete(t),i.filter(mt).forEach(n=>e.append(t,n)));return e.toString()}function Qe(r,e=Ar){return e(r)}function Ie(r,e=Rr){return e(r)}var Tr=()=>typeof window<"u"&&window.document&&window.document.nodeType===9;function Br(){if(Tr())return window.navigator.userAgent;let r=process?.version.slice(1)||"unknow",e=`(${process.platform}; ${process.arch})`;return`node.js/${r} ${e}`}function be(r){let e=null,t=null;if(!r)throw new Error("Missing required option `name`");let i=r.version?`${r.name}/${r.version}`:r.name;r.libraryName&&!r.libraryVersion?e=r.libraryName:r.libraryName&&r.libraryVersion&&(e=`${r.libraryName}/${r.libraryVersion}`),r.contactUrl&&!r.contactEmail?t=`(+${r.contactUrl})`:!r.contactUrl&&r.contactEmail?t=`(+${r.contactEmail})`:r.contactUrl&&r.contactEmail&&(t=`(+${r.contactUrl}; +${r.contactEmail})`);let n=Br(),o=r.customAgent||"";return[i,n,e,t,o].filter(Boolean).join(" ")}function Ge(r){if(!r.host)throw new Error("Request `host` or `url` is missing or invalid, please pass in a valid host e.g `host: http://a-valid-host-url`");if(!r.httpClient&&typeof r.httpClient!="function")throw new Error("An `httpClient` is not available, please pass in a `fetch` or `axios` instance as an option or have them globally available.")}function ve(r){if(!Array.isArray(r))throw new Error("`retryCodes` option must be an array of retry status (error) codes and/or messages.")}function Ye(r){if(!r)throw new Error("Missing required options");if(r.middlewares&&!Array.isArray(r.middlewares))throw new Error("Middlewares should be an array");if(!r.middlewares||!Array.isArray(r.middlewares)||!r.middlewares.length)throw new Error("You need to provide at least one middleware")}function Fe(r,e,t={allowedMethods:ze}){if(!e)throw new Error(`The "${r}" function requires a "Request" object as an argument. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`);if(typeof e.uri!="string")throw new Error(`The "${r}" Request object requires a valid uri. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`);if(!t.allowedMethods.includes(e.method))throw new Error(`The "${r}" Request object requires a valid method. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`)}var qe=q(_e());function at(r){if(!r)throw new Error("Missing required options");if(!r.host)throw new Error("Missing required option (host)");if(!r.projectKey)throw new Error("Missing required option (projectKey)");if(!r.credentials)throw new Error("Missing required option (credentials)");let{clientId:e,clientSecret:t}=r.credentials||{};if(!(e&&t))throw new Error("Missing required credentials (clientId, clientSecret)");let i=r.scopes?r.scopes.join(" "):void 0,n=qe.Buffer.from(`${e}:${t}`).toString("base64"),o=r.oauthUri||"/oauth/token",s=r.host.replace(/\/$/,"")+o,l=`grant_type=client_credentials${i?`&scope=${i}`:""}`;return{url:s,body:l,basicAuth:n}}function Nt(r){if(!r)throw new Error("Missing required options");if(!r.projectKey)throw new Error("Missing required option (projectKey)");let e=r.projectKey;r.oauthUri=r.oauthUri||`/oauth/${e}/anonymous/token`;let t=at(r);return r.credentials.anonymousId&&(t.body+=`&anonymous_id=${r.credentials.anonymousId}`),{...t}}function Oe(r){if(!r)throw new Error("Missing required options");if(!r.host)throw new Error("Missing required option (host)");if(!r.projectKey)throw new Error("Missing required option (projectKey)");if(!r.credentials)throw new Error("Missing required option (credentials)");if(!r.refreshToken)throw new Error("Missing required option (refreshToken)");let{clientId:e,clientSecret:t}=r.credentials;if(!(e&&t))throw new Error("Missing required credentials (clientId, clientSecret)");let i=qe.Buffer.from(`${e}:${t}`).toString("base64"),n=r.oauthUri||"/oauth/token",o=r.host.replace(/\/$/,"")+n,s=`grant_type=refresh_token&refresh_token=${encodeURIComponent(r.refreshToken)}`;return{basicAuth:i,url:o,body:s}}function Lt(r){if(!r)throw new Error("Missing required options");if(!r.host)throw new Error("Missing required option (host)");if(!r.projectKey)throw new Error("Missing required option (projectKey)");if(!r.credentials)throw new Error("Missing required option (credentials)");let{clientId:e,clientSecret:t,user:i}=r.credentials,n=r.projectKey;if(!(e&&t&&i))throw new Error("Missing required credentials (clientId, clientSecret, user)");let{username:o,password:s}=i;if(!(o&&s))throw new Error("Missing required user credentials (username, password)");let l=(r.scopes||[]).join(" "),c=l?`&scope=${l}`:"",h=qe.Buffer.from(`${e}:${t}`).toString("base64"),u=r.oauthUri||`/oauth/${n}/customers/token`,d=r.host.replace(/\/$/,"")+u,f=`grant_type=password&username=${encodeURIComponent(o)}&password=${encodeURIComponent(s)}${c}`;return{basicAuth:h,url:d,body:f}}var jt=q(_e());async function N(r){let{request:e,httpClient:t,tokenCache:i,tokenCacheKey:n,userOption:o,next:s}=r,l=r.url,c=r.body,h=r.basicAuth,u=r.pendingTasks;if(!t||typeof t!="function")throw new Error("an `httpClient` is not available, please pass in a `fetch` or `axios` instance as an option or have them globally available.");let d=i.get(n);if(d&&d.token&&Date.now()<d.expirationTime)return{...G(d.token,e)};if(u.push({request:e,next:s}),d&&d.refreshToken&&(!d.token||d.token&&Date.now()>d.expirationTime)){if(!o)throw new Error("Missing required options.");let p={...Oe({...o,refreshToken:d.refreshToken})};l=p.url,c=p.body,h=p.basicAuth}let f;try{if(f=await Q({url:l,method:"POST",headers:{Authorization:`Basic ${h}`,"Content-Type":"application/x-www-form-urlencoded","Conent-Length":jt.Buffer.byteLength(c).toString()},httpClient:t,body:c}),f.statusCode>=200&&f.statusCode<300){let{access_token:w,expires_in:E,refresh_token:B}=f?.data,g=Be(E);i.set({token:w,expirationTime:g,refreshToken:B});let M=u.slice();if(u=[],M.length===1)return G(w,M.pop().request);for(let C=0;C<M.length;C++){let m=M[C],k=G(w,m.request);m.next(k)}return}let p=new Error(f.data.message?f.data.message:JSON.stringify(f.data));e.reject({...e,headers:{...e.headers},response:{statusCode:f.statusCode||f.data.statusCode,error:{error:p,body:f}}})}catch(p){return{...e,headers:{...e.headers},response:{body:null,statusCode:p.statusCode||0,error:{...f,error:p,body:f}}}}}function ee(r){let e=[],t=R(!1),i=r.tokenCache||R({token:"",expirationTime:-1}),n=O(r);return o=>async s=>{if(s.headers&&(s.headers.Authorization||s.headers.authorization))return o(s);let l={request:s,requestState:t,tokenCache:i,pendingTasks:e,tokenCacheKey:n,httpClient:r.httpClient||Dt.default,...Nt(r),userOption:r,next:o},c=await N(l);if(c)return o(c)}}var _n=new Error("timeout while waiting for mutex to become available"),qn=new Error("mutex already locked"),oi=new Error("request for lock canceled"),si=function(r,e,t,i){function n(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function l(u){try{h(i.next(u))}catch(d){s(d)}}function c(u){try{h(i.throw(u))}catch(d){s(d)}}function h(u){u.done?o(u.value):n(u.value).then(l,c)}h((i=i.apply(r,e||[])).next())})},ut=class{constructor(e,t=oi){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((i,n)=>{let o={resolve:i,reject:n,weight:e,priority:t},s=Ht(this._queue,l=>t<=l.priority);s===-1&&e<=this._value?this._dispatchItem(o):this._queue.splice(s+1,0,o)})}runExclusive(e){return si(this,arguments,void 0,function*(t,i=1,n=0){let[o,s]=yield this.acquire(i,n);try{return yield t(o)}finally{s()}})}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(i=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),ai(this._weightedWaiters[e-1],{resolve:i,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){let t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let t=this._weightedWaiters[e-1];t&&(t.forEach(i=>i.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let t=this._value;t>0;t--){let i=this._weightedWaiters[t-1];if(!i)continue;let n=i.findIndex(o=>o.priority<=e);(n===-1?i:i.splice(0,n)).forEach(o=>o.resolve())}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}};function ai(r,e){let t=Ht(r,i=>e.priority<=i.priority);r.splice(t+1,0,e)}function Ht(r,e){for(let t=r.length-1;t>=0;t--)if(e(r[t]))return t;return-1}var ui=function(r,e,t,i){function n(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function l(u){try{h(i.next(u))}catch(d){s(d)}}function c(u){try{h(i.throw(u))}catch(d){s(d)}}function h(u){u.done?o(u.value):n(u.value).then(l,c)}h((i=i.apply(r,e||[])).next())})},Pe=class{constructor(e){this._semaphore=new ut(1,e)}acquire(){return ui(this,arguments,void 0,function*(e=0){let[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}};var $t=q(le());function te(r){let e=new Pe,t=[],i=r.tokenCache||R({token:"",expirationTime:-1}),n=O(r);return o=>async s=>{if(s.headers&&(s.headers.Authorization||s.headers.authorization))return o(s);let l={request:s,requestState:e,tokenCache:i,pendingTasks:t,tokenCacheKey:n,httpClient:r.httpClient||$t.default,...at(r),next:o},c;try{await e.acquire(),c=await N(l)}finally{e.release()}if(c)return o(c)}}function re(r,e){return t=>async i=>{if(typeof r!="string")throw new Error("authorization must be a string");let n=e?.force===void 0?!0:e.force;if(!r||i.headers&&(i.headers.Authorization||i.headers.authorization)&&n===!1)return t(i);let o={...i,headers:{...i.headers,Authorization:r}};return t(o)}}var vt=q(le());function ie(r){let e=r.tokenCache||R({token:"",expirationTime:-1}),t=[],i=R(!1),n=O(r);return o=>async s=>{if(s.headers&&(s.headers.Authorization||s.headers.authorization))return o(s);let l={request:s,requestState:i,tokenCache:e,pendingTasks:t,tokenCacheKey:n,httpClient:r.httpClient||vt.default,...Lt(r),userOption:r,next:o},c=await N(l);if(c)return o(c)}}function ne(r){let e=r.tokenCache||R({token:"",tokenCacheKey:null}),t=[],i=R(!1);return n=>async o=>{if(o.headers&&(o.headers.Authorization||o.headers.authorization))return n(o);let s={request:o,requestState:i,tokenCache:e,pendingTasks:t,httpClient:r.httpClient||fetch,...Oe(r),next:n},l=await N(s);if(l)return n(l)}}function he(r){return e=>async t=>{let i=await e(t);if(i.statusCode==409){let n=i.error.body?.errors?.[0]?.currentVersion;if(n)return r?t.body=await r(n,t,i):t.body=typeof t.body=="string"?{...JSON.parse(t.body),version:n}:{...t.body,version:n},e(t)}return i}}function fe(r){return e=>t=>{let i={...t,headers:{...t.headers,"X-Correlation-ID":r.generate&&typeof r.generate=="function"?r.generate():Te()}};return e(i)}}function lt(r){return e=>async t=>{let i=await e(t);if(i.error){let{error:n}=i;return{...i,statusCode:n.statusCode||0,headers:n.headers||b({}),error:{...n,body:n.data||n}}}return i}}var Vt=q(Wt()),zt=q(_e());async function ci({url:r,httpClient:e,clientOptions:t}){let i,{timeout:n,request:o,abortController:s,maskSensitiveHeaderData:l,includeRequestInErrorResponse:c,includeResponseHeaders:h}=t;try{n&&(i=setTimeout(()=>{s.abort()},n));let u=await Q({url:r,...t,httpClient:e,method:t.method,...t.body?{body:t.body}:{}});if(h||(u.headers=null),u.statusCode>=200&&u.statusCode<300)return t.method=="HEAD"?{body:null,statusCode:u.statusCode,retryCount:u.retryCount,headers:b(u.headers)}:{body:u.data,statusCode:u.statusCode,retryCount:u.retryCount,headers:b(u.headers)};let d=Me({message:u?.data?.message||u?.message,statusCode:u.statusCode||u?.data?.statusCode,headers:b(u.headers),method:t.method,body:u.data,retryCount:u.retryCount,...c?{originalRequest:l?H(o):o}:{uri:o.uri}});return{body:u.data,code:u.statusCode,statusCode:u.statusCode,headers:b(u.headers),error:d}}catch(u){let d=h?b(u.response?.headers):null,f=u.response?.status||u.response?.data0||0,p=u.response?.data?.message,w=Me({statusCode:f,code:f,status:f,message:p||u.message,headers:d,body:u.response?.data||u,error:u.response?.data,...c?{originalRequest:l?H(o):o}:{uri:o.uri}});return{body:w,error:w}}finally{clearTimeout(i)}}function pe(r){Ge(r);let{host:e,credentialsMode:t,httpClient:i,timeout:n,enableRetry:o,retryConfig:s,getAbortController:l,includeOriginalRequest:c,includeRequestInErrorResponse:h=!0,includeResponseHeaders:u=!0,maskSensitiveHeaderData:d,httpClientOptions:f}=r;return p=>async w=>{let E;(n||l)&&(E=(l?l():null)||new Vt.default);let B=e.replace(/\/$/,"")+w.uri,g={...w.headers};Object.prototype.hasOwnProperty.call(g,"Content-Type")||Object.prototype.hasOwnProperty.call(g,"content-type")||(g["Content-Type"]="application/json"),g["Content-Type"]===null&&delete g["Content-Type"];let M=I.HEADERS_CONTENT_TYPES.indexOf(g["Content-Type"])>-1&&typeof w.body=="string"||ce(w.body)?w.body:JSON.stringify(w.body||void 0);M&&(typeof M=="string"||ce(M))&&(g["Content-Length"]=zt.Buffer.byteLength(M).toString());let C={enableRetry:o,retryConfig:s,request:w,method:w.method,headers:g,includeRequestInErrorResponse:h,maskSensitiveHeaderData:d,includeResponseHeaders:u,...f};t&&(C.credentialsMode=t),E&&(C.signal=E.signal),n&&(C.timeout=n,C.abortController=E),M&&(C.body=M);let m=await ci({url:B,clientOptions:C,httpClient:i}),k={...w,includeOriginalRequest:c,maskSensitiveHeaderData:d,response:m};return p(k)}}function we(r){return e=>async t=>{let i=await e(t),n=Object.assign({},i),{loggerFn:o=console.log}=r||{};return o&&typeof o=="function"&&o(i),n}}function me({concurrency:r=20}){let e=0,t=[],i=o=>{if(e--,t.length&&e<=r){let s=t.shift();return e++,o(s.request)}},n=({request:o})=>t.push({request:o});return o=>s=>{let l={...s,resolve(c){s.resolve(c),i(o)},reject(c){s.reject(c),i(o)}};if(n({request:l}),e<r){e++;let c=t.shift();return o(c.request)}}}var Qt={name:"@commercetools/ts-client",version:"2.0.3",engines:{node:">=14"},description:"commercetools Composable Commerce TypeScript SDK client.",keywords:["commercetools","composable commerce","sdk","typescript","client","middleware","http","oauth","auth"],homepage:"https://github.com/commercetools/commercetools-sdk-typescript",license:"MIT",directories:{lib:"lib",test:"test"},publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/commercetools/commercetools-sdk-typescript.git"},bugs:{url:"https://github.com/commercetools/commercetools-sdk-typescript/issues"},dependencies:{"abort-controller":"3.0.0","async-mutex":"^0.5.0",buffer:"^6.0.3","node-fetch":"^2.6.1",uuid:"10.0.0"},files:["dist","CHANGELOG.md"],author:"Chukwuemeka Ajima <meeky.ae@gmail.com>",main:"dist/commercetools-ts-client.cjs.js",module:"dist/commercetools-ts-client.esm.js",browser:{"./dist/commercetools-ts-client.cjs.js":"./dist/commercetools-ts-client.browser.cjs.js","./dist/commercetools-ts-client.esm.js":"./dist/commercetools-ts-client.browser.esm.js"},devDependencies:{"common-tags":"1.8.2",dotenv:"16.4.5",jest:"29.7.0",nock:"12.0.3","organize-imports-cli":"0.10.0"},scripts:{organize_imports:"find src -type f -name '*.ts' | xargs organize-imports-cli",postbuild:"yarn organize_imports",post_process_generate:"yarn organize_imports",docs:"typedoc --out docs"}};function ye(r){return e=>async t=>{let i=be({...r,name:`${r.name?r.name+"/":""}commercetools-sdk-javascript-v3/${Qt.version}`}),n={...t,headers:{...t.headers,"User-Agent":i}};return e(n)}}function hi({middlewares:r}){return r.length===1?r[0]:r.slice().reduce((t,i)=>(...n)=>t(i.apply(null,n)))}var Gt;function Le(r,e,t){if(Fe("process",r,{allowedMethods:["GET"]}),typeof e!="function")throw new Error('The "process" function accepts a "Function" as a second argument that returns a Promise. See https://commercetools.github.io/nodejs/sdk/api/sdkClient.html#processrequest-processfn-options');let i={total:Number.POSITIVE_INFINITY,accumulate:!0,...t};return new Promise((n,o)=>{let s,l="";if(r&&r.uri){let[p,w]=r.uri.split("?");s=p,l=w}let h={limit:20,...{...Qe(l)}},u=i.total,d=!1,f=async(p,w=[])=>{let E=h.limit<u?h.limit:u,B=Ie({...h,limit:E}),g={sort:"id asc",withTotal:!1,...p?{where:`id > "${p}"`}:{}},M=Ie(g),C={...r,uri:`${s}?${M}&${B}`};try{let m=await K(Gt).execute(C),{results:k,count:L}=m?.body||{};if(!L&&d)return n(w||[]);let ge=await Promise.resolve(e(m)),V;if(d=!0,i.accumulate&&(V=w.concat(ge||[])),u-=L,L<h.limit||!u)return n(V||[]);let j=k[L-1],se=j&&j.id;f(se,V)}catch(m){o(m)}};f()})}function K(r){Gt=r,Ye(r);let e=!1,t={async resolve(n){let{response:o,includeOriginalRequest:s,maskSensitiveHeaderData:l,...c}=n,{retryCount:h,...u}=o;return e=l,{body:null,error:null,reject:n.reject,resolve:n.resolve,...u,...s?{originalRequest:c}:{},...o?.retryCount?{retryCount:o.retryCount}:{}}}},i=hi(r)(t.resolve);return{process:Le,execute(n){return Fe("exec",n),new Promise((o,s)=>{i({reject:s,resolve:o,...n}).then(l=>{if(l.error)return s(l.error);l.originalRequest&&e&&(l.originalRequest=H(l.originalRequest)),o(l)}).catch(s)})}}}var{createAuthMiddlewareForPasswordFlow:fi,createAuthMiddlewareForAnonymousSessionFlow:pi,createAuthMiddlewareForClientCredentialsFlow:wi,createAuthMiddlewareForRefreshTokenFlow:mi,createAuthMiddlewareForExistingTokenFlow:yi,createCorrelationIdMiddleware:gi,createHttpMiddleware:xi,createLoggerMiddleware:Mi,createQueueMiddleware:Ei,createUserAgentMiddleware:Yt,createConcurrentModificationMiddleware:Ci}=ct,oe=class{projectKey;authMiddleware;httpMiddleware;userAgentMiddleware;correlationIdMiddleware;loggerMiddleware;queueMiddleware;concurrentMiddleware;telemetryMiddleware;beforeMiddleware;afterMiddleware;middlewares=[];constructor(){this.userAgentMiddleware=Yt({})}withProjectKey(e){return this.projectKey=e,this}defaultClient(e,t,i,n,o,s){return this.withClientCredentialsFlow({host:i,projectKey:n||this.projectKey,credentials:t,scopes:o}).withHttpMiddleware({host:e,httpClient:s||W.default})}withAuthMiddleware(e){return this.authMiddleware=e,this}withMiddleware(e){return this.middlewares.push(e),this}withClientCredentialsFlow(e){return this.withAuthMiddleware(wi({host:e.host||I.CTP_AUTH_URL,projectKey:e.projectKey||this.projectKey,credentials:{clientId:e.credentials.clientId||null,clientSecret:e.credentials.clientSecret||null},oauthUri:e.oauthUri||null,scopes:e.scopes,httpClient:e.httpClient||W.default,...e}))}withPasswordFlow(e){return this.withAuthMiddleware(fi({host:e.host||I.CTP_AUTH_URL,projectKey:e.projectKey||this.projectKey,credentials:{clientId:e.credentials.clientId||null,clientSecret:e.credentials.clientSecret||null,user:{username:e.credentials.user.username||null,password:e.credentials.user.password||null}},httpClient:e.httpClient||W.default,...e}))}withAnonymousSessionFlow(e){return this.withAuthMiddleware(pi({host:e.host||I.CTP_AUTH_URL,projectKey:this.projectKey||e.projectKey,credentials:{clientId:e.credentials.clientId||null,clientSecret:e.credentials.clientSecret||null,anonymousId:e.credentials.anonymousId||null},httpClient:e.httpClient||W.default,...e}))}withRefreshTokenFlow(e){return this.withAuthMiddleware(mi({host:e.host||I.CTP_AUTH_URL,projectKey:this.projectKey||e.projectKey,credentials:{clientId:e.credentials.clientId||null,clientSecret:e.credentials.clientSecret||null},httpClient:e.httpClient||W.default,refreshToken:e.refreshToken||null,...e}))}withExistingTokenFlow(e,t){return this.withAuthMiddleware(yi(e,{force:t.force||!0,...t}))}withHttpMiddleware(e){return this.httpMiddleware=xi({host:e.host||I.CTP_API_URL,httpClient:e.httpClient||W.default,...e}),this}withUserAgentMiddleware(e){return this.userAgentMiddleware=Yt(e),this}withQueueMiddleware(e){return this.queueMiddleware=Ei({concurrency:e.concurrency||I.CONCURRENCT_REQUEST,...e}),this}withLoggerMiddleware(e){return this.loggerMiddleware=Mi(e),this}withCorrelationIdMiddleware(e){return this.correlationIdMiddleware=gi({generate:e?.generate,...e}),this}withConcurrentModificationMiddleware(e){return this.concurrentMiddleware=Ci(e?.concurrentModificationHandlerFn),this}withTelemetryMiddleware(e){let{createTelemetryMiddleware:t,...i}=e;return this.withUserAgentMiddleware({customAgent:i?.userAgent||"typescript-sdk-apm-middleware"}),this.telemetryMiddleware=t(i),this}withBeforeExecutionMiddleware(e){let{middleware:t,...i}=e||{};return this.beforeMiddleware=e.middleware(i),this}withAfterExecutionMiddleware(e){let{middleware:t,...i}=e||{};return this.afterMiddleware=e.middleware(i),this}build(){let e=this.middlewares.slice();return this.telemetryMiddleware&&e.push(this.telemetryMiddleware),this.correlationIdMiddleware&&e.push(this.correlationIdMiddleware),this.userAgentMiddleware&&e.push(this.userAgentMiddleware),this.authMiddleware&&e.push(this.authMiddleware),this.beforeMiddleware&&e.push(this.beforeMiddleware),this.queueMiddleware&&e.push(this.queueMiddleware),this.loggerMiddleware&&e.push(this.loggerMiddleware),this.concurrentMiddleware&&e.push(this.concurrentMiddleware),this.httpMiddleware&&e.push(this.httpMiddleware),this.afterMiddleware&&e.push(this.afterMiddleware),K({middlewares:e})}};return rr(Ai);})();
1
+ var window;(window||={})["@commercetools/ts-client"]=(()=>{var Jt=Object.create;var xe=Object.defineProperty;var Xt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var er=Object.getPrototypeOf,tr=Object.prototype.hasOwnProperty;var ue=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),De=(r,e)=>{for(var t in e)xe(r,t,{get:e[t],enumerable:!0})},dt=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Zt(e))!tr.call(r,n)&&n!==t&&xe(r,n,{get:()=>e[n],enumerable:!(i=Xt(e,n))||i.enumerable});return r};var q=(r,e,t)=>(t=r!=null?Jt(er(r)):{},dt(e||!r||!r.__esModule?xe(t,"default",{value:r,enumerable:!0}):t,r)),rr=r=>dt(xe({},"__esModule",{value:!0}),r);var le=ue((z,ht)=>{"use strict";var ir=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},D=ir();ht.exports=z=D.fetch;D.fetch&&(z.default=D.fetch.bind(D));z.Headers=D.Headers;z.Request=D.Request;z.Response=D.Response});var xt=ue(Ue=>{"use strict";Ue.byteLength=br;Ue.toByteArray=Ur;Ue.fromByteArray=_r;var F=[],T=[],Ir=typeof Uint8Array<"u"?Uint8Array:Array,Je="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($=0,yt=Je.length;$<yt;++$)F[$]=Je[$],T[Je.charCodeAt($)]=$;var $,yt;T[45]=62;T[95]=63;function gt(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function br(r){var e=gt(r),t=e[0],i=e[1];return(t+i)*3/4-i}function Fr(r,e,t){return(e+t)*3/4-t}function Ur(r){var e,t=gt(r),i=t[0],n=t[1],o=new Ir(Fr(r,i,n)),s=0,l=n>0?i-4:i,c;for(c=0;c<l;c+=4)e=T[r.charCodeAt(c)]<<18|T[r.charCodeAt(c+1)]<<12|T[r.charCodeAt(c+2)]<<6|T[r.charCodeAt(c+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return n===2&&(e=T[r.charCodeAt(c)]<<2|T[r.charCodeAt(c+1)]>>4,o[s++]=e&255),n===1&&(e=T[r.charCodeAt(c)]<<10|T[r.charCodeAt(c+1)]<<4|T[r.charCodeAt(c+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function kr(r){return F[r>>18&63]+F[r>>12&63]+F[r>>6&63]+F[r&63]}function Sr(r,e,t){for(var i,n=[],o=e;o<t;o+=3)i=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),n.push(kr(i));return n.join("")}function _r(r){for(var e,t=r.length,i=t%3,n=[],o=16383,s=0,l=t-i;s<l;s+=o)n.push(Sr(r,s,s+o>l?l:s+o));return i===1?(e=r[t-1],n.push(F[e>>2]+F[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(F[e>>10]+F[e>>4&63]+F[e<<2&63]+"=")),n.join("")}});var Mt=ue(Xe=>{Xe.read=function(r,e,t,i,n){var o,s,l=n*8-i-1,c=(1<<l)-1,h=c>>1,u=-7,d=t?n-1:0,f=t?-1:1,p=r[e+d];for(d+=f,o=p&(1<<-u)-1,p>>=-u,u+=l;u>0;o=o*256+r[e+d],d+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=i;u>0;s=s*256+r[e+d],d+=f,u-=8);if(o===0)o=1-h;else{if(o===c)return s?NaN:(p?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-h}return(p?-1:1)*s*Math.pow(2,o-i)};Xe.write=function(r,e,t,i,n,o){var s,l,c,h=o*8-n-1,u=(1<<h)-1,d=u>>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:o-1,w=i?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+d>=1?e+=f/c:e+=f*Math.pow(2,1-d),e*c>=2&&(s++,c/=2),s+d>=u?(l=0,s=u):s+d>=1?(l=(e*c-1)*Math.pow(2,n),s=s+d):(l=e*Math.pow(2,d-1)*Math.pow(2,n),s=0));n>=8;r[t+p]=l&255,p+=w,l/=256,n-=8);for(s=s<<n|l,h+=n;h>0;r[t+p]=s&255,p+=w,s/=256,h-=8);r[t+p-w]|=E*128}});var _e=ue(Z=>{"use strict";var Ze=xt(),J=Mt(),Et=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Z.Buffer=a;Z.SlowBuffer=jr;Z.INSPECT_MAX_BYTES=50;var ke=2147483647;Z.kMaxLength=ke;a.TYPED_ARRAY_SUPPORT=qr();!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function qr(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function _(r){if(r>ke)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,a.prototype),e}function a(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return it(r)}return Tt(r,e,t)}a.poolSize=8192;function Tt(r,e,t){if(typeof r=="string")return Pr(r,e);if(ArrayBuffer.isView(r))return Nr(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(U(r,ArrayBuffer)||r&&U(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(U(r,SharedArrayBuffer)||r&&U(r.buffer,SharedArrayBuffer)))return tt(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return a.from(i,e,t);let n=Lr(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return a.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}a.from=function(r,e,t){return Tt(r,e,t)};Object.setPrototypeOf(a.prototype,Uint8Array.prototype);Object.setPrototypeOf(a,Uint8Array);function Bt(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function Or(r,e,t){return Bt(r),r<=0?_(r):e!==void 0?typeof t=="string"?_(r).fill(e,t):_(r).fill(e):_(r)}a.alloc=function(r,e,t){return Or(r,e,t)};function it(r){return Bt(r),_(r<0?0:nt(r)|0)}a.allocUnsafe=function(r){return it(r)};a.allocUnsafeSlow=function(r){return it(r)};function Pr(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=It(r,e)|0,i=_(t),n=i.write(r,e);return n!==t&&(i=i.slice(0,n)),i}function et(r){let e=r.length<0?0:nt(r.length)|0,t=_(e);for(let i=0;i<e;i+=1)t[i]=r[i]&255;return t}function Nr(r){if(U(r,Uint8Array)){let e=new Uint8Array(r);return tt(e.buffer,e.byteOffset,e.byteLength)}return et(r)}function tt(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&t===void 0?i=new Uint8Array(r):t===void 0?i=new Uint8Array(r,e):i=new Uint8Array(r,e,t),Object.setPrototypeOf(i,a.prototype),i}function Lr(r){if(a.isBuffer(r)){let e=nt(r.length)|0,t=_(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||st(r.length)?_(0):et(r);if(r.type==="Buffer"&&Array.isArray(r.data))return et(r.data)}function nt(r){if(r>=ke)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ke.toString(16)+" bytes");return r|0}function jr(r){return+r!=r&&(r=0),a.alloc(+r)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype};a.compare=function(e,t){if(U(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),U(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let i=e.length,n=t.length;for(let o=0,s=Math.min(i,n);o<s;++o)if(e[o]!==t[o]){i=e[o],n=t[o];break}return i<n?-1:n<i?1:0};a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let i;if(t===void 0)for(t=0,i=0;i<e.length;++i)t+=e[i].length;let n=a.allocUnsafe(t),o=0;for(i=0;i<e.length;++i){let s=e[i];if(U(s,Uint8Array))o+s.length>n.length?(a.isBuffer(s)||(s=a.from(s)),s.copy(n,o)):Uint8Array.prototype.set.call(n,s,o);else if(a.isBuffer(s))s.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return n};function It(r,e){if(a.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||U(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&t===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return rt(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Pt(r).length;default:if(n)return i?-1:rt(r).length;e=(""+e).toLowerCase(),n=!0}}a.byteLength=It;function Dr(r,e,t){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Yr(this,e,t);case"utf8":case"utf-8":return Ft(this,e,t);case"ascii":return Qr(this,e,t);case"latin1":case"binary":return Gr(this,e,t);case"base64":return Vr(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jr(this,e,t);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}a.prototype._isBuffer=!0;function v(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)v(this,t,t+1);return this};a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this};a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this};a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ft(this,0,e):Dr.apply(this,arguments)};a.prototype.toLocaleString=a.prototype.toString;a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0};a.prototype.inspect=function(){let e="",t=Z.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Et&&(a.prototype[Et]=a.prototype.inspect);a.prototype.compare=function(e,t,i,n,o){if(U(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),t<0||i>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=i)return 0;if(n>=o)return-1;if(t>=i)return 1;if(t>>>=0,i>>>=0,n>>>=0,o>>>=0,this===e)return 0;let s=o-n,l=i-t,c=Math.min(s,l),h=this.slice(n,o),u=e.slice(t,i);for(let d=0;d<c;++d)if(h[d]!==u[d]){s=h[d],l=u[d];break}return s<l?-1:l<s?1:0};function bt(r,e,t,i,n){if(r.length===0)return-1;if(typeof t=="string"?(i=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,st(t)&&(t=n?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(n)return-1;t=r.length-1}else if(t<0)if(n)t=0;else return-1;if(typeof e=="string"&&(e=a.from(e,i)),a.isBuffer(e))return e.length===0?-1:Ct(r,e,t,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Ct(r,[e],t,i,n);throw new TypeError("val must be string, number or Buffer")}function Ct(r,e,t,i,n){let o=1,s=r.length,l=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||e.length<2)return-1;o=2,s/=2,l/=2,t/=2}function c(u,d){return o===1?u[d]:u.readUInt16BE(d*o)}let h;if(n){let u=-1;for(h=t;h<s;h++)if(c(r,h)===c(e,u===-1?0:h-u)){if(u===-1&&(u=h),h-u+1===l)return u*o}else u!==-1&&(h-=h-u),u=-1}else for(t+l>s&&(t=s-l),h=t;h>=0;h--){let u=!0;for(let d=0;d<l;d++)if(c(r,h+d)!==c(e,d)){u=!1;break}if(u)return h}return-1}a.prototype.includes=function(e,t,i){return this.indexOf(e,t,i)!==-1};a.prototype.indexOf=function(e,t,i){return bt(this,e,t,i,!0)};a.prototype.lastIndexOf=function(e,t,i){return bt(this,e,t,i,!1)};function Hr(r,e,t,i){t=Number(t)||0;let n=r.length-t;i?(i=Number(i),i>n&&(i=n)):i=n;let o=e.length;i>o/2&&(i=o/2);let s;for(s=0;s<i;++s){let l=parseInt(e.substr(s*2,2),16);if(st(l))return s;r[t+s]=l}return s}function $r(r,e,t,i){return Se(rt(e,r.length-t),r,t,i)}function vr(r,e,t,i){return Se(ti(e),r,t,i)}function Kr(r,e,t,i){return Se(Pt(e),r,t,i)}function Wr(r,e,t,i){return Se(ri(e,r.length-t),r,t,i)}a.prototype.write=function(e,t,i,n){if(t===void 0)n="utf8",i=this.length,t=0;else if(i===void 0&&typeof t=="string")n=t,i=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((i===void 0||i>o)&&(i=o),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return Hr(this,e,t,i);case"utf8":case"utf-8":return $r(this,e,t,i);case"ascii":case"latin1":case"binary":return vr(this,e,t,i);case"base64":return Kr(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wr(this,e,t,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Vr(r,e,t){return e===0&&t===r.length?Ze.fromByteArray(r):Ze.fromByteArray(r.slice(e,t))}function Ft(r,e,t){t=Math.min(r.length,t);let i=[],n=e;for(;n<t;){let o=r[n],s=null,l=o>239?4:o>223?3:o>191?2:1;if(n+l<=t){let c,h,u,d;switch(l){case 1:o<128&&(s=o);break;case 2:c=r[n+1],(c&192)===128&&(d=(o&31)<<6|c&63,d>127&&(s=d));break;case 3:c=r[n+1],h=r[n+2],(c&192)===128&&(h&192)===128&&(d=(o&15)<<12|(c&63)<<6|h&63,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:c=r[n+1],h=r[n+2],u=r[n+3],(c&192)===128&&(h&192)===128&&(u&192)===128&&(d=(o&15)<<18|(c&63)<<12|(h&63)<<6|u&63,d>65535&&d<1114112&&(s=d))}}s===null?(s=65533,l=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=l}return zr(i)}var At=4096;function zr(r){let e=r.length;if(e<=At)return String.fromCharCode.apply(String,r);let t="",i=0;for(;i<e;)t+=String.fromCharCode.apply(String,r.slice(i,i+=At));return t}function Qr(r,e,t){let i="";t=Math.min(r.length,t);for(let n=e;n<t;++n)i+=String.fromCharCode(r[n]&127);return i}function Gr(r,e,t){let i="";t=Math.min(r.length,t);for(let n=e;n<t;++n)i+=String.fromCharCode(r[n]);return i}function Yr(r,e,t){let i=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>i)&&(t=i);let n="";for(let o=e;o<t;++o)n+=ii[r[o]];return n}function Jr(r,e,t){let i=r.slice(e,t),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}a.prototype.slice=function(e,t){let i=this.length;e=~~e,t=t===void 0?i:~~t,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n};function y(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||y(e,t,this.length);let n=this[e],o=1,s=0;for(;++s<t&&(o*=256);)n+=this[e+s]*o;return n};a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||y(e,t,this.length);let n=this[e+--t],o=1;for(;t>0&&(o*=256);)n+=this[e+--t]*o;return n};a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||y(e,1,this.length),this[e]};a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||y(e,2,this.length),this[e]|this[e+1]<<8};a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||y(e,2,this.length),this[e]<<8|this[e+1]};a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||y(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};a.prototype.readBigUInt64LE=P(function(e){e=e>>>0,X(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&de(e,this.length-8);let n=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});a.prototype.readBigUInt64BE=P(function(e){e=e>>>0,X(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&de(e,this.length-8);let n=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});a.prototype.readIntLE=function(e,t,i){e=e>>>0,t=t>>>0,i||y(e,t,this.length);let n=this[e],o=1,s=0;for(;++s<t&&(o*=256);)n+=this[e+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n};a.prototype.readIntBE=function(e,t,i){e=e>>>0,t=t>>>0,i||y(e,t,this.length);let n=t,o=1,s=this[e+--n];for(;n>0&&(o*=256);)s+=this[e+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s};a.prototype.readInt8=function(e,t){return e=e>>>0,t||y(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};a.prototype.readInt16LE=function(e,t){e=e>>>0,t||y(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};a.prototype.readInt16BE=function(e,t){e=e>>>0,t||y(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};a.prototype.readBigInt64LE=P(function(e){e=e>>>0,X(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&de(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});a.prototype.readBigInt64BE=P(function(e){e=e>>>0,X(e,"offset");let t=this[e],i=this[e+7];(t===void 0||i===void 0)&&de(e,this.length-8);let n=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||y(e,4,this.length),J.read(this,e,!0,23,4)};a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||y(e,4,this.length),J.read(this,e,!1,23,4)};a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||y(e,8,this.length),J.read(this,e,!0,52,8)};a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||y(e,8,this.length),J.read(this,e,!1,52,8)};function A(r,e,t,i,n,o){if(!a.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<o)throw new RangeError('"value" argument is out of bounds');if(t+i>r.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;A(this,e,t,i,l,0)}let o=1,s=0;for(this[t]=e&255;++s<i&&(o*=256);)this[t+s]=e/o&255;return t+i};a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;A(this,e,t,i,l,0)}let o=i-1,s=1;for(this[t+o]=e&255;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+i};a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,1,255,0),this[t]=e&255,t+1};a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Ut(r,e,t,i,n){Ot(e,i,n,r,t,7);let o=Number(e&BigInt(4294967295));r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,t}function kt(r,e,t,i,n){Ot(e,i,n,r,t,7);let o=Number(e&BigInt(4294967295));r[t+7]=o,o=o>>8,r[t+6]=o,o=o>>8,r[t+5]=o,o=o>>8,r[t+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=s,s=s>>8,r[t+2]=s,s=s>>8,r[t+1]=s,s=s>>8,r[t]=s,t+8}a.prototype.writeBigUInt64LE=P(function(e,t=0){return Ut(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeBigUInt64BE=P(function(e,t=0){return kt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let c=Math.pow(2,8*i-1);A(this,e,t,i,c-1,-c)}let o=0,s=1,l=0;for(this[t]=e&255;++o<i&&(s*=256);)e<0&&l===0&&this[t+o-1]!==0&&(l=1),this[t+o]=(e/s>>0)-l&255;return t+i};a.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t=t>>>0,!n){let c=Math.pow(2,8*i-1);A(this,e,t,i,c-1,-c)}let o=i-1,s=1,l=0;for(this[t+o]=e&255;--o>=0&&(s*=256);)e<0&&l===0&&this[t+o+1]!==0&&(l=1),this[t+o]=(e/s>>0)-l&255;return t+i};a.prototype.writeInt8=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};a.prototype.writeInt16LE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};a.prototype.writeInt16BE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};a.prototype.writeInt32LE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};a.prototype.writeInt32BE=function(e,t,i){return e=+e,t=t>>>0,i||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};a.prototype.writeBigInt64LE=P(function(e,t=0){return Ut(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});a.prototype.writeBigInt64BE=P(function(e,t=0){return kt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function St(r,e,t,i,n,o){if(t+i>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function _t(r,e,t,i,n){return e=+e,t=t>>>0,n||St(r,e,t,4,34028234663852886e22,-34028234663852886e22),J.write(r,e,t,i,23,4),t+4}a.prototype.writeFloatLE=function(e,t,i){return _t(this,e,t,!0,i)};a.prototype.writeFloatBE=function(e,t,i){return _t(this,e,t,!1,i)};function qt(r,e,t,i,n){return e=+e,t=t>>>0,n||St(r,e,t,8,17976931348623157e292,-17976931348623157e292),J.write(r,e,t,i,52,8),t+8}a.prototype.writeDoubleLE=function(e,t,i){return qt(this,e,t,!0,i)};a.prototype.writeDoubleBE=function(e,t,i){return qt(this,e,t,!1,i)};a.prototype.copy=function(e,t,i,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-i&&(n=e.length-t+i);let o=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),t),o};a.prototype.fill=function(e,t,i,n){if(typeof e=="string"){if(typeof t=="string"?(n=t,t=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let s=e.charCodeAt(0);(n==="utf8"&&s<128||n==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<i)throw new RangeError("Out of range index");if(i<=t)return this;t=t>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<i;++o)this[o]=e;else{let s=a.isBuffer(e)?e:a.from(e,n),l=s.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<i-t;++o)this[o+t]=s[o%l]}return this};var Y={};function ot(r,e,t){Y[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}ot("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ot("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);ot("ERR_OUT_OF_RANGE",function(r,e,t){let i=`The value of "${r}" is out of range.`,n=t;return Number.isInteger(t)&&Math.abs(t)>2**32?n=Rt(String(t)):typeof t=="bigint"&&(n=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(n=Rt(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Rt(r){let e="",t=r.length,i=r[0]==="-"?1:0;for(;t>=i+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function Xr(r,e,t){X(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&de(e,r.length-(t+1))}function Ot(r,e,t,i,n,o){if(r>t||r<e){let s=typeof e=="bigint"?"n":"",l;throw o>3?e===0||e===BigInt(0)?l=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:l=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:l=`>= ${e}${s} and <= ${t}${s}`,new Y.ERR_OUT_OF_RANGE("value",l,r)}Xr(i,n,o)}function X(r,e){if(typeof r!="number")throw new Y.ERR_INVALID_ARG_TYPE(e,"number",r)}function de(r,e,t){throw Math.floor(r)!==r?(X(r,t),new Y.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Y.ERR_BUFFER_OUT_OF_BOUNDS:new Y.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var Zr=/[^+/0-9A-Za-z-_]/g;function ei(r){if(r=r.split("=")[0],r=r.trim().replace(Zr,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function rt(r,e){e=e||1/0;let t,i=r.length,n=null,o=[];for(let s=0;s<i;++s){if(t=r.charCodeAt(s),t>55295&&t<57344){if(!n){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}n=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),n=t;continue}t=(n-55296<<10|t-56320)+65536}else n&&(e-=3)>-1&&o.push(239,191,189);if(n=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function ti(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function ri(r,e){let t,i,n,o=[];for(let s=0;s<r.length&&!((e-=2)<0);++s)t=r.charCodeAt(s),i=t>>8,n=t%256,o.push(n),o.push(i);return o}function Pt(r){return Ze.toByteArray(ei(r))}function Se(r,e,t,i){let n;for(n=0;n<i&&!(n+t>=e.length||n>=r.length);++n)e[n+t]=r[n];return n}function U(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function st(r){return r!==r}var ii=function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let i=t*16;for(let n=0;n<16;++n)e[i+n]=r[t]+r[n]}return e}();function P(r){return typeof BigInt>"u"?ni:r}function ni(){throw new Error("BigInt not supported")}});var Wt=ue((ao,Ne)=>{"use strict";var{AbortController:Kt,AbortSignal:li}=typeof self<"u"?self:typeof window<"u"?window:void 0;Ne.exports=Kt;Ne.exports.AbortSignal=li;Ne.exports.default=Kt});var Ai={};De(Ai,{ClientBuilder:()=>oe,Process:()=>Le,createAuthMiddlewareForAnonymousSessionFlow:()=>ee,createAuthMiddlewareForClientCredentialsFlow:()=>te,createAuthMiddlewareForExistingTokenFlow:()=>re,createAuthMiddlewareForPasswordFlow:()=>ie,createAuthMiddlewareForRefreshTokenFlow:()=>ne,createClient:()=>K,createConcurrentModificationMiddleware:()=>he,createCorrelationIdMiddleware:()=>fe,createHttpMiddleware:()=>pe,createLoggerMiddleware:()=>we,createQueueMiddleware:()=>me,createUserAgentMiddleware:()=>ye});var W=q(le());var ct={};De(ct,{createAuthMiddlewareForAnonymousSessionFlow:()=>ee,createAuthMiddlewareForClientCredentialsFlow:()=>te,createAuthMiddlewareForExistingTokenFlow:()=>re,createAuthMiddlewareForPasswordFlow:()=>ie,createAuthMiddlewareForRefreshTokenFlow:()=>ne,createConcurrentModificationMiddleware:()=>he,createCorrelationIdMiddleware:()=>fe,createErrorMiddleware:()=>lt,createHttpMiddleware:()=>pe,createLoggerMiddleware:()=>we,createQueueMiddleware:()=>me,createUserAgentMiddleware:()=>ye});var Dt=q(le());var I={};De(I,{CONCURRENCT_REQUEST:()=>or,CTP_API_URL:()=>sr,CTP_AUTH_URL:()=>ar,DEFAULT_HEADERS:()=>He,HEADERS_CONTENT_TYPES:()=>nr});var nr=["application/json","application/graphql"],or=20,sr="https://api.europe-west1.gcp.commercetools.com",ar="https://auth.europe-west1.gcp.commercetools.com",He=["content-type","access-control-allow-origin","access-control-allow-headers","access-control-allow-methods","access-control-expose-headers","access-control-max-ag","x-correlation-id","server-timing","date","server","transfer-encoding","access-control-max-age","content-encoding","x-envoy-upstream-service-time","via","alt-svc","connection"];function S(r,e,t={}){this.status=this.statusCode=this.code=r,this.message=e,Object.assign(this,t),this.name=this.constructor.name,this.constructor.prototype.__proto__=Error.prototype,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}function ft(...r){S.call(this,0,...r)}function pt(...r){S.call(this,...r)}function ur(...r){S.call(this,400,...r)}function lr(...r){S.call(this,401,...r)}function cr(...r){S.call(this,403,...r)}function dr(...r){S.call(this,404,...r)}function hr(...r){S.call(this,409,...r)}function fr(...r){S.call(this,500,...r)}function pr(...r){S.call(this,503,...r)}function $e(r){switch(r){case 0:return ft;case 400:return ur;case 401:return lr;case 403:return cr;case 404:return dr;case 409:return hr;case 500:return fr;case 503:return pr;default:return}}function wr({statusCode:r,message:e,...t}){let i=e||"Unexpected non-JSON error response";r===404&&(i=`URI not found: ${t.originalRequest?.uri||t.uri}`);let n=$e(r);return n?new n(i,t):new pt(r,i,t)}var Me=wr;function mr(r,e){return[503,...r].includes(e?.status||e?.statusCode)}async function yr(r,e){async function t(){return await r({...e,headers:{...e.headers}})}return t().catch(i=>Promise.reject(i))}async function Q(r){let{url:e,httpClient:t,...i}=r;return await yr(async o=>{let{enableRetry:s,retryConfig:l,abortController:c}=i,{retryCodes:h=[],maxDelay:u=1/0,maxRetries:d=3,backoff:f=!0,retryDelay:p=200,retryOnAbort:w=!0}=l||{},E,B,g=0;ve(h);async function M(){return t(e,{...i,...o,headers:{...i.headers,...o.headers,"Accept-Encoding":"application/json"},...i.body?{data:i.body}:{},withCredentials:o.credentialsMode==="include"})}async function C(){let k=async(j,se)=>{let ae={};try{if(ae=await M(),ae.status>299&&mr(j,ae))return{_response:ae,shouldRetry:!0}}catch(je){if(je.name.includes("AbortError")&&se)return{_response:je,shouldRetry:!0};throw je}return{_response:ae,shouldRetry:!1}},L=w||!c||!c.signal,{_response:ge,shouldRetry:V}=await k(h,L);for(;s&&V&&g<d;){g++;let j=await k(h,L);ge=j._response,V=j.shouldRetry;let se=Ee({retryCount:g,retryDelay:p,maxRetries:d,backoff:f,maxDelay:u});await Ce(se)}return ge}let m=await C();try{m.text&&typeof m.text=="function"?(E=await m.text(),B=JSON.parse(E)):B=m.data||m}catch{B=E}return{data:B,retryCount:g,statusCode:m.status||m.statusCode||B.statusCode,headers:m.headers}},{})}var x=[];for(Ae=0;Ae<256;++Ae)x.push((Ae+256).toString(16).slice(1));var Ae;function wt(r,e=0){return(x[r[e+0]]+x[r[e+1]]+x[r[e+2]]+x[r[e+3]]+"-"+x[r[e+4]]+x[r[e+5]]+"-"+x[r[e+6]]+x[r[e+7]]+"-"+x[r[e+8]]+x[r[e+9]]+"-"+x[r[e+10]]+x[r[e+11]]+x[r[e+12]]+x[r[e+13]]+x[r[e+14]]+x[r[e+15]]).toLowerCase()}var Re,gr=new Uint8Array(16);function Ke(){if(!Re&&(Re=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Re))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Re(gr)}var xr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),We={randomUUID:xr};function Mr(r,e,t){if(We.randomUUID&&!e&&!r)return We.randomUUID();r=r||{};var i=r.random||(r.rng||Ke)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(var n=0;n<16;++n)e[t+n]=i[n];return e}return wt(i)}var Ve=Mr;function Te(){return Ve()}function Er(r){return He.reduce((e,t)=>{let i=r[t]?r[t]:typeof r.get=="function"?r.get(t):null;return i&&(e[t]=i),e},{})}function b(r){if(!r)return null;if(r.raw&&typeof r.raw=="function")return r.raw();if(!r.forEach)return Er(r);let e={};return r.forEach((t,i)=>e[i]=t)}function ce(r){return r!=null&&r.constructor!=null&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function H(r){let e=Object.assign({},r);return e?.headers&&(e.headers.Authorization&&(e.headers.Authorization="Bearer ********"),e.headers.authorization&&(e.headers.authorization="Bearer ********")),e}function G(r,e){return{...e,headers:{...e.headers,Authorization:`Bearer ${r}`}}}var ze=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];function Ee({retryCount:r,retryDelay:e,backoff:t,maxDelay:i}){return t&&r!==0?Math.min(Math.round((Math.random()+1)*e*2**r),i):e}Math.min(Math.round((Math.random()+1)*200*2**10),1/0);function Ce(r){return new Promise(e=>{setTimeout(e,r)})}function O(r){if(!r?.credentials?.clientId||!r.projectKey||!r.host)throw new Error("Missing required options.");return{clientId:r.credentials.clientId,host:r.host,projectKey:r.projectKey}}function Be(r){return Date.now()+r*1e3-5*60*1e3}function R(r){let e=r;return{get:t=>e,set:(t,i)=>{e=t}}}function mt(r){return typeof r<"u"&&r!==null}function Cr(r){return mt(r)?typeof r=="string"?r:Object.fromEntries(Object.entries(r).filter(([e,t])=>![null,void 0,""].includes(t))):""}function Ar(r){let e={},t=new URLSearchParams(r);for(let i of t.keys())t.getAll(i).length>1?e[i]=t.getAll(i):e[i]=t.get(i);return e}function Rr(r){if(r=Cr(r),!r)return"";let e=new URLSearchParams(r);for(let[t,i]of Object.entries(r))Array.isArray(i)&&(e.delete(t),i.filter(mt).forEach(n=>e.append(t,n)));return e.toString()}function Qe(r,e=Ar){return e(r)}function Ie(r,e=Rr){return e(r)}var Tr=()=>typeof window<"u"&&window.document&&window.document.nodeType===9;function Br(){if(Tr())return window.navigator.userAgent;let r=process?.version.slice(1)||"unknow",e=`(${process.platform}; ${process.arch})`;return`node.js/${r} ${e}`}function be(r){let e=null,t=null;if(!r)throw new Error("Missing required option `name`");let i=r.version?`${r.name}/${r.version}`:r.name;r.libraryName&&!r.libraryVersion?e=r.libraryName:r.libraryName&&r.libraryVersion&&(e=`${r.libraryName}/${r.libraryVersion}`),r.contactUrl&&!r.contactEmail?t=`(+${r.contactUrl})`:!r.contactUrl&&r.contactEmail?t=`(+${r.contactEmail})`:r.contactUrl&&r.contactEmail&&(t=`(+${r.contactUrl}; +${r.contactEmail})`);let n=Br(),o=r.customAgent||"";return[i,n,e,t,o].filter(Boolean).join(" ")}function Ge(r){if(!r.host)throw new Error("Request `host` or `url` is missing or invalid, please pass in a valid host e.g `host: http://a-valid-host-url`");if(!r.httpClient&&typeof r.httpClient!="function")throw new Error("An `httpClient` is not available, please pass in a `fetch` or `axios` instance as an option or have them globally available.")}function ve(r){if(!Array.isArray(r))throw new Error("`retryCodes` option must be an array of retry status (error) codes and/or messages.")}function Ye(r){if(!r)throw new Error("Missing required options");if(r.middlewares&&!Array.isArray(r.middlewares))throw new Error("Middlewares should be an array");if(!r.middlewares||!Array.isArray(r.middlewares)||!r.middlewares.length)throw new Error("You need to provide at least one middleware")}function Fe(r,e,t={allowedMethods:ze}){if(!e)throw new Error(`The "${r}" function requires a "Request" object as an argument. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`);if(typeof e.uri!="string")throw new Error(`The "${r}" Request object requires a valid uri. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`);if(!t.allowedMethods.includes(e.method))throw new Error(`The "${r}" Request object requires a valid method. See https://commercetools.github.io/nodejs/sdk/Glossary.html#clientrequest`)}var qe=q(_e());function at(r){if(!r)throw new Error("Missing required options");if(!r.host)throw new Error("Missing required option (host)");if(!r.projectKey)throw new Error("Missing required option (projectKey)");if(!r.credentials)throw new Error("Missing required option (credentials)");let{clientId:e,clientSecret:t}=r.credentials||{};if(!(e&&t))throw new Error("Missing required credentials (clientId, clientSecret)");let i=r.scopes?r.scopes.join(" "):void 0,n=qe.Buffer.from(`${e}:${t}`).toString("base64"),o=r.oauthUri||"/oauth/token",s=r.host.replace(/\/$/,"")+o,l=`grant_type=client_credentials${i?`&scope=${i}`:""}`;return{url:s,body:l,basicAuth:n}}function Nt(r){if(!r)throw new Error("Missing required options");if(!r.projectKey)throw new Error("Missing required option (projectKey)");let e=r.projectKey;r.oauthUri=r.oauthUri||`/oauth/${e}/anonymous/token`;let t=at(r);return r.credentials.anonymousId&&(t.body+=`&anonymous_id=${r.credentials.anonymousId}`),{...t}}function Oe(r){if(!r)throw new Error("Missing required options");if(!r.host)throw new Error("Missing required option (host)");if(!r.projectKey)throw new Error("Missing required option (projectKey)");if(!r.credentials)throw new Error("Missing required option (credentials)");if(!r.refreshToken)throw new Error("Missing required option (refreshToken)");let{clientId:e,clientSecret:t}=r.credentials;if(!(e&&t))throw new Error("Missing required credentials (clientId, clientSecret)");let i=qe.Buffer.from(`${e}:${t}`).toString("base64"),n=r.oauthUri||"/oauth/token",o=r.host.replace(/\/$/,"")+n,s=`grant_type=refresh_token&refresh_token=${encodeURIComponent(r.refreshToken)}`;return{basicAuth:i,url:o,body:s}}function Lt(r){if(!r)throw new Error("Missing required options");if(!r.host)throw new Error("Missing required option (host)");if(!r.projectKey)throw new Error("Missing required option (projectKey)");if(!r.credentials)throw new Error("Missing required option (credentials)");let{clientId:e,clientSecret:t,user:i}=r.credentials,n=r.projectKey;if(!(e&&t&&i))throw new Error("Missing required credentials (clientId, clientSecret, user)");let{username:o,password:s}=i;if(!(o&&s))throw new Error("Missing required user credentials (username, password)");let l=(r.scopes||[]).join(" "),c=l?`&scope=${l}`:"",h=qe.Buffer.from(`${e}:${t}`).toString("base64"),u=r.oauthUri||`/oauth/${n}/customers/token`,d=r.host.replace(/\/$/,"")+u,f=`grant_type=password&username=${encodeURIComponent(o)}&password=${encodeURIComponent(s)}${c}`;return{basicAuth:h,url:d,body:f}}var jt=q(_e());async function N(r){let{request:e,httpClient:t,tokenCache:i,tokenCacheKey:n,userOption:o,next:s}=r,l=r.url,c=r.body,h=r.basicAuth,u=r.pendingTasks;if(!t||typeof t!="function")throw new Error("an `httpClient` is not available, please pass in a `fetch` or `axios` instance as an option or have them globally available.");let d=i.get(n);if(d&&d.token&&Date.now()<d.expirationTime)return{...G(d.token,e)};if(u.push({request:e,next:s}),d&&d.refreshToken&&(!d.token||d.token&&Date.now()>d.expirationTime)){if(!o)throw new Error("Missing required options.");let p={...Oe({...o,refreshToken:d.refreshToken})};l=p.url,c=p.body,h=p.basicAuth}let f;try{if(f=await Q({url:l,method:"POST",headers:{Authorization:`Basic ${h}`,"Content-Type":"application/x-www-form-urlencoded","Content-Length":jt.Buffer.byteLength(c).toString()},httpClient:t,body:c}),f.statusCode>=200&&f.statusCode<300){let{access_token:w,expires_in:E,refresh_token:B}=f?.data,g=Be(E);i.set({token:w,expirationTime:g,refreshToken:B});let M=u.slice();if(u=[],M.length===1)return G(w,M.pop().request);for(let C=0;C<M.length;C++){let m=M[C],k=G(w,m.request);m.next(k)}return}let p=new Error(f.data.message?f.data.message:JSON.stringify(f.data));e.reject({...e,headers:{...e.headers},response:{statusCode:f.statusCode||f.data.statusCode,error:{error:p,body:f}}})}catch(p){return{...e,headers:{...e.headers},response:{body:null,statusCode:p.statusCode||0,error:{...f,error:p,body:f}}}}}function ee(r){let e=[],t=R(!1),i=r.tokenCache||R({token:"",expirationTime:-1}),n=O(r);return o=>async s=>{if(s.headers&&(s.headers.Authorization||s.headers.authorization))return o(s);let l={request:s,requestState:t,tokenCache:i,pendingTasks:e,tokenCacheKey:n,httpClient:r.httpClient||Dt.default,...Nt(r),userOption:r,next:o},c=await N(l);if(c)return o(c)}}var _n=new Error("timeout while waiting for mutex to become available"),qn=new Error("mutex already locked"),oi=new Error("request for lock canceled"),si=function(r,e,t,i){function n(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function l(u){try{h(i.next(u))}catch(d){s(d)}}function c(u){try{h(i.throw(u))}catch(d){s(d)}}function h(u){u.done?o(u.value):n(u.value).then(l,c)}h((i=i.apply(r,e||[])).next())})},ut=class{constructor(e,t=oi){this._value=e,this._cancelError=t,this._queue=[],this._weightedWaiters=[]}acquire(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((i,n)=>{let o={resolve:i,reject:n,weight:e,priority:t},s=Ht(this._queue,l=>t<=l.priority);s===-1&&e<=this._value?this._dispatchItem(o):this._queue.splice(s+1,0,o)})}runExclusive(e){return si(this,arguments,void 0,function*(t,i=1,n=0){let[o,s]=yield this.acquire(i,n);try{return yield t(o)}finally{s()}})}waitForUnlock(e=1,t=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,t)?Promise.resolve():new Promise(i=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),ai(this._weightedWaiters[e-1],{resolve:i,priority:t})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){let t=this._value;this._value-=e.weight,e.resolve([t,this._newReleaser(e.weight)])}_newReleaser(e){let t=!1;return()=>{t||(t=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){let t=this._weightedWaiters[e-1];t&&(t.forEach(i=>i.resolve()),this._weightedWaiters[e-1]=[])}else{let e=this._queue[0].priority;for(let t=this._value;t>0;t--){let i=this._weightedWaiters[t-1];if(!i)continue;let n=i.findIndex(o=>o.priority<=e);(n===-1?i:i.splice(0,n)).forEach(o=>o.resolve())}}}_couldLockImmediately(e,t){return(this._queue.length===0||this._queue[0].priority<t)&&e<=this._value}};function ai(r,e){let t=Ht(r,i=>e.priority<=i.priority);r.splice(t+1,0,e)}function Ht(r,e){for(let t=r.length-1;t>=0;t--)if(e(r[t]))return t;return-1}var ui=function(r,e,t,i){function n(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function l(u){try{h(i.next(u))}catch(d){s(d)}}function c(u){try{h(i.throw(u))}catch(d){s(d)}}function h(u){u.done?o(u.value):n(u.value).then(l,c)}h((i=i.apply(r,e||[])).next())})},Pe=class{constructor(e){this._semaphore=new ut(1,e)}acquire(){return ui(this,arguments,void 0,function*(e=0){let[,t]=yield this._semaphore.acquire(1,e);return t})}runExclusive(e,t=0){return this._semaphore.runExclusive(()=>e(),1,t)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}};var $t=q(le());function te(r){let e=new Pe,t=[],i=r.tokenCache||R({token:"",expirationTime:-1}),n=O(r);return o=>async s=>{if(s.headers&&(s.headers.Authorization||s.headers.authorization))return o(s);let l={request:s,requestState:e,tokenCache:i,pendingTasks:t,tokenCacheKey:n,httpClient:r.httpClient||$t.default,...at(r),next:o},c;try{await e.acquire(),c=await N(l)}finally{e.release()}if(c)return o(c)}}function re(r,e){return t=>async i=>{if(typeof r!="string")throw new Error("authorization must be a string");let n=e?.force===void 0?!0:e.force;if(!r||i.headers&&(i.headers.Authorization||i.headers.authorization)&&n===!1)return t(i);let o={...i,headers:{...i.headers,Authorization:r}};return t(o)}}var vt=q(le());function ie(r){let e=r.tokenCache||R({token:"",expirationTime:-1}),t=[],i=R(!1),n=O(r);return o=>async s=>{if(s.headers&&(s.headers.Authorization||s.headers.authorization))return o(s);let l={request:s,requestState:i,tokenCache:e,pendingTasks:t,tokenCacheKey:n,httpClient:r.httpClient||vt.default,...Lt(r),userOption:r,next:o},c=await N(l);if(c)return o(c)}}function ne(r){let e=r.tokenCache||R({token:"",tokenCacheKey:null}),t=[],i=R(!1);return n=>async o=>{if(o.headers&&(o.headers.Authorization||o.headers.authorization))return n(o);let s={request:o,requestState:i,tokenCache:e,pendingTasks:t,httpClient:r.httpClient||fetch,...Oe(r),next:n},l=await N(s);if(l)return n(l)}}function he(r){return e=>async t=>{let i=await e(t);if(i.statusCode==409){let n=i.error.body?.errors?.[0]?.currentVersion;if(n)return r?t.body=await r(n,t,i):t.body=typeof t.body=="string"?{...JSON.parse(t.body),version:n}:{...t.body,version:n},e(t)}return i}}function fe(r){return e=>t=>{let i={...t,headers:{...t.headers,"X-Correlation-ID":r.generate&&typeof r.generate=="function"?r.generate():Te()}};return e(i)}}function lt(r){return e=>async t=>{let i=await e(t);if(i.error){let{error:n}=i;return{...i,statusCode:n.statusCode||0,headers:n.headers||b({}),error:{...n,body:n.data||n}}}return i}}var Vt=q(Wt()),zt=q(_e());async function ci({url:r,httpClient:e,clientOptions:t}){let i,{timeout:n,request:o,abortController:s,maskSensitiveHeaderData:l,includeRequestInErrorResponse:c,includeResponseHeaders:h}=t;try{n&&(i=setTimeout(()=>{s.abort()},n));let u=await Q({url:r,...t,httpClient:e,method:t.method,...t.body?{body:t.body}:{}});if(h||(u.headers=null),u.statusCode>=200&&u.statusCode<300)return t.method=="HEAD"?{body:null,statusCode:u.statusCode,retryCount:u.retryCount,headers:b(u.headers)}:{body:u.data,statusCode:u.statusCode,retryCount:u.retryCount,headers:b(u.headers)};let d=Me({message:u?.data?.message||u?.message,statusCode:u.statusCode||u?.data?.statusCode,headers:b(u.headers),method:t.method,body:u.data,retryCount:u.retryCount,...c?{originalRequest:l?H(o):o}:{uri:o.uri}});return{body:u.data,code:u.statusCode,statusCode:u.statusCode,headers:b(u.headers),error:d}}catch(u){let d=h?b(u.response?.headers):null,f=u.response?.status||u.response?.data0||0,p=u.response?.data?.message,w=Me({statusCode:f,code:f,status:f,message:p||u.message,headers:d,body:u.response?.data||u,error:u.response?.data,...c?{originalRequest:l?H(o):o}:{uri:o.uri}});return{body:w,error:w}}finally{clearTimeout(i)}}function pe(r){Ge(r);let{host:e,credentialsMode:t,httpClient:i,timeout:n,enableRetry:o,retryConfig:s,getAbortController:l,includeOriginalRequest:c,includeRequestInErrorResponse:h=!0,includeResponseHeaders:u=!0,maskSensitiveHeaderData:d,httpClientOptions:f}=r;return p=>async w=>{let E;(n||l)&&(E=(l?l():null)||new Vt.default);let B=e.replace(/\/$/,"")+w.uri,g={...w.headers};Object.prototype.hasOwnProperty.call(g,"Content-Type")||Object.prototype.hasOwnProperty.call(g,"content-type")||(g["Content-Type"]="application/json"),g["Content-Type"]===null&&delete g["Content-Type"];let M=I.HEADERS_CONTENT_TYPES.indexOf(g["Content-Type"])>-1&&typeof w.body=="string"||ce(w.body)?w.body:JSON.stringify(w.body||void 0);M&&(typeof M=="string"||ce(M))&&(g["Content-Length"]=zt.Buffer.byteLength(M).toString());let C={enableRetry:o,retryConfig:s,request:w,method:w.method,headers:g,includeRequestInErrorResponse:h,maskSensitiveHeaderData:d,includeResponseHeaders:u,...f};t&&(C.credentialsMode=t),E&&(C.signal=E.signal),n&&(C.timeout=n,C.abortController=E),M&&(C.body=M);let m=await ci({url:B,clientOptions:C,httpClient:i}),k={...w,includeOriginalRequest:c,maskSensitiveHeaderData:d,response:m};return p(k)}}function we(r){return e=>async t=>{let i=await e(t),n=Object.assign({},i),{loggerFn:o=console.log}=r||{};return o&&typeof o=="function"&&o(i),n}}function me({concurrency:r=20}){let e=0,t=[],i=o=>{if(e--,t.length&&e<=r){let s=t.shift();return e++,o(s.request)}},n=({request:o})=>t.push({request:o});return o=>s=>{let l={...s,resolve(c){s.resolve(c),i(o)},reject(c){s.reject(c),i(o)}};if(n({request:l}),e<r){e++;let c=t.shift();return o(c.request)}}}var Qt={name:"@commercetools/ts-client",version:"2.0.4",engines:{node:">=14"},description:"commercetools Composable Commerce TypeScript SDK client.",keywords:["commercetools","composable commerce","sdk","typescript","client","middleware","http","oauth","auth"],homepage:"https://github.com/commercetools/commercetools-sdk-typescript",license:"MIT",directories:{lib:"lib",test:"test"},publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/commercetools/commercetools-sdk-typescript.git"},bugs:{url:"https://github.com/commercetools/commercetools-sdk-typescript/issues"},dependencies:{"abort-controller":"3.0.0","async-mutex":"^0.5.0",buffer:"^6.0.3","node-fetch":"^2.6.1",uuid:"10.0.0"},files:["dist","CHANGELOG.md"],author:"Chukwuemeka Ajima <meeky.ae@gmail.com>",main:"dist/commercetools-ts-client.cjs.js",module:"dist/commercetools-ts-client.esm.js",browser:{"./dist/commercetools-ts-client.cjs.js":"./dist/commercetools-ts-client.browser.cjs.js","./dist/commercetools-ts-client.esm.js":"./dist/commercetools-ts-client.browser.esm.js"},devDependencies:{"common-tags":"1.8.2",dotenv:"16.4.5",jest:"29.7.0",nock:"12.0.3","organize-imports-cli":"0.10.0"},scripts:{organize_imports:"find src -type f -name '*.ts' | xargs organize-imports-cli",postbuild:"yarn organize_imports",post_process_generate:"yarn organize_imports",docs:"typedoc --out docs"}};function ye(r){return e=>async t=>{let i=be({...r,name:`${r.name?r.name+"/":""}commercetools-sdk-javascript-v3/${Qt.version}`}),n={...t,headers:{...t.headers,"User-Agent":i}};return e(n)}}function hi({middlewares:r}){return r.length===1?r[0]:r.slice().reduce((t,i)=>(...n)=>t(i.apply(null,n)))}var Gt;function Le(r,e,t){if(Fe("process",r,{allowedMethods:["GET"]}),typeof e!="function")throw new Error('The "process" function accepts a "Function" as a second argument that returns a Promise. See https://commercetools.github.io/nodejs/sdk/api/sdkClient.html#processrequest-processfn-options');let i={total:Number.POSITIVE_INFINITY,accumulate:!0,...t};return new Promise((n,o)=>{let s,l="";if(r&&r.uri){let[p,w]=r.uri.split("?");s=p,l=w}let h={limit:20,...{...Qe(l)}},u=i.total,d=!1,f=async(p,w=[])=>{let E=h.limit<u?h.limit:u,B=Ie({...h,limit:E}),g={sort:"id asc",withTotal:!1,...p?{where:`id > "${p}"`}:{}},M=Ie(g),C={...r,uri:`${s}?${M}&${B}`};try{let m=await K(Gt).execute(C),{results:k,count:L}=m?.body||{};if(!L&&d)return n(w||[]);let ge=await Promise.resolve(e(m)),V;if(d=!0,i.accumulate&&(V=w.concat(ge||[])),u-=L,L<h.limit||!u)return n(V||[]);let j=k[L-1],se=j&&j.id;f(se,V)}catch(m){o(m)}};f()})}function K(r){Gt=r,Ye(r);let e=!1,t={async resolve(n){let{response:o,includeOriginalRequest:s,maskSensitiveHeaderData:l,...c}=n,{retryCount:h,...u}=o;return e=l,{body:null,error:null,reject:n.reject,resolve:n.resolve,...u,...s?{originalRequest:c}:{},...o?.retryCount?{retryCount:o.retryCount}:{}}}},i=hi(r)(t.resolve);return{process:Le,execute(n){return Fe("exec",n),new Promise((o,s)=>{i({reject:s,resolve:o,...n}).then(l=>{if(l.error)return s(l.error);l.originalRequest&&e&&(l.originalRequest=H(l.originalRequest)),o(l)}).catch(s)})}}}var{createAuthMiddlewareForPasswordFlow:fi,createAuthMiddlewareForAnonymousSessionFlow:pi,createAuthMiddlewareForClientCredentialsFlow:wi,createAuthMiddlewareForRefreshTokenFlow:mi,createAuthMiddlewareForExistingTokenFlow:yi,createCorrelationIdMiddleware:gi,createHttpMiddleware:xi,createLoggerMiddleware:Mi,createQueueMiddleware:Ei,createUserAgentMiddleware:Yt,createConcurrentModificationMiddleware:Ci}=ct,oe=class{projectKey;authMiddleware;httpMiddleware;userAgentMiddleware;correlationIdMiddleware;loggerMiddleware;queueMiddleware;concurrentMiddleware;telemetryMiddleware;beforeMiddleware;afterMiddleware;middlewares=[];constructor(){this.userAgentMiddleware=Yt({})}withProjectKey(e){return this.projectKey=e,this}defaultClient(e,t,i,n,o,s){return this.withClientCredentialsFlow({host:i,projectKey:n||this.projectKey,credentials:t,scopes:o}).withHttpMiddleware({host:e,httpClient:s||W.default})}withAuthMiddleware(e){return this.authMiddleware=e,this}withMiddleware(e){return this.middlewares.push(e),this}withClientCredentialsFlow(e){return this.withAuthMiddleware(wi({host:e.host||I.CTP_AUTH_URL,projectKey:e.projectKey||this.projectKey,credentials:{clientId:e.credentials.clientId||null,clientSecret:e.credentials.clientSecret||null},oauthUri:e.oauthUri||null,scopes:e.scopes,httpClient:e.httpClient||W.default,...e}))}withPasswordFlow(e){return this.withAuthMiddleware(fi({host:e.host||I.CTP_AUTH_URL,projectKey:e.projectKey||this.projectKey,credentials:{clientId:e.credentials.clientId||null,clientSecret:e.credentials.clientSecret||null,user:{username:e.credentials.user.username||null,password:e.credentials.user.password||null}},httpClient:e.httpClient||W.default,...e}))}withAnonymousSessionFlow(e){return this.withAuthMiddleware(pi({host:e.host||I.CTP_AUTH_URL,projectKey:this.projectKey||e.projectKey,credentials:{clientId:e.credentials.clientId||null,clientSecret:e.credentials.clientSecret||null,anonymousId:e.credentials.anonymousId||null},httpClient:e.httpClient||W.default,...e}))}withRefreshTokenFlow(e){return this.withAuthMiddleware(mi({host:e.host||I.CTP_AUTH_URL,projectKey:this.projectKey||e.projectKey,credentials:{clientId:e.credentials.clientId||null,clientSecret:e.credentials.clientSecret||null},httpClient:e.httpClient||W.default,refreshToken:e.refreshToken||null,...e}))}withExistingTokenFlow(e,t){return this.withAuthMiddleware(yi(e,{force:t.force||!0,...t}))}withHttpMiddleware(e){return this.httpMiddleware=xi({host:e.host||I.CTP_API_URL,httpClient:e.httpClient||W.default,...e}),this}withUserAgentMiddleware(e){return this.userAgentMiddleware=Yt(e),this}withQueueMiddleware(e){return this.queueMiddleware=Ei({concurrency:e.concurrency||I.CONCURRENCT_REQUEST,...e}),this}withLoggerMiddleware(e){return this.loggerMiddleware=Mi(e),this}withCorrelationIdMiddleware(e){return this.correlationIdMiddleware=gi({generate:e?.generate,...e}),this}withConcurrentModificationMiddleware(e){return this.concurrentMiddleware=Ci(e?.concurrentModificationHandlerFn),this}withTelemetryMiddleware(e){let{createTelemetryMiddleware:t,...i}=e;return this.withUserAgentMiddleware({customAgent:i?.userAgent||"typescript-sdk-apm-middleware"}),this.telemetryMiddleware=t(i),this}withBeforeExecutionMiddleware(e){let{middleware:t,...i}=e||{};return this.beforeMiddleware=e.middleware(i),this}withAfterExecutionMiddleware(e){let{middleware:t,...i}=e||{};return this.afterMiddleware=e.middleware(i),this}build(){let e=this.middlewares.slice();return this.telemetryMiddleware&&e.push(this.telemetryMiddleware),this.correlationIdMiddleware&&e.push(this.correlationIdMiddleware),this.userAgentMiddleware&&e.push(this.userAgentMiddleware),this.authMiddleware&&e.push(this.authMiddleware),this.beforeMiddleware&&e.push(this.beforeMiddleware),this.queueMiddleware&&e.push(this.queueMiddleware),this.loggerMiddleware&&e.push(this.loggerMiddleware),this.concurrentMiddleware&&e.push(this.concurrentMiddleware),this.httpMiddleware&&e.push(this.httpMiddleware),this.afterMiddleware&&e.push(this.afterMiddleware),K({middlewares:e})}};return rr(Ai);})();
2
2
  /*! Bundled license information:
3
3
 
4
4
  ieee754/index.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/ts-client",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "engines": {
5
5
  "node": ">=14"
6
6
  },