UNPKG

@getgreenspark/widgets

Version:

An SDK design to help the use of Greenspark's widget API in the browser

2 lines 91.5 kB
/*! For license information please see widgets@2.1.0-umd.js.LICENSE.txt */ (()=>{"use strict";var __webpack_modules__={921:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AVAILABLE_STATISTIC_TYPES=t.WIDGET_COLORS=t.IMPACT_TYPES=t.POPUP_THEMES=t.WIDGET_COLORS_V1=t.STATIC_WIDGET_STYLES=t.WIDGET_STYLES=t.DEFAULT_CONTAINER_CSS_SELECTOR=t.DEFAULT_LOCALE=t.AVAILABLE_LOCALES=void 0,t.AVAILABLE_LOCALES=["en","de","fr","es","nl","it"],t.DEFAULT_LOCALE="en",t.DEFAULT_CONTAINER_CSS_SELECTOR="[data-greenspark-widget-container]",t.WIDGET_STYLES=["default","simplified"],t.STATIC_WIDGET_STYLES=["default","simplified","rounded"],t.WIDGET_COLORS_V1=["beige","green","blue","white","black"],t.POPUP_THEMES=["light","dark"],t.IMPACT_TYPES=["trees","plastic","carbon","kelp","water","bees"],t.WIDGET_COLORS=["beige","green","blue","white","black","grey","transparent"],t.AVAILABLE_STATISTIC_TYPES=[...t.IMPACT_TYPES,"monthsEarthPositive","straws","miles","footballPitches"]},851:(__unused_webpack_module,exports,__webpack_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.DOMInjector=void 0;const constants_1=__webpack_require__(921);class DOMInjector{containerSelector;useShadowDom;constructor({containerSelector:e,useShadowDom:t=!0}){this.containerSelector=e,this.useShadowDom=t}getWrapper(e){return this.useShadowDom?e.shadowRoot??e.attachShadow({mode:"open"}):e}inject(widget,containerSelector){if(!widget)return;this.containerSelector=containerSelector??this.containerSelector;const container=document.querySelector(this.containerSelector);if(!container)throw new Error(`Greenspark - The document.querySelector('${this.containerSelector}') does not return an Element. Are you sure that you input the correct 'containerSelector'? The default selector is ${constants_1.DEFAULT_CONTAINER_CSS_SELECTOR}`);container.setAttribute("data-greenspark-shadow-dom-container","true");const scripts=[...widget.children].filter((e=>"SCRIPT"===e.tagName)),nonScripts=[...widget.children].filter((e=>"SCRIPT"!==e.tagName)),wrapper=this.getWrapper(container);for(;wrapper.firstChild;)wrapper.removeChild(wrapper.firstChild);wrapper.append(...nonScripts),"complete"===document.readyState||"interactive"===document.readyState?scripts.forEach((s=>eval(s.innerHTML))):document.addEventListener("DOMContentLoaded",(function(){scripts.forEach((s=>eval(s.innerHTML)))}))}parseHtml(e){const t=(new DOMParser).parseFromString(e,"text/html");if(null===t.body)throw new Error(`Greenspark - An error occurred when trying to execute 'renderToElement'. Failed to render ${e} `);return t.body}}exports.DOMInjector=DOMInjector},302:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionHandler=void 0;const i=r(635).__importDefault(r(425));t.ConnectionHandler=class{apiKey;integrationSlug;origin;api;locale;constructor({apiKey:e,integrationSlug:t,locale:r="en",isShopifyIntegration:n=!1,origin:o}){this.apiKey=e,this.integrationSlug=t,this.locale=r,this.api=i.default.create({baseURL:"https://api.getgreenspark.com",timeout:1e4}),this.origin=o,n?this.api.defaults.headers.common["x-integration-slug"]=this.integrationSlug:o?this.api.defaults.headers.common["x-gs-widget-origin"]=this.origin:this.api.defaults.headers.common["x-api-key"]=this.apiKey}async fetchCartWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/cart-widget`,e?Object.assign({},t,this.integrationSlug?{integrationSlug:this.integrationSlug}:null):Object.assign({},t,this.integrationSlug?{shopUniqueName:this.integrationSlug}:null),{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchCartWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/cart-widget/${t.widgetId}`,{integrationSlug:this.integrationSlug||"",...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchSpendLevelWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/spend-level-widget`,e?Object.assign({},t,this.integrationSlug?{integrationSlug:this.integrationSlug}:null):Object.assign({},t,this.integrationSlug?{shopUniqueName:this.integrationSlug}:null),{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchSpendLevelWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/spend-level-widget/${t.widgetId}`,{integrationSlug:this.integrationSlug||"",...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchPerOrderWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/per-order-widget`,e?Object.assign({},t,this.integrationSlug?{integrationSlug:this.integrationSlug}:null):Object.assign({},t,this.integrationSlug?{shopUniqueName:this.integrationSlug}:null),{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchPerOrderWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/per-order-widget/${t.widgetId}`,{integrationSlug:this.integrationSlug||"",...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchPerPurchaseWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e}/${i?"preview":"widgets"}/per-purchase-widget`,Object.assign({},t,this.integrationSlug?{integrationSlug:this.integrationSlug}:null),{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchByPercentageWidget({version:e,...t},r,i){return i=void 0===i?Boolean("GS_PREVIEW"===this.integrationSlug&&e):i,this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/by-percentage-widget`,e?Object.assign({},t,this.integrationSlug?{integrationSlug:this.integrationSlug}:null):Object.assign({},t,this.integrationSlug?{shopUniqueName:this.integrationSlug}:null),{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchByPercentageWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/by-percentage-widget/${t.widgetId}`,{integrationSlug:this.integrationSlug||"",...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchByPercentageOfRevenueWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/by-percentage-of-revenue-widget`,e?Object.assign({},t,this.integrationSlug?{integrationSlug:this.integrationSlug}:null):Object.assign({},t,this.integrationSlug?{shopUniqueName:this.integrationSlug}:null),{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchByPercentageOfRevenueWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/by-percentage-of-revenue-widget/${t.widgetId}`,{integrationSlug:this.integrationSlug||"",...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchTieredSpendLevelWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/tiered-spend-level-widget`,e?Object.assign({},t,this.integrationSlug?{integrationSlug:this.integrationSlug}:null):Object.assign({},t,this.integrationSlug?{shopUniqueName:this.integrationSlug}:null),{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchTieredSpendLevelWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/tiered-spend-level-widget/${t.widgetId}`,{integrationSlug:this.integrationSlug||"",...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchPerProductWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/per-product-widget`,e?Object.assign({},t,this.integrationSlug?{integrationSlug:this.integrationSlug}:null):Object.assign({},t,this.integrationSlug?{shopUniqueName:this.integrationSlug}:null),{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchPerProductWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/per-product-widget/${t.widgetId}`,{integrationSlug:this.integrationSlug||"",...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchTopStatsWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/stats-widget`,t,{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchTopStatsWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/stats-widget/${t.widgetId}`,{...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchStaticWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/static-widget`,t,{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchStaticWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/static-widget/${t.widgetId}`,{...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchFullWidthBannerWidget({version:e,...t},r){const i="GS_PREVIEW"===this.integrationSlug&&e;return this.api.post(`${e?`/${e}`:""}/${i?"preview":"widgets"}/full-width-banner`,t,{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}async fetchFullWidthBannerWidgetById({version:e,...t},r){return this.api.post(`/${e}/widgets/full-width-banner/${t.widgetId}`,{...t},{params:{lng:this.locale},headers:{...r,accept:"text/html","content-type":"application/json"}})}}},92:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ApiConsumer=void 0;const i=r(921),n=r(45);t.ApiConsumer=class{apiKey;integrationSlug;currentLocale;api;isShopifyIntegration;origin;constructor({apiKey:e,locale:t=i.DEFAULT_LOCALE,integrationSlug:r,shopUniqueName:n,isShopifyIntegration:o=!1,origin:s}){this.apiKey=e,this.currentLocale=t,this.integrationSlug=r||n,this.isShopifyIntegration=o,this.origin=s,this.api=this.instanciateApi()}get locale(){return this.currentLocale}set locale(e){this.currentLocale=this.validateLocale(e),this.api=this.instanciateApi()}instanciateApi(){return new n.ConnectionHandler({apiKey:this.apiKey,integrationSlug:this.integrationSlug,locale:this.locale,isShopifyIntegration:this.isShopifyIntegration,origin:this.origin})}validateLocale(e){return i.AVAILABLE_LOCALES.some((t=>t===e))||console.warn(`Greenspark - Failed to update locale, because ${e} is not currently supported. The available options are ${i.AVAILABLE_LOCALES.join(", ")}`),e}}},45:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const i=r(635);i.__exportStar(r(92),t),i.__exportStar(r(302),t)},685:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Widget=t.WidgetTemplate=void 0;const i=r(851);t.WidgetTemplate=class{};class n extends i.DOMInjector{api;constructor({api:e,containerSelector:t,useShadowDom:r}){super({containerSelector:t,useShadowDom:r}),this.api=e}render(){throw new Error("Greenspark - This widget does not support the 'render' method")}renderToString(){throw new Error("Greenspark - This widget does not support the 'renderToString' method")}renderToElement(){throw new Error("Greenspark - This widget does not support the 'renderToElement' method")}}t.Widget=n},409:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ByPercentageWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;withPopup;popupTheme;style;version;constructor(e){super(e),this.color=e.color,this.withPopup=e.withPopup??!0,this.popupTheme=e.popupTheme,this.style=e.style??"default",this.version=e.version}get requestBody(){return{color:this.color,withPopup:this.withPopup,popupTheme:this.popupTheme,style:this.style,version:this.version}}updateDefaults({color:e,withPopup:t,popupTheme:r,style:i,version:n}){this.color=e??this.color,this.withPopup=t??this.withPopup,this.popupTheme=r??this.popupTheme,this.style=i??this.style,this.version=n??this.version}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the By Percentage Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchByPercentageWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.ByPercentageWidget=o},601:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ByPercentageWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;version;constructor(e){super(e),this.widgetId=e.widgetId,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,version:this.version}}updateDefaults({widgetId:e,version:t}){this.widgetId=e??this.widgetId,this.version=t??this.version}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),(await this.api.fetchByPercentageWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.ByPercentageWidgetById=n},326:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ByPercentageOfRevenueWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;withPopup;popupTheme;style;version;constructor(e){super(e),this.color=e.color,this.withPopup=e.withPopup??!0,this.popupTheme=e.popupTheme,this.style=e.style??"default",this.version=e.version}get requestBody(){return{color:this.color,withPopup:this.withPopup,popupTheme:this.popupTheme,style:this.style,version:this.version}}updateDefaults({color:e,withPopup:t,popupTheme:r,style:i,version:n}){this.color=e??this.color,this.withPopup=t??this.withPopup,this.popupTheme=r??this.popupTheme,this.style=i??this.style,this.version=n??this.version}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the By Percentage Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchByPercentageOfRevenueWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.ByPercentageOfRevenueWidget=o},910:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ByPercentageOfRevenueWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;version;constructor(e){super(e),this.widgetId=e.widgetId,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,version:this.version}}updateDefaults({widgetId:e,version:t}){this.widgetId=e??this.widgetId,this.version=t??this.version}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),(await this.api.fetchByPercentageOfRevenueWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.ByPercentageOfRevenueWidgetById=n},794:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CartWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;order;withPopup;popupTheme;style;version;constructor(e){super(e),this.color=e.color,this.order=e.order,this.withPopup=e.withPopup??!0,this.popupTheme=e.popupTheme,this.style=e.style??"default",this.version=e.version}get requestBody(){return{color:this.color,order:this.order,withPopup:this.withPopup,popupTheme:this.popupTheme,style:this.style,version:this.version}}updateDefaults({color:e,order:t,withPopup:r,popupTheme:i,style:n,version:o}){this.color=e??this.color,this.order=t??this.order,this.withPopup=r??this.withPopup,this.popupTheme=i??this.popupTheme,this.style=n??this.style,this.version=o??this.version}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the Cart Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`);if("string"!=typeof this.order.currency)throw new Error(`Greenspark - "${this.order.currency}" was selected as the cart currency for the Cart Widget, but this currency is not available. Please use a valid currency code like "USD", "GBP" and "EUR".`);if(Number.isNaN(Number(this.order.totalPrice))||this.order.totalPrice<0)throw new Error(`Greenspark - ${this.order.totalPrice} was provided as the order's totalPrice, but this value is not a valid. Please provide a valid number to the Cart Widget.`);if(!Array.isArray(this.order.lineItems))throw new Error(`Greenspark - ${this.order.lineItems} was provided as the order's items, but this value is not valid. Please provide a valid array of items to the Cart Widget.`);if(!this.order.lineItems.every((e=>!(!e.productId||"string"!=typeof e.productId||Number.isNaN(Number(e.quantity))||e.quantity<0))))throw new Error("Greenspark - The values provided to the Cart Widget as 'lineItems' are not valid products with a 'productId'(string) and a 'quantity'(number).")}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchCartWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.CartWidget=o},514:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CartWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;order;version;constructor(e){super(e),this.widgetId=e.widgetId,this.order=e.order,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,order:this.order,version:this.version}}updateDefaults({widgetId:e,order:t,version:r}){this.widgetId=e??this.widgetId,this.order=t??this.order,this.version=r??this.version}validateOptions(){if("string"!=typeof this.order.currency)throw new Error(`Greenspark - "${this.order.currency}" was selected as the cart currency for the Cart Widget, but this currency is not available. Please use a valid currency code like "USD", "GBP" and "EUR".`);if(Number.isNaN(Number(this.order.totalPrice))||this.order.totalPrice<0)throw new Error(`Greenspark - ${this.order.totalPrice} was provided as the order's totalPrice, but this value is not a valid. Please provide a valid number to the Cart Widget.`);if(!Array.isArray(this.order.lineItems))throw new Error(`Greenspark - ${this.order.lineItems} was provided as the order's items, but this value is not valid. Please provide a valid array of items to the Cart Widget.`);if(!this.order.lineItems.every((e=>!(!e.productId||"string"!=typeof e.productId||Number.isNaN(Number(e.quantity))||e.quantity<0))))throw new Error("Greenspark - The values provided to the Cart Widget as 'lineItems' are not valid products with a 'productId'(string) and a 'quantity'(number).")}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchCartWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.CartWidgetById=n},507:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FullWidthBannerWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{options;imageUrl;title;description;callToActionUrl;textColor;buttonBackgroundColor;buttonTextColor;version;constructor(e){super(e),this.options=e.options,this.imageUrl=e.imageUrl,this.title=e.title,this.description=e.description,this.callToActionUrl=e.callToActionUrl,this.textColor=e.textColor,this.buttonBackgroundColor=e.buttonBackgroundColor,this.buttonTextColor=e.buttonTextColor,this.version=e.version}get requestBody(){return{options:this.options,imageUrl:this.imageUrl,title:this.title,description:this.description,callToActionUrl:this.callToActionUrl,textColor:this.textColor,buttonBackgroundColor:this.buttonBackgroundColor,buttonTextColor:this.buttonTextColor,version:this.version}}updateDefaults({options:e,imageUrl:t,title:r,description:i,callToActionUrl:n,textColor:o,buttonBackgroundColor:s,buttonTextColor:a,version:c}){this.options=e??this.options,this.imageUrl=t??this.imageUrl,this.title=r??this.title,this.description=i??this.description,this.callToActionUrl=n??this.callToActionUrl,this.textColor=o??this.textColor,this.buttonBackgroundColor=s??this.buttonBackgroundColor,this.buttonTextColor=a??this.buttonTextColor,this.version=c??this.version}validateOptions(){if(this.options.length<=0)throw new Error('Greenspark - the "options" value that was provided to the Full Width Banner Widget has no elements within the array.');if(this.options.forEach((e=>{if(!n.AVAILABLE_STATISTIC_TYPES.includes(e)||"string"!=typeof e)throw new Error(`Greenspark - "${e}" was provided as an option for the Full Width Banner Widget, but this is not a valid option. Please use values from the following list: ${n.AVAILABLE_STATISTIC_TYPES.join(", ")}`)})),this.imageUrl&&"string"!=typeof this.imageUrl)throw new Error(`Greenspark - "${this.imageUrl}" was set has the background image for the Full Width Banner, but this is not a valid value. Please use a valid URL string.`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchFullWidthBannerWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.FullWidthBannerWidget=o},687:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FullWidthBannerWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;version;constructor(e){super(e),this.widgetId=e.widgetId,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,version:this.version}}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),(await this.api.fetchFullWidthBannerWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}updateDefaults({widgetId:e,version:t}){this.widgetId=e??this.widgetId,this.version=t??this.version}}t.FullWidthBannerWidgetById=n},126:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FullWidthBannerWidgetById=t.FullWidthBannerWidget=t.TopStatsWidgetById=t.TopStatsWidget=t.StaticWidgetById=t.StaticWidget=t.PerProductWidgetById=t.PerProductWidget=t.TieredSpendLevelWidgetById=t.TieredSpendLevelWidget=t.ByPercentageOfRevenueWidgetById=t.ByPercentageOfRevenueWidget=t.ByPercentageWidgetById=t.ByPercentageWidget=t.PerPurchaseWidget=t.PerOrderWidgetById=t.PerOrderWidget=t.SpendLevelWidgetById=t.SpendLevelWidget=t.CartWidgetById=t.CartWidget=void 0;var i=r(794);Object.defineProperty(t,"CartWidget",{enumerable:!0,get:function(){return i.CartWidget}});var n=r(514);Object.defineProperty(t,"CartWidgetById",{enumerable:!0,get:function(){return n.CartWidgetById}});var o=r(742);Object.defineProperty(t,"SpendLevelWidget",{enumerable:!0,get:function(){return o.SpendLevelWidget}});var s=r(518);Object.defineProperty(t,"SpendLevelWidgetById",{enumerable:!0,get:function(){return s.SpendLevelWidgetById}});var a=r(681);Object.defineProperty(t,"PerOrderWidget",{enumerable:!0,get:function(){return a.PerOrderWidget}});var c=r(217);Object.defineProperty(t,"PerOrderWidgetById",{enumerable:!0,get:function(){return c.PerOrderWidgetById}});var l=r(962);Object.defineProperty(t,"PerPurchaseWidget",{enumerable:!0,get:function(){return l.PerPurchaseWidget}});var d=r(409);Object.defineProperty(t,"ByPercentageWidget",{enumerable:!0,get:function(){return d.ByPercentageWidget}});var u=r(601);Object.defineProperty(t,"ByPercentageWidgetById",{enumerable:!0,get:function(){return u.ByPercentageWidgetById}});var h=r(326);Object.defineProperty(t,"ByPercentageOfRevenueWidget",{enumerable:!0,get:function(){return h.ByPercentageOfRevenueWidget}});var p=r(910);Object.defineProperty(t,"ByPercentageOfRevenueWidgetById",{enumerable:!0,get:function(){return p.ByPercentageOfRevenueWidgetById}});var f=r(899);Object.defineProperty(t,"TieredSpendLevelWidget",{enumerable:!0,get:function(){return f.TieredSpendLevelWidget}});var g=r(199);Object.defineProperty(t,"TieredSpendLevelWidgetById",{enumerable:!0,get:function(){return g.TieredSpendLevelWidgetById}});var y=r(286);Object.defineProperty(t,"PerProductWidget",{enumerable:!0,get:function(){return y.PerProductWidget}});var w=r(902);Object.defineProperty(t,"PerProductWidgetById",{enumerable:!0,get:function(){return w.PerProductWidgetById}});var m=r(30);Object.defineProperty(t,"StaticWidget",{enumerable:!0,get:function(){return m.StaticWidget}});var v=r(54);Object.defineProperty(t,"StaticWidgetById",{enumerable:!0,get:function(){return v.StaticWidgetById}});var S=r(26);Object.defineProperty(t,"TopStatsWidget",{enumerable:!0,get:function(){return S.TopStatsWidget}});var b=r(82);Object.defineProperty(t,"TopStatsWidgetById",{enumerable:!0,get:function(){return b.TopStatsWidgetById}});var _=r(507);Object.defineProperty(t,"FullWidthBannerWidget",{enumerable:!0,get:function(){return _.FullWidthBannerWidget}});var T=r(687);Object.defineProperty(t,"FullWidthBannerWidgetById",{enumerable:!0,get:function(){return T.FullWidthBannerWidgetById}})},681:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PerOrderWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;withPopup;popupTheme;style;version;constructor(e){super(e),this.color=e.color,this.withPopup=e.withPopup??!0,this.popupTheme=e.popupTheme,this.style=e.style??"default",this.version=e.version}get requestBody(){return{color:this.color,withPopup:this.withPopup,popupTheme:this.popupTheme,style:this.style,version:this.version}}updateDefaults({color:e,withPopup:t,popupTheme:r,style:i,version:n}){this.color=e??this.color,this.withPopup=t??this.withPopup,this.popupTheme=r??this.popupTheme,this.style=i??this.style,this.version=n??this.version}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the Per Order Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchPerOrderWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.PerOrderWidget=o},217:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PerOrderWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;version;constructor(e){super(e),this.widgetId=e.widgetId,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,version:this.version}}updateDefaults({widgetId:e,version:t}){this.widgetId=e??this.widgetId,this.version=t??this.version}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),(await this.api.fetchPerOrderWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.PerOrderWidgetById=n},286:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PerProductWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;productId;withPopup;popupTheme;style;version;constructor(e){super(e),this.color=e.color,this.productId=e.productId,this.withPopup=e.withPopup??!0,this.popupTheme=e.popupTheme,this.style=e.style??"default",this.version=e.version}get requestBody(){return{color:this.color,productId:this.productId,withPopup:this.withPopup,popupTheme:this.popupTheme,style:this.style,version:this.version}}updateDefaults({color:e,productId:t,withPopup:r,popupTheme:i,style:n,version:o}){this.color=e??this.color,this.productId=t??this.productId,this.withPopup=r??this.withPopup,this.popupTheme=i??this.popupTheme,this.style=n??this.style,this.version=o??this.version}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the Per Product Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`);if(("string"!=typeof this.productId||""===this.productId)&&this.productId)throw new Error(`Greenspark - "${this.productId}" was selected as the product for the Per Product Widget, but this product ID is not valid. Please use a valid string.`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchPerProductWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.PerProductWidget=o},902:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PerProductWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;productId;version;constructor(e){super(e),this.widgetId=e.widgetId,this.productId=e.productId,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,productId:this.productId,version:this.version}}updateDefaults({widgetId:e,productId:t,version:r}){this.widgetId=e??this.widgetId,this.productId=t??this.productId,this.version=r??this.version}validateOptions(){if(("string"!=typeof this.productId||""===this.productId)&&this.productId)throw new Error(`Greenspark - "${this.productId}" was selected as the product for the Per Product Widget, but this product ID is not valid. Please use a valid string.`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchPerProductWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.PerProductWidgetById=n},962:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PerPurchaseWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;withPopup;popupTheme;style;version;constructor(e){super(e),this.color=e.color,this.withPopup=e.withPopup??!0,this.popupTheme=e.popupTheme,this.style=e.style??"default",this.version=e.version}get requestBody(){return{color:this.color,withPopup:this.withPopup,popupTheme:this.popupTheme,style:this.style,version:this.version}}updateDefaults({color:e,withPopup:t,popupTheme:r,style:i,version:n}){this.color=e??this.color,this.withPopup=t??this.withPopup,this.popupTheme=r??this.popupTheme,this.style=i??this.style,this.version=n??this.version}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the Per Purchase Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchPerPurchaseWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.PerPurchaseWidget=o},742:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SpendLevelWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;currency;withPopup;popupTheme;style;version;constructor(e){super(e),this.color=e.color,this.currency=e.currency,this.withPopup=e.withPopup??!0,this.popupTheme=e.popupTheme,this.style=e.style??"default",this.version=e.version}get requestBody(){return{color:this.color,currency:this.currency,withPopup:this.withPopup,popupTheme:this.popupTheme,style:this.style,version:this.version}}updateDefaults({color:e,currency:t,withPopup:r,popupTheme:i,style:n,version:o}){this.color=e??this.color,this.currency=t??this.currency,this.withPopup=r??this.withPopup,this.popupTheme=i??this.popupTheme,this.style=n??this.style,this.version=o??this.version}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the Spend Level Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`);if("string"!=typeof this.currency)throw new Error(`Greenspark - "${this.currency}" was selected as the widget's currency for the Spend Level Widget, but this currency is not available. Please use a valid currency code like "USD", "GBP" and "EUR".`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchSpendLevelWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.SpendLevelWidget=o},518:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SpendLevelWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;currency;version;constructor(e){super(e),this.widgetId=e.widgetId,this.currency=e.currency,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,currency:this.currency,version:this.version}}updateDefaults({widgetId:e,currency:t,version:r}){this.widgetId=e??this.widgetId,this.currency=t??this.currency,this.version=r??this.version}validateOptions(){if("string"!=typeof this.currency)throw new Error(`Greenspark - "${this.currency}" was selected as the widget's currency for the Spend Level Widget, but this currency is not available. Please use a valid currency code like "USD", "GBP" and "EUR".`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchSpendLevelWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.SpendLevelWidgetById=n},30:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StaticWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;version;style;constructor(e){super(e),this.color=e.color,this.version=e.version,this.style=e.style??"default"}get requestBody(){return{color:this.color,version:this.version,style:this.style}}updateDefaults({color:e,version:t,style:r}){this.color=e??this.color,this.version=t??this.version,this.style=r??this.style}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the Static Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchStaticWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.StaticWidget=o},54:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StaticWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;version;constructor(e){super(e),this.widgetId=e.widgetId,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,version:this.version}}updateDefaults({widgetId:e,version:t}){this.widgetId=e??this.widgetId,this.version=t??this.version}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),(await this.api.fetchStaticWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.StaticWidgetById=n},899:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TieredSpendLevelWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;currency;withPopup;popupTheme;style;version;constructor(e){super(e),this.color=e.color,this.currency=e.currency,this.withPopup=e.withPopup??!0,this.popupTheme=e.popupTheme,this.style=e.style??"default",this.version=e.version}get requestBody(){return{color:this.color,currency:this.currency,withPopup:this.withPopup,popupTheme:this.popupTheme,style:this.style,version:this.version}}updateDefaults({color:e,currency:t,withPopup:r,popupTheme:i,version:n,style:o}){this.color=e??this.color,this.currency=t??this.currency,this.withPopup=r??this.withPopup,this.popupTheme=i??this.popupTheme,this.version=n??this.version,this.style=o??this.style}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the Tiered Spend Level Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`);if("string"!=typeof this.currency)throw new Error(`Greenspark - "${this.currency}" was selected as the currency for the Tiered Spend Level Widget, but this currency is not available. Please use a valid currency code like "USD", "GBP" and "EUR".`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchTieredSpendLevelWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.TieredSpendLevelWidget=o},199:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TieredSpendLevelWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;currency;version;constructor(e){super(e),this.widgetId=e.widgetId,this.currency=e.currency,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,currency:this.currency,version:this.version}}updateDefaults({widgetId:e,currency:t,version:r}){this.widgetId=e??this.widgetId,this.currency=t??this.currency,this.version=r??this.version}validateOptions(){if("string"!=typeof this.currency)throw new Error(`Greenspark - "${this.currency}" was selected as the currency for the Tiered Spend Level Widget, but this currency is not available. Please use a valid currency code like "USD", "GBP" and "EUR".`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchTieredSpendLevelWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.TieredSpendLevelWidgetById=n},26:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TopStatsWidget=void 0;const i=r(685),n=r(921);class o extends i.Widget{color;withPopup;popupTheme;impactTypes;version;constructor(e){super(e),this.color=e.color,this.impactTypes=e.impactTypes,this.withPopup=e.withPopup,this.popupTheme=e.popupTheme,this.version=e.version}get requestBody(){return{color:this.color,impactTypes:this.impactTypes,withPopup:this.withPopup,popupTheme:this.popupTheme,version:this.version}}updateDefaults({color:e,impactTypes:t,withPopup:r,popupTheme:i,version:n}){this.color=e??this.color,this.impactTypes=t??this.impactTypes,this.withPopup=r??this.withPopup,this.popupTheme=i??this.popupTheme,this.version=n??this.version}validateOptions(){if(!n.WIDGET_COLORS.includes(this.color))throw new Error(`Greenspark - "${this.color}" was selected as the color for the Top Stats Widget, but this color is not available. Please use one of the available colors: ${n.WIDGET_COLORS.join(", ")}`);if(this.impactTypes&&this.impactTypes.some((e=>!n.IMPACT_TYPES.includes(e))))throw new Error(`Greenspark - "${this.impactTypes}" is not a valid list for the displayed values of the Top Stats Widget. Please use only the available types: ${n.IMPACT_TYPES.join(", ")}`)}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),this.validateOptions(),(await this.api.fetchTopStatsWidget(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.TopStatsWidget=o},82:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TopStatsWidgetById=void 0;const i=r(685);class n extends i.Widget{widgetId;version;constructor(e){super(e),this.widgetId=e.widgetId,this.version=e.version}get requestBody(){return{widgetId:this.widgetId,version:this.version}}updateDefaults({widgetId:e,version:t}){this.widgetId=e??this.widgetId,this.version=t??this.version}async render(e,t){const r=await this.renderToElement(e);this.inject(r,t)}async renderToString(e){return e&&this.updateDefaults(e),(await this.api.fetchTopStatsWidgetById(this.requestBody)).data}async renderToElement(e){const t=await this.renderToString(e);return this.parseHtml(t)}}t.TopStatsWidgetById=n},425:(e,t,r)=>{function i(e,t){return function(){return e.apply(t,arguments)}}const{toString:n}=Object.prototype,{getPrototypeOf:o}=Object,s=(a=Object.create(null),e=>{const t=n.call(e);return a[t]||(a[t]=t.slice(8,-1).toLowerCase())});var a;const c=e=>(e=e.toLowerCase(),t=>s(t)===e),l=e=>t=>typeof t===e,{isArray:d}=Array,u=l("undefined"),h=c("ArrayBuffer"),p=l("string"),f=l("function"),g=l("number"),y=e=>null!==e&&"object"==typeof e,w=e=>{if("object"!==s(e))return!1;const t=o(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},m=c("Date"),v=c("File"),S=c("Blob"),b=c("FileList"),_=c("URLSearchParams"),[T,E,O,P]=["ReadableStream","Request","Response","Headers"].map(c);function I(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),d(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{const n=r?Object.getOwnPropertyNames(e):Object.keys(e),o=n.length;let s;for(i=0;i<o;i++)s=n[i],t.call(null,e[s],s,e)}}function W(e,t){t=t.toLowerCase();const r=Object.keys(e);let i,n=r.length;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const R="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:r.g,B=e=>!u(e)&&e!==R,C=(j="undefined"!=typeof Uint8Array&&o(Uint8Array),e=>j&&e instanceof j);var j;const A=c("HTMLFormElement"),D=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),L=c("RegExp"),x=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};I(r,((r,n)=>{let o;!1!==(o=t(r,n,e))&&(i[n]=o||r)})),Object.defineProperties(e,i)},N=c("AsyncFunction"),k=(U="function"==typeof setImmediate,F=f(R.postMessage),U?setImmediate:F?(q=`axios@${Math.random()}`,$=[],R.addEventListener("message",(({source:e,data:t})=>{e===R&&t===q&&$.length&&$.shift()()}),!1),e=>{$.push(e),R.postMessage(q,"*")}):e=>setTimeout(e));var U,F,q,$;const G="undefined"!=typeof queueMicrotask?queueMicrotask.bind(R):"undefined"!=typeof process&&process.nextTick||k;var M={isArray:d,isArrayBuffer:h,isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=s(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&h(e.buffer),t},isString:p,isNumber:g,isBoolean:e=>!0===e||!1===e,isObject:y,isPlainObject:w,isReadableStream:T,isRequest:E,isResponse:O,isHeaders:P,isUndefined:u,isDate:m,isFile:v,isBlob:S,isRegExp:L,isFunction:f,isStream:e=>y(e)&&f(e.pipe),isURLSearchParams:_,isTypedArray:C,isFileList:b,forEach:I,merge:function e(){const{caseless:t}=B(this)&&this||{},r={},i=(i,n)=>{const o=t&&W(r,n)||n;w(r[o])&&w(i)?r[o]=e(r[o],i):w(i)?r[o]=e({},i):d(i)?r[o]=i.slice():r[o]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&I(arguments[e],i);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(I(t,((t,n)=>{r&&f(t)?e[n]=i(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let n,s,a;const c={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),s=n.length;s-- >0;)a=n[s],i&&!i(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&o(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:s,kindOfTest:c,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const i=e.indexOf(t,r);return-1!==i&&i===r},toArray:e=>{if(!e)return null;if(d(e))return e;let t=e.length;if(!g(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let i;for(;(i=r.next())&&!i.done;){const r=i.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const i=[];for(;null!==(r=e.exec(t));)i.push(r);return i},isHTMLForm:A,hasOwnProperty:D,hasOwnProp:D,reduceDescriptors:x,freezeMethods:e=>{x(e,((t,r)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];f(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},i=e=>{e.forEach((e=>{r[e]=!0}))};return d(e)?i(e):i(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:W,global:R,isContextDefined:B,isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(y(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const n=d(e)?[]:{};return I(e,((e,t)=>{const o=r(e,i+1);!u(o)&&(n[t]=o)})),t[i]=void 0,n}}return e};return r(e,0)},isAsyncFn:N,isThenable:e=>e&&(y(e)||f(e))&&f(e.then)&&f(e.catch),setImmediate:k,asap:G};function H(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}M.inherits(H,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:M.toJSONObject(this.config),code:this.code,status:this.status}}});const V=H.prototype,z={};function K(e){return M.isPlainObject(e)||M.isArray(e)}function J(e){return M.endsWith(e,"[]")?e.slice(0,-2):e}function Y(e,t,r){return e?e.concat(t).map((function(e,t){return e=J(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{z[e]={value:e}})),Object.defineProperties(H,z),Object.defineProperty(V,"isAxiosError",{value:!0}),H.from=(e,t,r,i,n,o)=>{const s=Object.create(V);return M.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),H.call(s,e.message,t,r,i,n),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};const X=M.toFlatObject(M,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Q(e,t,r){if(!M.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(r=M.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!M.isUndefined(t[e])}))).metaTokens,n=r.visitor||l,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&M.isSpecCompliantForm(t);if(!M.isFunction(n))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(M.isDate(e))return e.toISOString();if(!a&&M.isBlob(e))throw new H("Blob is not supported. Use a Buffer instead.");return M.isArrayBuffer(e)||M.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function l(e,r,n){let a=e;if(e&&!n&&"object"==typeof e)if(M.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=JSON.stringify(e);else if(M.isArray(e)&&function(e){return M.isArray(e)&&!e.some(K)}(e)||(M.isFileList(e)||M.endsWith(r,"[]"))&&(a=M.toArray(e)))return r=J(r),a.forEach((function(e,i){!M.isUndefined(e)&&null!==e&&t.append(!0===s?Y([r],i,o):null===s?r:r+"[]",c(e))})),!1;return!!K(e)||(t.append(Y(n,r,o),c(e)),!1)}const d=[],u=Object.assign(X,{defaultVisitor:l,convertValue:c,isVisitable:K});if(!M.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!M.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+i.join("."));d.push(r),M.forEach(r,(function(r,o){!0===(!(M.isUndefined(r)||null===r)&&n.call(t,r,M.isString(o)?o.trim():o,i,u))&&e(r,i?i.concat(o):[o])})),d.pop()}}(e),t}function Z(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ee(e,t){this._pairs=[],e&&Q(e,this,t)}const te=ee.pr