crmbonus-component-wake 2.0.123 → 2.0.125
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/dist/cjs/{cart.helper-607a299f.js → cart.helper-d4d8d619.js} +5 -2
- package/dist/cjs/cart.helper-d4d8d619.js.map +1 -0
- package/dist/cjs/crm-bonus-form.cjs.entry.js +1 -1
- package/dist/cjs/crm-bonus-note.cjs.entry.js +2 -2
- package/dist/cjs/crm-bonus.cjs.entry.js +2 -2
- package/dist/cjs/crm-giftback-form_2.cjs.entry.js +1 -1
- package/dist/cjs/{crmbonus.service-8dff0944.js → crmbonus.service-9067d00d.js} +2 -2
- package/dist/cjs/{crmbonus.service-8dff0944.js.map → crmbonus.service-9067d00d.js.map} +1 -1
- package/dist/cjs/pedido-finalizado.cjs.entry.js +2 -2
- package/dist/collection/helpers/cart.helper.js +3 -0
- package/dist/collection/helpers/cart.helper.js.map +1 -1
- package/dist/components/crm-bonus-form.js +1 -1
- package/dist/components/crm-bonus-note.js +1 -1
- package/dist/components/crm-bonus.js +3 -3
- package/dist/components/crm-giftback-form.js +1 -1
- package/dist/components/{p-2f3e90b8.js → p-6eda79c3.js} +2 -2
- package/dist/components/{p-2f3e90b8.js.map → p-6eda79c3.js.map} +1 -1
- package/dist/components/{p-29841718.js → p-abbfbc98.js} +5 -2
- package/dist/components/p-abbfbc98.js.map +1 -0
- package/dist/components/{p-22dc683b.js → p-e18e11ae.js} +2 -2
- package/dist/components/{p-22dc683b.js.map → p-e18e11ae.js.map} +1 -1
- package/dist/components/pedido-finalizado.js +2 -2
- package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
- package/dist/crmbonus-component-wake/{p-68b6900a.entry.js → p-4fa63df0.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-2f3e90b8.js → p-6eda79c3.js} +2 -2
- package/dist/crmbonus-component-wake/{p-2f3e90b8.js.map → p-6eda79c3.js.map} +1 -1
- package/dist/crmbonus-component-wake/{p-55eef7f5.entry.js → p-7cdb2c4a.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-db15f2e2.entry.js → p-a33f7c24.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-29841718.js → p-abbfbc98.js} +2 -2
- package/dist/crmbonus-component-wake/p-abbfbc98.js.map +1 -0
- package/dist/crmbonus-component-wake/{p-6f63c678.entry.js → p-c23f3a07.entry.js} +2 -2
- package/dist/crmbonus-component-wake/{p-a32757eb.entry.js → p-fad20959.entry.js} +2 -2
- package/dist/env.js +1 -1
- package/dist/env.js.map +1 -1
- package/dist/esm/{cart.helper-d5efc60e.js → cart.helper-30a40560.js} +5 -2
- package/dist/esm/cart.helper-30a40560.js.map +1 -0
- package/dist/esm/crm-bonus-form.entry.js +1 -1
- package/dist/esm/crm-bonus-note.entry.js +2 -2
- package/dist/esm/crm-bonus.entry.js +2 -2
- package/dist/esm/crm-giftback-form_2.entry.js +1 -1
- package/dist/esm/{crmbonus.service-d99af814.js → crmbonus.service-42fbd7fa.js} +2 -2
- package/dist/esm/{crmbonus.service-d99af814.js.map → crmbonus.service-42fbd7fa.js.map} +1 -1
- package/dist/esm/pedido-finalizado.entry.js +2 -2
- package/dist/types/home/darlison/Projects/Bycoders/crmbonus/crmbonus-component/.stencil/env.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/cart.helper-607a299f.js.map +0 -1
- package/dist/components/p-29841718.js.map +0 -1
- package/dist/crmbonus-component-wake/p-29841718.js.map +0 -1
- package/dist/esm/cart.helper-d5efc60e.js.map +0 -1
- /package/dist/crmbonus-component-wake/{p-68b6900a.entry.js.map → p-4fa63df0.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-55eef7f5.entry.js.map → p-7cdb2c4a.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-db15f2e2.entry.js.map → p-a33f7c24.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-6f63c678.entry.js.map → p-c23f3a07.entry.js.map} +0 -0
- /package/dist/crmbonus-component-wake/{p-a32757eb.entry.js.map → p-fad20959.entry.js.map} +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import { C as CrmBonusService, a as CHECKOUT_CART_WAKE } from './p-
|
1
|
+
import { C as CrmBonusService, a as CHECKOUT_CART_WAKE } from './p-6eda79c3.js';
|
2
2
|
|
3
3
|
class CartWake {
|
4
4
|
constructor(cart) {
|
@@ -63,9 +63,12 @@ const buildUrlBase = () => {
|
|
63
63
|
if (url.includes('fbits')) {
|
64
64
|
return url;
|
65
65
|
}
|
66
|
+
if (url.includes("www.")) {
|
67
|
+
return url.replace("www", "checkout");
|
68
|
+
}
|
66
69
|
return `${window.location.protocol}//checkout.${window.location.host}`;
|
67
70
|
};
|
68
71
|
|
69
72
|
export { CartWake as C, getCart as g };
|
70
73
|
|
71
|
-
//# sourceMappingURL=p-
|
74
|
+
//# sourceMappingURL=p-abbfbc98.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"file":"p-abbfbc98.js","mappings":";;MAEa,QAAQ;IAQjB,YAAY,IAAI;;QAJhB,aAAQ,GAAmB,EAAE,CAAC;QAK1B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAE,EAAE,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;KACvD;IAEO,cAAc,CAAC,WAAW,GAAG,EAAE;QACnC,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE9C,IAAG,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AAQ,CAAC,IAAI,CAAC,CAAC;AAC9B,EAAC;AAED,MAAM,YAAY,GAAG;IAEjB,MAAM,GAAG,GAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAEpC,IAAG,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;QAC1B,OAAO,kBAAkB,CAAC;KAC7B;IAED,IAAG,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACzB,OAAO,GAAG,CAAC;KACd;IAED,IAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACtB,OAAO,GAAG,CAAC;KACd;IAED,IAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACrB,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;KACxC;IAED,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAE3E,CAAC;;;;","names":[],"sources":["src/objectvalues/cart.wake.ts","src/helpers/cart.helper.ts"],"sourcesContent":["import { IProductWake, IStore, IUser } from \"../dto/validate.pin.bonus\";\n\nexport class CartWake {\n id: string;\n middlewareId: string;\n orderId: number;\n products: IProductWake[] = [];\n user: IUser;\n store: IStore;\n\n constructor(cart) {\n this.id = cart.Metadados.id || cart.Id;\n this.middlewareId = cart.Metadados?.id;\n this.orderId = cart.PedidoId;\n this.buildUserInfo(cart);\n this.buildStoreInfo(cart);\n this.products = this.buildStoreCart( cart.Produtos);\n }\n\n private buildStoreCart(newProducts = []) {\n const cache = localStorage.getItem(\"bc:cart\");\n\n if(!cache) {\n return this.saveStore(newProducts)\n \n }\n \n const cacheProducts:IProductWake[] = JSON.parse(cache);\n\n if(newProducts.length !== cacheProducts.length) {\n return this.saveStore(newProducts);\n }\n\n for (const p of newProducts) {\n const [cp] = cacheProducts.filter(cpp => cpp.ProdutoVarianteId == p.ProdutoVarianteId);\n\n if(cp) {\n cp.Quantidade != p.Quantidade;\n\n return newProducts;\n }\n }\n\n return cacheProducts;\n\n }\n\n\n private saveStore(newProducts) {\n localStorage.setItem(\"bc:cart\", JSON.stringify(newProducts));\n\n return newProducts;\n }\n\n private buildUserInfo(cart) {\n this.user = {\n id: cart.Usuario ? cart.Usuario.Id : null\n }\n }\n\n private buildStoreInfo(cart) {\n this.store = {\n name: cart.Loja?.Nome\n }\n }\n}","import { CHECKOUT_CART_WAKE } from \"../../env\";\nimport { CartWake } from \"../objectvalues/cart.wake\";\nimport { CrmBonusService } from \"../services/crmbonus.service\";\n\nconst crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\nexport const getCart = async (): Promise<CartWake> => {\n const baseUrl = buildUrlBase(); // window.location.origin; //\"https://bycoders.fbits.store\" //window.location.origin;\n \n console.log('[URL STORE]: ', baseUrl)\n\n const cart = await crmBonusService.getInfoCart(baseUrl);\n\n return new CartWake(cart);\n}\n\nconst buildUrlBase = () => {\n\n const url = window.location.origin; //\"https://bycoders.checkout.fbits.store\" //\n\n if(url.includes('localhost')) {\n return CHECKOUT_CART_WAKE;\n }\n\n if(url.includes('checkout')) {\n return url;\n }\n\n if(url.includes('fbits')) {\n return url;\n }\n\n if(url.includes(\"www.\")) {\n return url.replace(\"www\", \"checkout\")\n }\n\n return `${window.location.protocol}//checkout.${window.location.host}`;\n\n}"],"version":3}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-3e84f78c.js';
|
2
|
-
import { C as CrmBonusService } from './p-
|
2
|
+
import { C as CrmBonusService } from './p-6eda79c3.js';
|
3
3
|
import { S as StepFormEnum } from './p-7cfea8fe.js';
|
4
4
|
import { g as getInfoCustomization } from './p-75ba7b9a.js';
|
5
5
|
import { i as instance } from './p-e8c19a64.js';
|
@@ -313,4 +313,4 @@ defineCustomElement();
|
|
313
313
|
|
314
314
|
export { CrmBonus as C, defineCustomElement as d };
|
315
315
|
|
316
|
-
//# sourceMappingURL=p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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/giftback-form/giftback-form.css?tag=crm-giftback-form","src/components/giftback-form/giftback-form.tsx"],"sourcesContent":["* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n font-weight: 100;\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, Method, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { StepFormEnum } from \"../../contants\";\nimport { IPinSent } from '../../dto/pin.sent'\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport i18next from \"../../i18n/i18n\"\nimport { USED_KEY, getKeyReserveByCartId } from \"../../utils/keys.storage\";\n\n@Component({\n tag: 'crm-giftback-form',\n styleUrl: 'giftback-form.css'\n})\nexport class CrmBonus {\n // private phoneInputMask: HTMLPhoneFormElement;\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n @Prop({ attribute: 'storename' }) storeName;\n @Prop() cartId;\n @Prop() products: Array<IProduct>;\n @Prop() customer: ICustomer;\n @Prop() loadProducts: () => void;\n\n @State() value: string;\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: string;\n @State() pinInfo: IPinSent;\n @State() step: StepFormEnum = StepFormEnum.STEP_RESERVE;\n @State() bonus: IBonus;\n\n @State() sucess: string = \"\";\n @State() error: string = \"\";\n @State() config: IInfoStore;\n\n @State() hasApplyBonus = false;\n\n\n @Method()\n async setStep(step: StepFormEnum) {\n this.step = step\n }\n\n @Method()\n async processBonus(products: IProduct[] = [], hasNewProduct = false) {\n this.sucess = \"\";\n\n console.log('processBonus', [])\n if (hasNewProduct) {\n this.products = products;\n }\n\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if (_bonus) {\n\n const bonus = JSON.parse(_bonus)\n\n this.bonus = bonus;\n\n this.phone = bonus.phone;\n this.pinInfo = {\n storeId: bonus.storeId,\n userId: bonus.userId\n }\n\n await this.validateBonus(\"2018\");\n //this.step = StepFormEnum.STEP_RESERVE;\n\n }\n }\n\n async handleSendPin(phone: string) {\n\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.phone = phone;\n\n this.sendPin();\n }\n\n async componentWillLoad() {\n this.sucess = \"\";\n this.error = \"\"\n this.config = getInfoCustomization(this.storeName);\n\n const phoneAgain = this.getPhoneNumberAgain();\n\n if (phoneAgain) {\n this.step = StepFormEnum.STEP_PHONE;\n return\n }\n\n await this.processBonus();\n\n }\n\n getPhoneNumberAgain() {\n const consulta_bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if (!consulta_bonus) return true;\n\n const bonus = JSON.parse(consulta_bonus);\n\n return !bonus.hasBonus;\n }\n\n private convertStringToNumber(): number {\n const _phone = this.phone.replace(/\\D/g, '');\n return Number(_phone);\n }\n\n public async sendPin() {\n this.loading = true;\n this.message = \"\";\n this.sucess = \"\";\n this.error = \"\"\n\n try {\n\n const _phone = this.convertStringToNumber();\n const pinInfoCache = localStorage.getItem(`bc:${this.phone}`);\n\n if (!pinInfoCache) {\n this.pinInfo = await this.crmBonusService.sendPin(_phone, this.customer?.name, this.storeName);\n }\n\n if (pinInfoCache) {\n\n const bonus = JSON.parse(pinInfoCache);\n\n this.pinInfo = {\n storeId: bonus.storeId,\n userId: bonus.userId\n }\n\n await this.validateBonus(\"2018\");\n this.step = StepFormEnum.STEP_RESERVE;\n } else {\n this.step = StepFormEnum.STEP_PIN;\n }\n\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n changePhone() {\n this.sucess = \"\";\n this.error = \"\"\n this.step = StepFormEnum.STEP_PHONE;\n }\n\n public async validateBonus(pin: string) {\n\n this.loadProducts();\n\n const used_or_no = localStorage.getItem(USED_KEY);\n\n if (used_or_no == \"dontUse\") {\n this.step = StepFormEnum.STEP_RESERVE;\n return\n }\n\n this.loading = true;\n this.sucess = \"\";\n this.error = \"\";\n const payload: IProccesPinBonusDto = {\n pin: pin,\n cellphone: this.convertStringToNumber(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: this.customer?.name,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n\n this.loading = false;\n this.step = StepFormEnum.STEP_NO_BONUS;\n return\n }\n\n this.sucess = \"Código validado com sucesso!\";\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n localStorage.setItem(`bc:${this.phone}`, JSON.stringify(this.bonus));\n\n localStorage.setItem(USED_KEY, \"use\");\n localStorage.setItem(this.cartId, this.bonus.bonusBalance.toString());\n\n this.step = StepFormEnum.STEP_RESERVE;\n\n } catch (error) {\n const _error: string = error?.response?.data?.message;\n\n if (_error.includes(\"Pin\")) {\n this.error = \"Código inválido!\"\n } else {\n this.error = _error;\n this.step = StepFormEnum.STEP_NO_BONUS;\n }\n\n\n } finally {\n this.loading = false;\n }\n }\n\n public handleCancel() {\n // this.step = StepFormEnum.STEP_PHONE;\n this.cancel()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n\n localStorage.setItem(USED_KEY, \"dontUse\");\n this.save(0)\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n public async reserveApply(amount: number) {\n this.loading = true;\n this.message = \"\";\n try {\n await this.reserve(amount);\n this.save(amount);\n\n } catch (error) {\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\n\n this.step = StepFormEnum.STEP_NO_BONUS;\n localStorage.removeItem(this.cartId);\n } finally {\n this.loading = false;\n }\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n }\n\n public async reserve(amount: number) {\n\n await this.crmBonusService.reserve({\n redeemedBonus: amount,\n cartId: this.cartId,\n ticket: this.cartId,\n grossValue: Number(this.bonus.totalValue),\n storeName: this.storeName,\n storeId: this.bonus.storeId.toString(),\n userId: this.bonus.userId\n });\n }\n\n render() {\n return (\n <div class=\"crm-container-form fbits-responsive-carrinho-desconto\" >\n\n {/* <loading-container /> */}\n\n <label class=\"crm-title\">{this.config.giftbackTitle}</label>\n\n {this.step === StepFormEnum.STEP_PHONE &&\n <phone-form\n value={this.customer.phone}\n config={this.config}\n loading={this.loading}\n handlerSubmit={(phone) => this.handleSendPin(phone)}\n />}\n {\n this.step === StepFormEnum.STEP_PIN &&\n <pin-form\n config={this.config}\n phone={this.phone}\n cancel={() => this.changePhone()}\n resend={() => this.sendPin()}\n validate={(data) => this.validateBonus(data)}\n loading={this.loading}\n >\n {this.sucess && <p class=\"crm-message-info\">{this.sucess}</p>}\n {this.error && <p class=\"crm-message-error\">{this.error}</p>}\n\n </pin-form>\n }\n\n {\n this.step === StepFormEnum.STEP_RESERVE &&\n <giftback-info\n config={this.config}\n loading={this.loading}\n cancel={() => this.handleCancel()}\n bonus={this.bonus}\n reserve={() => this.processBonus()}\n />\n }\n\n {\n this.step === StepFormEnum.STEP_NO_BONUS &&\n (\n <div class=\"container-message\">\n {i18next.t(\"noGiftback\", { storename: this.config.giftbackTitle })}\n </div>\n )\n\n }\n </div>\n )\n }\n}"],"version":3}
|
1
|
+
{"file":"p-e18e11ae.js","mappings":";;;;;;;;;;;;;;;AAAA,MAAM,eAAe,GAAG,i+BAAi+B,CAAC;AAC1/B,8BAAe,eAAe;;MCajB,QAAQ;;;;;QAGX,oBAAe,GAAoB,eAAe,CAAC,WAAW,EAAE,CAAC;;;;;;;uBAS7C,KAAK;;;;oBAIH,YAAY,CAAC,YAAY;;sBAG7B,EAAE;qBACH,EAAE;;6BAGF,KAAK;;IAI9B,MAAM,OAAO,CAAC,IAAkB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;KACjB;IAGD,MAAM,YAAY,CAAC,WAAuB,EAAE,EAAE,aAAa,GAAG,KAAK;QACjE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QAEjB,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,CAAC,CAAA;QAC/B,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,qBAAqB,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IAAE,IAAI,CAAC,KAAK,CAAK,CAEnD,EAIX,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,YAAY;YACvC,sEACE,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,EACjC,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,GAClC,EAIF,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,aAAa;aAEtC,4DAAK,KAAK,EAAC,mBAAmB,IAC3BA,QAAO,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAC9D,CACP,CAGC,EACP;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["i18next"],"sources":["src/components/giftback-form/giftback-form.css?tag=crm-giftback-form","src/components/giftback-form/giftback-form.tsx"],"sourcesContent":["* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\n:host {\n --crmfont-sizebodymd: 14px;\n --crmline-heightbodymd: 20px;\n --crmletter-spacingtitle-md: 0px\n}\n\n.container-message {\n font-family: Roboto;\n font-size: var(--crmfont-sizebodymd);\n font-weight: 400;\n line-height: var(--crmline-heightbodymd);\n letter-spacing: var(--crmletter-spacingtitle-md);\n text-align: left;\n text-underline-position: from-font;\n text-decoration-skip-ink: none;\n}\n\n.crm-container-form {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n height: auto;\n padding: 20px 24px 20px 24px;\n border: 1px solid #CCCC;\n writing-mode: horizontal-tb;\n gap: 16px;\n border-top: 1px solid #ccc !important;\n border-bottom: 1px solid #ccc !important;\n}\n\n/* .fbits-responsive-carrinho-desconto {\n overflow: hidden;\n border: 1px solid #ccc;\n border-top: 0;\n border-bottom: 0;\n} */\n\n.crm-phone-form {\n display: flex;\n flex-direction: column;\n height: 100%;\n /* justify-content: space-around; */\n gap: 16px;\n}\n\n.crm-subtitle {\n font-size: 14px;\n color: var(--crm-btn);\n font-weight: 100;\n}\n\n.crm-title {\n font-weight: 700;\n line-height: 20px;\n color: #262626;\n font-size: 16px;\n}\n\n.crm-message-info {\n color: #619013;\n font-weight: 500;\n font-size: 12px;\n}\n\n.crm-message-error {\n color: #E11D48;\n font-weight: 500;\n font-size: 12px;\n}","import { Component, Method, Prop, State, h } from \"@stencil/core\";\nimport { CrmBonusService } from \"../../services/crmbonus.service\";\nimport { StepFormEnum } from \"../../contants\";\nimport { IPinSent } from '../../dto/pin.sent'\nimport { IBonus, ICustomer, IProccesPinBonusDto, IProduct } from \"../../dto/validate.pin.bonus\";\nimport { IInfoStore, getInfoCustomization } from \"../../helpers/info.config.helper\";\n\nimport i18next from \"../../i18n/i18n\"\nimport { USED_KEY, getKeyReserveByCartId } from \"../../utils/keys.storage\";\n\n@Component({\n tag: 'crm-giftback-form',\n styleUrl: 'giftback-form.css'\n})\nexport class CrmBonus {\n // private phoneInputMask: HTMLPhoneFormElement;\n\n private crmBonusService: CrmBonusService = CrmBonusService.getInstance();\n\n @Prop({ attribute: 'storename' }) storeName;\n @Prop() cartId;\n @Prop() products: Array<IProduct>;\n @Prop() customer: ICustomer;\n @Prop() loadProducts: () => void;\n\n @State() value: string;\n @State() loading: boolean = false;\n @State() message: string;\n @State() phone: string;\n @State() pinInfo: IPinSent;\n @State() step: StepFormEnum = StepFormEnum.STEP_RESERVE;\n @State() bonus: IBonus;\n\n @State() sucess: string = \"\";\n @State() error: string = \"\";\n @State() config: IInfoStore;\n\n @State() hasApplyBonus = false;\n\n\n @Method()\n async setStep(step: StepFormEnum) {\n this.step = step\n }\n\n @Method()\n async processBonus(products: IProduct[] = [], hasNewProduct = false) {\n this.sucess = \"\";\n\n console.log('processBonus', [])\n if (hasNewProduct) {\n this.products = products;\n }\n\n const _bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if (_bonus) {\n\n const bonus = JSON.parse(_bonus)\n\n this.bonus = bonus;\n\n this.phone = bonus.phone;\n this.pinInfo = {\n storeId: bonus.storeId,\n userId: bonus.userId\n }\n\n await this.validateBonus(\"2018\");\n //this.step = StepFormEnum.STEP_RESERVE;\n\n }\n }\n\n async handleSendPin(phone: string) {\n\n this.message = \"\"\n if (!phone) {\n this.message = \"Informe seu telefone\";\n return;\n }\n\n this.phone = phone;\n\n this.sendPin();\n }\n\n async componentWillLoad() {\n this.sucess = \"\";\n this.error = \"\"\n this.config = getInfoCustomization(this.storeName);\n\n const phoneAgain = this.getPhoneNumberAgain();\n\n if (phoneAgain) {\n this.step = StepFormEnum.STEP_PHONE;\n return\n }\n\n await this.processBonus();\n\n }\n\n getPhoneNumberAgain() {\n const consulta_bonus = localStorage.getItem(getKeyReserveByCartId(this.cartId));\n\n if (!consulta_bonus) return true;\n\n const bonus = JSON.parse(consulta_bonus);\n\n return !bonus.hasBonus;\n }\n\n private convertStringToNumber(): number {\n const _phone = this.phone.replace(/\\D/g, '');\n return Number(_phone);\n }\n\n public async sendPin() {\n this.loading = true;\n this.message = \"\";\n this.sucess = \"\";\n this.error = \"\"\n\n try {\n\n const _phone = this.convertStringToNumber();\n const pinInfoCache = localStorage.getItem(`bc:${this.phone}`);\n\n if (!pinInfoCache) {\n this.pinInfo = await this.crmBonusService.sendPin(_phone, this.customer?.name, this.storeName);\n }\n\n if (pinInfoCache) {\n\n const bonus = JSON.parse(pinInfoCache);\n\n this.pinInfo = {\n storeId: bonus.storeId,\n userId: bonus.userId\n }\n\n await this.validateBonus(\"2018\");\n this.step = StepFormEnum.STEP_RESERVE;\n } else {\n this.step = StepFormEnum.STEP_PIN;\n }\n\n } catch (error) {\n this.message = error?.response?.data?.message\n } finally {\n this.loading = false\n }\n }\n\n changePhone() {\n this.sucess = \"\";\n this.error = \"\"\n this.step = StepFormEnum.STEP_PHONE;\n }\n\n public async validateBonus(pin: string) {\n\n this.loadProducts();\n\n const used_or_no = localStorage.getItem(USED_KEY);\n\n if (used_or_no == \"dontUse\") {\n this.step = StepFormEnum.STEP_RESERVE;\n return\n }\n\n this.loading = true;\n this.sucess = \"\";\n this.error = \"\";\n const payload: IProccesPinBonusDto = {\n pin: pin,\n cellphone: this.convertStringToNumber(),\n storeId: this.pinInfo.storeId.toString(),\n userId: this.pinInfo.userId.toString(),\n checkoutId: this.cartId,\n checkoutProducts: this.products,\n name: this.customer?.name,\n storeName: this.storeName\n }\n\n try {\n this.bonus = await this.crmBonusService.validatePinBonus(payload);\n\n if (!this.bonus.hasBonus) {\n\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n\n this.loading = false;\n this.step = StepFormEnum.STEP_NO_BONUS;\n return\n }\n\n this.sucess = \"Código validado com sucesso!\";\n localStorage.setItem(getKeyReserveByCartId(this.cartId), JSON.stringify({ ...this.bonus, phone: this.phone }));\n localStorage.setItem(`bc:${this.phone}`, JSON.stringify(this.bonus));\n\n localStorage.setItem(USED_KEY, \"use\");\n localStorage.setItem(this.cartId, this.bonus.bonusBalance.toString());\n\n this.step = StepFormEnum.STEP_RESERVE;\n\n } catch (error) {\n const _error: string = error?.response?.data?.message;\n\n if (_error.includes(\"Pin\")) {\n this.error = \"Código inválido!\"\n } else {\n this.error = _error;\n this.step = StepFormEnum.STEP_NO_BONUS;\n }\n\n\n } finally {\n this.loading = false;\n }\n }\n\n public handleCancel() {\n // this.step = StepFormEnum.STEP_PHONE;\n this.cancel()\n }\n\n async cancel() {\n this.message = \"\";\n this.loading = true;\n try {\n await this.crmBonusService.cancel(this.cartId);\n\n localStorage.setItem(USED_KEY, \"dontUse\");\n this.save(0)\n } catch (error) {\n this.message = \"Não consegui cancelar o bônus, tente novamente!\"\n } finally {\n this.loading = false;\n }\n }\n\n public async reserveApply(amount: number) {\n this.loading = true;\n this.message = \"\";\n try {\n await this.reserve(amount);\n this.save(amount);\n\n } catch (error) {\n this.message = \"ocorreu um error ao solicitar a aplicação do bonus! tente novamente\"\n\n this.step = StepFormEnum.STEP_NO_BONUS;\n localStorage.removeItem(this.cartId);\n } finally {\n this.loading = false;\n }\n }\n\n save(amount: number) {\n localStorage.setItem(this.cartId, amount.toString());\n }\n\n public async reserve(amount: number) {\n\n await this.crmBonusService.reserve({\n redeemedBonus: amount,\n cartId: this.cartId,\n ticket: this.cartId,\n grossValue: Number(this.bonus.totalValue),\n storeName: this.storeName,\n storeId: this.bonus.storeId.toString(),\n userId: this.bonus.userId\n });\n }\n\n render() {\n return (\n <div class=\"crm-container-form fbits-responsive-carrinho-desconto\" >\n\n {/* <loading-container /> */}\n\n <label class=\"crm-title\">{this.config.giftbackTitle}</label>\n\n {this.step === StepFormEnum.STEP_PHONE &&\n <phone-form\n value={this.customer.phone}\n config={this.config}\n loading={this.loading}\n handlerSubmit={(phone) => this.handleSendPin(phone)}\n />}\n {\n this.step === StepFormEnum.STEP_PIN &&\n <pin-form\n config={this.config}\n phone={this.phone}\n cancel={() => this.changePhone()}\n resend={() => this.sendPin()}\n validate={(data) => this.validateBonus(data)}\n loading={this.loading}\n >\n {this.sucess && <p class=\"crm-message-info\">{this.sucess}</p>}\n {this.error && <p class=\"crm-message-error\">{this.error}</p>}\n\n </pin-form>\n }\n\n {\n this.step === StepFormEnum.STEP_RESERVE &&\n <giftback-info\n config={this.config}\n loading={this.loading}\n cancel={() => this.handleCancel()}\n bonus={this.bonus}\n reserve={() => this.processBonus()}\n />\n }\n\n {\n this.step === StepFormEnum.STEP_NO_BONUS &&\n (\n <div class=\"container-message\">\n {i18next.t(\"noGiftback\", { storename: this.config.giftbackTitle })}\n </div>\n )\n\n }\n </div>\n )\n }\n}"],"version":3}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-3e84f78c.js';
|
2
|
-
import { C as CrmBonusService } from './p-
|
3
|
-
import { C as CartWake, g as getCart } from './p-
|
2
|
+
import { C as CrmBonusService } from './p-6eda79c3.js';
|
3
|
+
import { C as CartWake, g as getCart } from './p-abbfbc98.js';
|
4
4
|
|
5
5
|
const Pedido = /*@__PURE__*/ proxyCustomElement(class Pedido extends H {
|
6
6
|
constructor() {
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{p as e,b as n}from"./p-3d6152b1.js";export{s as setNonce}from"./p-3d6152b1.js";import{g as a}from"./p-e1255160.js";var o=()=>{const n=import.meta.url;const a={};if(n!==""){a.resourcesUrl=new URL(".",n).href}return e(a)};o().then((async e=>{await a();return n([["p-
|
1
|
+
import{p as e,b as n}from"./p-3d6152b1.js";export{s as setNonce}from"./p-3d6152b1.js";import{g as a}from"./p-e1255160.js";var o=()=>{const n=import.meta.url;const a={};if(n!==""){a.resourcesUrl=new URL(".",n).href}return e(a)};o().then((async e=>{await a();return n([["p-4fa63df0",[[2,"crm-bonus",{cart:[8],showModal:[32],cartWake:[32],customer:[32],loading:[32],message:[32],phone:[32],canCancel:[32],amountCancel:[32],sent:[32],session:[32],loading_reprocess:[32],resetBonus:[64],setloading:[64],reprocess:[64]}]]],["p-c23f3a07",[[1,"crm-bonus-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],sent:[16],stepNext:[2,"step-next"],phone:[2],loadingModal:[4,"loading-modal"],saveStore:[16],cancel:[16],handleCustomerName:[16],loading:[32],step:[32],message:[32],bonus:[32],setStep:[64]}]]],["p-a33f7c24",[[0,"crm-bonus-note",{cart:[8],cartWake:[32],url:[32],config:[32],bonus:[32],showEdit:[32]}]]],["p-74206c91",[[0,"phone-cancel-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-03b77c41",[[0,"phone-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-885fc30e",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-fad20959",[[0,"pedido-finalizado",{cart:[8]}]]],["p-620ec1a3",[[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-be3ddacc",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-90716188",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}],[1,"countdown-timer",{downtime:[16],initialValue:[2,"initial-value"],seconds:[32]}]]],["p-7b7fb354",[[0,"phone-form",{value:[1],loading:[4],handlerSubmit:[16],config:[16]}],[1,"pin-form",{validate:[16],cancel:[16],resend:[16],sent:[16],loading:[4],phone:[1],config:[16],pin:[32],isVerified:[32],canResend:[32]}],[0,"giftback-info",{loading:[4],bonus:[16],reserve:[16],cancel:[16],config:[16],usedValue:[32],selectedOption:[32],sliderPosition:[32],sliderValuePosition:[32],loadingTime:[32]},null,{bonus:["changedBonus"]}],[0,"crm-tooltip",{text:[1],identity:[1]}]]],["p-7cdb2c4a",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],loadProducts:[16],value:[32],loading:[32],message:[32],phone:[32],pinInfo:[32],step:[32],bonus:[32],sucess:[32],error:[32],config:[32],hasApplyBonus:[32],setStep:[64],processBonus:[64]}],[4,"loading-container",{loading:[4]}]]],["p-b7a8f915",[[1,"giftback-pin",{sent:[16],validate:[16],cancel:[16],loading:[4],pin:[32],isVerified:[32]}],[1,"giftback-progress",{loading:[4],bonus:[16],reserve:[16],cancel:[16],usedValue:[32]}],[0,"name-input",{value:[1],loading:[4],applyName:[16],cancel:[16],newValue:[32],message:[32]}],[1,"giftback-finish"]]]],e)}));
|
2
2
|
//# sourceMappingURL=crmbonus-component-wake.esm.js.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{r as t,h as s}from"./p-3d6152b1.js";import{C as i}from"./p-
|
2
|
-
//# sourceMappingURL=p-
|
1
|
+
import{r as t,h as s}from"./p-3d6152b1.js";import{C as i}from"./p-6eda79c3.js";import{S as o}from"./p-7cfea8fe.js";import{i as e}from"./p-e8c19a64.js";import{g as n,C as a}from"./p-abbfbc98.js";import{U as r}from"./p-f9aeffc1.js";var c;(function(t){t["P"]="Promocao"})(c||(c={}));function h(t=[]){const s=[];for(const i of t){let t=l(i.Ajustes);s.push({sku:i.SKU,value:i.PrecoPor*i.Quantidade,productVariantId:i.ProdutoVarianteId.toString(),quantity:i.Quantidade,discount:t*-1})}return s}function l(t=[]){let s=0;for(const i of t){if(i.Tipo===c.P){s+=i.Valor}}return s}const d=".container-button.sc-crm-bonus{cursor:pointer;padding:5px 5px 5px 14px}.section-crm.sc-crm-bonus{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm.sc-crm-bonus{margin-top:10px}.section-cart-crm.sc-crm-bonus p.sc-crm-bonus{padding:0;margin:0px 0px 0px 15px}.button.sc-crm-bonus{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;font-size:20px;cursor:pointer;margin-left:10px;height:70px}.form-container.sc-crm-bonus{width:97%;display:flex;justify-content:space-around}.btn.sc-crm-bonus{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:0px}.form-container.sc-crm-bonus .btnCrm.sc-crm-bonus{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert.sc-crm-bonus{font-family:sans-serif;color:#df4d4d;margin-top:5px}";const u=d;const f=class{constructor(s){t(this,s);this.crmBonusService=i.getInstance();this.cart=undefined;this.showModal=false;this.cartWake=undefined;this.customer={birthDate:"",document:"",name:"",phone:""};this.loading=false;this.message=undefined;this.phone=undefined;this.canCancel=false;this.amountCancel=undefined;this.sent=undefined;this.session=undefined;this.loading_reprocess=false}async resetBonus(){console.log("[START RESET BONUS]!!!!!");try{await this.crmBonusRef.processBonus(this.buildProducts(),true);console.log("[BONUS RESETADO]!!!!!")}catch(t){this.loading=false;console.log("[error ao reprocessar bonous]");await this.crmBonusRef.setStep(o.STEP_PHONE)}finally{this.loading=false}}async setloading(){this.loading_reprocess=!this.loading_reprocess}async reprocess(){this.loading_reprocess=true;try{const t=localStorage.getItem(r);if(!t)return;this.cartWake=await n();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async componentWillLoad(){e.changeLanguage(e.language);await this.handleLoad();await this.loadSession();await this.loadConfigStore()}async loadConfigStore(){await this.crmBonusService.getCustomization(this.cartWake.store.name)}async handleLoad(){try{this.cartWake=this.cart?new a(JSON.parse(this.cart)):await n();if(this.cartWake.user.id){this.customer=await this.crmBonusService.getCustomer(this.cartWake.user.id,this.cartWake.store.name);console.log("customer",this.customer)}const t=localStorage.getItem(this.cartWake.id);if(t){this.canCancel=true;this.amountCancel=t}await this.buildAndGetProducts(this.cartWake.products)}catch(t){console.log("info customer")}}async loadSession(){this.session=await this.crmBonusService.getToken(this.cartWake.store.name);setTimeout((()=>{this.loadSession()}),15e5)}async buildAndGetProducts(t){const s=`bc-products:${this.cartWake.id}`;const i=JSON.stringify(t);localStorage.setItem(s,i);const o=JSON.parse(localStorage.getItem(s));const e=[];for(const s of t){const[t]=o.filter((t=>t.ProdutoVarianteId==s.ProdutoVarianteId));const[i={Valor:0}]=t.Ajustes.filter((t=>t.Tipo==="Formula"));if(t){e.push(Object.assign(Object.assign({},s),{PrecoPor:t.PrecoPor+i.Valor*-1,Quantidade:t.Quantidade,Ajustes:t.Ajustes}))}else{e.push(s)}}this.cartWake.products=e}async sendPin(t){var s,i;this.loading=true;this.message="";try{const s=t.replace(/\D/g,"");this.phone=Number(s);this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.cartWake.store.name);await this.crmBonusRef.setStep(o.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}async sendPinName(t){var s,i;this.loading=true;this.message="";try{this.customer.name=t;this.sent=await this.crmBonusService.sendPin(this.phone,this.customer.name,this.cartWake.store.name);await this.crmBonusRef.setStep(o.STEP_PIN);this.showModal=true}catch(t){this.message=(i=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||i===void 0?void 0:i.message}finally{this.loading=false}}buildProducts(){return h(this.cartWake.products)}handleCloseModal(){this.showModal=false}save(t){localStorage.setItem(this.cartWake.id,t.toString());this.canCancel=true;this.amountCancel=t.toString()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartWake.id);this.canCancel=false;localStorage.removeItem(this.cartWake.id)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async handleSendPin(t){this.message="";if(!t){this.message="Informe seu telefone";return}this.customer.phone=t;const s=t.replace(/\D/g,"");this.phone=Number(s);if(this.customer.name){return this.sendPin(t)}await this.crmBonusRef.setStep(o.STEP_NAME);this.showModal=true}render(){return s("loading-container",{key:"6b39082e04d7cdcc88f689912b267e6bee379452",loading:this.loading_reprocess},s("crm-giftback-form",{key:"9cb2b61470810eb3de370f2ab9fb3b50d59bff81",style:{position:"relative"},ref:t=>this.crmBonusRef=t,storeName:this.cartWake.store.name,products:this.buildProducts(),cartId:this.cartWake.id,customer:this.customer,loadProducts:()=>this.buildProducts()}))}static get assetsDirs(){return["assets"]}};f.style=u;export{f as crm_bonus};
|
2
|
+
//# sourceMappingURL=p-4fa63df0.entry.js.map
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import{U as t,g as e,B as n,a as o}from"./p-f9aeffc1.js";function r(t,e){return function n(){return t.apply(e,arguments)}}const{toString:s}=Object.prototype;const{getPrototypeOf:i}=Object;const c=(t=>e=>{const n=s.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null));const u=t=>{t=t.toLowerCase();return e=>c(e)===t};const a=t=>e=>typeof e===t;const{isArray:l}=Array;const f=a("undefined");function d(t){return t!==null&&!f(t)&&t.constructor!==null&&!f(t.constructor)&&w(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const h=u("ArrayBuffer");function p(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&h(t.buffer)}return e}const m=a("string");const w=a("function");const y=a("number");const b=t=>t!==null&&typeof t==="object";const g=t=>t===true||t===false;const R=t=>{if(c(t)!=="object"){return false}const e=i(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};const O=u("Date");const S=u("File");const E=u("Blob");const T=u("FileList");const A=t=>b(t)&&w(t.pipe);const j=t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||w(t.append)&&((e=c(t))==="formdata"||e==="object"&&w(t.toString)&&t.toString()==="[object FormData]"))};const N=u("URLSearchParams");const[x,v,C,P]=["ReadableStream","Request","Response","Headers"].map(u);const B=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F(t,e,{allOwnKeys:n=false}={}){if(t===null||typeof t==="undefined"){return}let o;let r;if(typeof t!=="object"){t=[t]}if(l(t)){for(o=0,r=t.length;o<r;o++){e.call(null,t[o],o,t)}}else{const r=n?Object.getOwnPropertyNames(t):Object.keys(t);const s=r.length;let i;for(o=0;o<s;o++){i=r[o];e.call(null,t[i],i,t)}}}function D(t,e){e=e.toLowerCase();const n=Object.keys(t);let o=n.length;let r;while(o-- >0){r=n[o];if(e===r.toLowerCase()){return r}}return null}const U=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();const _=t=>!f(t)&&t!==U;function k(){const{caseless:t}=_(this)&&this||{};const e={};const n=(n,o)=>{const r=t&&D(e,o)||o;if(R(e[r])&&R(n)){e[r]=k(e[r],n)}else if(R(n)){e[r]=k({},n)}else if(l(n)){e[r]=n.slice()}else{e[r]=n}};for(let t=0,e=arguments.length;t<e;t++){arguments[t]&&F(arguments[t],n)}return e}const q=(t,e,n,{allOwnKeys:o}={})=>{F(e,((e,o)=>{if(n&&w(e)){t[o]=r(e,n)}else{t[o]=e}}),{allOwnKeys:o});return t};const L=t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t};const I=(t,e,n,o)=>{t.prototype=Object.create(e.prototype,o);t.prototype.constructor=t;Object.defineProperty(t,"super",{value:e.prototype});n&&Object.assign(t.prototype,n)};const z=(t,e,n,o)=>{let r;let s;let c;const u={};e=e||{};if(t==null)return e;do{r=Object.getOwnPropertyNames(t);s=r.length;while(s-- >0){c=r[s];if((!o||o(c,t,e))&&!u[c]){e[c]=t[c];u[c]=true}}t=n!==false&&i(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e};const $=(t,e,n)=>{t=String(t);if(n===undefined||n>t.length){n=t.length}n-=e.length;const o=t.indexOf(e,n);return o!==-1&&o===n};const M=t=>{if(!t)return null;if(l(t))return t;let e=t.length;if(!y(e))return null;const n=new Array(e);while(e-- >0){n[e]=t[e]}return n};const H=(t=>e=>t&&e instanceof t)(typeof Uint8Array!=="undefined"&&i(Uint8Array));const J=(t,e)=>{const n=t&&t[Symbol.iterator];const o=n.call(t);let r;while((r=o.next())&&!r.done){const n=r.value;e.call(t,n[0],n[1])}};const K=(t,e)=>{let n;const o=[];while((n=t.exec(e))!==null){o.push(n)}return o};const V=u("HTMLFormElement");const W=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function t(e,n,o){return n.toUpperCase()+o}));const G=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype);const X=u("RegExp");const Y=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t);const o={};F(n,((n,r)=>{let s;if((s=e(n,r,t))!==false){o[r]=s||n}}));Object.defineProperties(t,o)};const Z=t=>{Y(t,((e,n)=>{if(w(t)&&["arguments","caller","callee"].indexOf(n)!==-1){return false}const o=t[n];if(!w(o))return;e.enumerable=false;if("writable"in e){e.writable=false;return}if(!e.set){e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}}}))};const Q=(t,e)=>{const n={};const o=t=>{t.forEach((t=>{n[t]=true}))};l(t)?o(t):o(String(t).split(e));return n};const tt=()=>{};const et=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;const nt="abcdefghijklmnopqrstuvwxyz";const ot="0123456789";const rt={DIGIT:ot,ALPHA:nt,ALPHA_DIGIT:nt+nt.toUpperCase()+ot};const st=(t=16,e=rt.ALPHA_DIGIT)=>{let n="";const{length:o}=e;while(t--){n+=e[Math.random()*o|0]}return n};function it(t){return!!(t&&w(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const ct=t=>{const e=new Array(10);const n=(t,o)=>{if(b(t)){if(e.indexOf(t)>=0){return}if(!("toJSON"in t)){e[o]=t;const r=l(t)?[]:{};F(t,((t,e)=>{const s=n(t,o+1);!f(s)&&(r[e]=s)}));e[o]=undefined;return r}}return t};return n(t,0)};const ut=u("AsyncFunction");const at=t=>t&&(b(t)||w(t))&&w(t.then)&&w(t.catch);const lt=((t,e)=>{if(t){return setImmediate}return e?((t,e)=>{U.addEventListener("message",(({source:n,data:o})=>{if(n===U&&o===t){e.length&&e.shift()()}}),false);return n=>{e.push(n);U.postMessage(t,"*")}})(`axios@${Math.random()}`,[]):t=>setTimeout(t)})(typeof setImmediate==="function",w(U.postMessage));const ft=typeof queueMicrotask!=="undefined"?queueMicrotask.bind(U):typeof process!=="undefined"&&process.nextTick||lt;const dt={isArray:l,isArrayBuffer:h,isBuffer:d,isFormData:j,isArrayBufferView:p,isString:m,isNumber:y,isBoolean:g,isObject:b,isPlainObject:R,isReadableStream:x,isRequest:v,isResponse:C,isHeaders:P,isUndefined:f,isDate:O,isFile:S,isBlob:E,isRegExp:X,isFunction:w,isStream:A,isURLSearchParams:N,isTypedArray:H,isFileList:T,forEach:F,merge:k,extend:q,trim:B,stripBOM:L,inherits:I,toFlatObject:z,kindOf:c,kindOfTest:u,endsWith:$,toArray:M,forEachEntry:J,matchAll:K,isHTMLForm:V,hasOwnProperty:G,hasOwnProp:G,reduceDescriptors:Y,freezeMethods:Z,toObjectSet:Q,toCamelCase:W,noop:tt,toFiniteNumber:et,findKey:D,global:U,isContextDefined:_,ALPHABET:rt,generateString:st,isSpecCompliantForm:it,toJSONObject:ct,isAsyncFn:ut,isThenable:at,setImmediate:lt,asap:ft};function ht(t,e,n,o,r){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=(new Error).stack}this.message=t;this.name="AxiosError";e&&(this.code=e);n&&(this.config=n);o&&(this.request=o);if(r){this.response=r;this.status=r.status?r.status:null}}dt.inherits(ht,Error,{toJSON:function t(){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:dt.toJSONObject(this.config),code:this.code,status:this.status}}});const pt=ht.prototype;const mt={};["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((t=>{mt[t]={value:t}}));Object.defineProperties(ht,mt);Object.defineProperty(pt,"isAxiosError",{value:true});ht.from=(t,e,n,o,r,s)=>{const i=Object.create(pt);dt.toFlatObject(t,i,(function t(e){return e!==Error.prototype}),(t=>t!=="isAxiosError"));ht.call(i,t.message,e,n,o,r);i.cause=t;i.name=t.name;s&&Object.assign(i,s);return i};const wt=null;function yt(t){return dt.isPlainObject(t)||dt.isArray(t)}function bt(t){return dt.endsWith(t,"[]")?t.slice(0,-2):t}function gt(t,e,n){if(!t)return e;return t.concat(e).map((function t(e,o){e=bt(e);return!n&&o?"["+e+"]":e})).join(n?".":"")}function Rt(t){return dt.isArray(t)&&!t.some(yt)}const Ot=dt.toFlatObject(dt,{},null,(function t(e){return/^is[A-Z]/.test(e)}));function St(t,e,n){if(!dt.isObject(t)){throw new TypeError("target must be an object")}e=e||new FormData;n=dt.toFlatObject(n,{metaTokens:true,dots:false,indexes:false},false,(function t(e,n){return!dt.isUndefined(n[e])}));const o=n.metaTokens;const r=n.visitor||l;const s=n.dots;const i=n.indexes;const c=n.Blob||typeof Blob!=="undefined"&&Blob;const u=c&&dt.isSpecCompliantForm(e);if(!dt.isFunction(r)){throw new TypeError("visitor must be a function")}function a(t){if(t===null)return"";if(dt.isDate(t)){return t.toISOString()}if(!u&&dt.isBlob(t)){throw new ht("Blob is not supported. Use a Buffer instead.")}if(dt.isArrayBuffer(t)||dt.isTypedArray(t)){return u&&typeof Blob==="function"?new Blob([t]):Buffer.from(t)}return t}function l(t,n,r){let c=t;if(t&&!r&&typeof t==="object"){if(dt.endsWith(n,"{}")){n=o?n:n.slice(0,-2);t=JSON.stringify(t)}else if(dt.isArray(t)&&Rt(t)||(dt.isFileList(t)||dt.endsWith(n,"[]"))&&(c=dt.toArray(t))){n=bt(n);c.forEach((function t(o,r){!(dt.isUndefined(o)||o===null)&&e.append(i===true?gt([n],r,s):i===null?n:n+"[]",a(o))}));return false}}if(yt(t)){return true}e.append(gt(r,n,s),a(t));return false}const f=[];const d=Object.assign(Ot,{defaultVisitor:l,convertValue:a,isVisitable:yt});function h(t,n){if(dt.isUndefined(t))return;if(f.indexOf(t)!==-1){throw Error("Circular reference detected in "+n.join("."))}f.push(t);dt.forEach(t,(function t(o,s){const i=!(dt.isUndefined(o)||o===null)&&r.call(e,o,dt.isString(s)?s.trim():s,n,d);if(i===true){h(o,n?n.concat(s):[s])}}));f.pop()}if(!dt.isObject(t)){throw new TypeError("data must be an object")}h(t);return e}function Et(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function t(n){return e[n]}))}function Tt(t,e){this._pairs=[];t&&St(t,this,e)}const At=Tt.prototype;At.append=function t(e,n){this._pairs.push([e,n])};At.toString=function t(e){const n=e?function(t){return e.call(this,t,Et)}:Et;return this._pairs.map((function t(e){return n(e[0])+"="+n(e[1])}),"").join("&")};function jt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Nt(t,e,n){if(!e){return t}const o=n&&n.encode||jt;const r=n&&n.serialize;let s;if(r){s=r(e,n)}else{s=dt.isURLSearchParams(e)?e.toString():new Tt(e,n).toString(o)}if(s){const e=t.indexOf("#");if(e!==-1){t=t.slice(0,e)}t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class xt{constructor(){this.handlers=[]}use(t,e,n){this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1}eject(t){if(this.handlers[t]){this.handlers[t]=null}}clear(){if(this.handlers){this.handlers=[]}}forEach(t){dt.forEach(this.handlers,(function e(n){if(n!==null){t(n)}}))}}const vt=xt;const Ct={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};const Pt=typeof URLSearchParams!=="undefined"?URLSearchParams:Tt;const Bt=typeof FormData!=="undefined"?FormData:null;const Ft=typeof Blob!=="undefined"?Blob:null;const Dt={isBrowser:true,classes:{URLSearchParams:Pt,FormData:Bt,Blob:Ft},protocols:["http","https","file","blob","url","data"]};const Ut=typeof window!=="undefined"&&typeof document!=="undefined";const _t=typeof navigator==="object"&&navigator||undefined;const kt=Ut&&(!_t||["ReactNative","NativeScript","NS"].indexOf(_t.product)<0);const qt=(()=>typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function")();const Lt=Ut&&window.location.href||"http://localhost";const It=Object.freeze({__proto__:null,hasBrowserEnv:Ut,hasStandardBrowserWebWorkerEnv:qt,hasStandardBrowserEnv:kt,navigator:_t,origin:Lt});const zt={...It,...Dt};function $t(t,e){return St(t,new zt.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,o){if(zt.isNode&&dt.isBuffer(t)){this.append(e,t.toString("base64"));return false}return o.defaultVisitor.apply(this,arguments)}},e))}function Mt(t){return dt.matchAll(/\w+|\[(\w*)]/g,t).map((t=>t[0]==="[]"?"":t[1]||t[0]))}function Ht(t){const e={};const n=Object.keys(t);let o;const r=n.length;let s;for(o=0;o<r;o++){s=n[o];e[s]=t[s]}return e}function Jt(t){function e(t,n,o,r){let s=t[r++];if(s==="__proto__")return true;const i=Number.isFinite(+s);const c=r>=t.length;s=!s&&dt.isArray(o)?o.length:s;if(c){if(dt.hasOwnProp(o,s)){o[s]=[o[s],n]}else{o[s]=n}return!i}if(!o[s]||!dt.isObject(o[s])){o[s]=[]}const u=e(t,n,o[s],r);if(u&&dt.isArray(o[s])){o[s]=Ht(o[s])}return!i}if(dt.isFormData(t)&&dt.isFunction(t.entries)){const n={};dt.forEachEntry(t,((t,o)=>{e(Mt(t),o,n,0)}));return n}return null}function Kt(t,e,n){if(dt.isString(t)){try{(e||JSON.parse)(t);return dt.trim(t)}catch(t){if(t.name!=="SyntaxError"){throw t}}}return(n||JSON.stringify)(t)}const Vt={transitional:Ct,adapter:["xhr","http","fetch"],transformRequest:[function t(e,n){const o=n.getContentType()||"";const r=o.indexOf("application/json")>-1;const s=dt.isObject(e);if(s&&dt.isHTMLForm(e)){e=new FormData(e)}const i=dt.isFormData(e);if(i){return r?JSON.stringify(Jt(e)):e}if(dt.isArrayBuffer(e)||dt.isBuffer(e)||dt.isStream(e)||dt.isFile(e)||dt.isBlob(e)||dt.isReadableStream(e)){return e}if(dt.isArrayBufferView(e)){return e.buffer}if(dt.isURLSearchParams(e)){n.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return e.toString()}let c;if(s){if(o.indexOf("application/x-www-form-urlencoded")>-1){return $t(e,this.formSerializer).toString()}if((c=dt.isFileList(e))||o.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return St(c?{"files[]":e}:e,t&&new t,this.formSerializer)}}if(s||r){n.setContentType("application/json",false);return Kt(e)}return e}],transformResponse:[function t(e){const n=this.transitional||Vt.transitional;const o=n&&n.forcedJSONParsing;const r=this.responseType==="json";if(dt.isResponse(e)||dt.isReadableStream(e)){return e}if(e&&dt.isString(e)&&(o&&!this.responseType||r)){const t=n&&n.silentJSONParsing;const o=!t&&r;try{return JSON.parse(e)}catch(t){if(o){if(t.name==="SyntaxError"){throw ht.from(t,ht.ERR_BAD_RESPONSE,this,null,this.response)}throw t}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:zt.classes.FormData,Blob:zt.classes.Blob},validateStatus:function t(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":undefined}}};dt.forEach(["delete","get","head","post","put","patch"],(t=>{Vt.headers[t]={}}));const Wt=Vt;const Gt=dt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Xt=t=>{const e={};let n;let o;let r;t&&t.split("\n").forEach((function t(s){r=s.indexOf(":");n=s.substring(0,r).trim().toLowerCase();o=s.substring(r+1).trim();if(!n||e[n]&&Gt[n]){return}if(n==="set-cookie"){if(e[n]){e[n].push(o)}else{e[n]=[o]}}else{e[n]=e[n]?e[n]+", "+o:o}}));return e};const Yt=Symbol("internals");function Zt(t){return t&&String(t).trim().toLowerCase()}function Qt(t){if(t===false||t==null){return t}return dt.isArray(t)?t.map(Qt):String(t)}function te(t){const e=Object.create(null);const n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let o;while(o=n.exec(t)){e[o[1]]=o[2]}return e}const ee=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ne(t,e,n,o,r){if(dt.isFunction(o)){return o.call(this,e,n)}if(r){e=n}if(!dt.isString(e))return;if(dt.isString(o)){return e.indexOf(o)!==-1}if(dt.isRegExp(o)){return o.test(e)}}function oe(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}function re(t,e){const n=dt.toCamelCase(" "+e);["get","set","has"].forEach((o=>{Object.defineProperty(t,o+n,{value:function(t,n,r){return this[o].call(this,e,t,n,r)},configurable:true})}))}class se{constructor(t){t&&this.set(t)}set(t,e,n){const o=this;function r(t,e,n){const r=Zt(e);if(!r){throw new Error("header name must be a non-empty string")}const s=dt.findKey(o,r);if(!s||o[s]===undefined||n===true||n===undefined&&o[s]!==false){o[s||e]=Qt(t)}}const s=(t,e)=>dt.forEach(t,((t,n)=>r(t,n,e)));if(dt.isPlainObject(t)||t instanceof this.constructor){s(t,e)}else if(dt.isString(t)&&(t=t.trim())&&!ee(t)){s(Xt(t),e)}else if(dt.isHeaders(t)){for(const[e,o]of t.entries()){r(o,e,n)}}else{t!=null&&r(e,t,n)}return this}get(t,e){t=Zt(t);if(t){const n=dt.findKey(this,t);if(n){const t=this[n];if(!e){return t}if(e===true){return te(t)}if(dt.isFunction(e)){return e.call(this,t,n)}if(dt.isRegExp(e)){return e.exec(t)}throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){t=Zt(t);if(t){const n=dt.findKey(this,t);return!!(n&&this[n]!==undefined&&(!e||ne(this,this[n],n,e)))}return false}delete(t,e){const n=this;let o=false;function r(t){t=Zt(t);if(t){const r=dt.findKey(n,t);if(r&&(!e||ne(n,n[r],r,e))){delete n[r];o=true}}}if(dt.isArray(t)){t.forEach(r)}else{r(t)}return o}clear(t){const e=Object.keys(this);let n=e.length;let o=false;while(n--){const r=e[n];if(!t||ne(this,this[r],r,t,true)){delete this[r];o=true}}return o}normalize(t){const e=this;const n={};dt.forEach(this,((o,r)=>{const s=dt.findKey(n,r);if(s){e[s]=Qt(o);delete e[r];return}const i=t?oe(r):String(r).trim();if(i!==r){delete e[r]}e[i]=Qt(o);n[i]=true}));return this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);dt.forEach(this,((n,o)=>{n!=null&&n!==false&&(e[o]=t&&dt.isArray(n)?n.join(", "):n)}));return e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);e.forEach((t=>n.set(t)));return n}static accessor(t){const e=this[Yt]=this[Yt]={accessors:{}};const n=e.accessors;const o=this.prototype;function r(t){const e=Zt(t);if(!n[e]){re(o,t);n[e]=true}}dt.isArray(t)?t.forEach(r):r(t);return this}}se.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);dt.reduceDescriptors(se.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}}));dt.freezeMethods(se);const ie=se;function ce(t,e){const n=this||Wt;const o=e||n;const r=ie.from(o.headers);let s=o.data;dt.forEach(t,(function t(o){s=o.call(n,s,r.normalize(),e?e.status:undefined)}));r.normalize();return s}function ue(t){return!!(t&&t.__CANCEL__)}function ae(t,e,n){ht.call(this,t==null?"canceled":t,ht.ERR_CANCELED,e,n);this.name="CanceledError"}dt.inherits(ae,ht,{__CANCEL__:true});function le(t,e,n){const o=n.config.validateStatus;if(!n.status||!o||o(n.status)){t(n)}else{e(new ht("Request failed with status code "+n.status,[ht.ERR_BAD_REQUEST,ht.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}}function fe(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function de(t,e){t=t||10;const n=new Array(t);const o=new Array(t);let r=0;let s=0;let i;e=e!==undefined?e:1e3;return function c(u){const a=Date.now();const l=o[s];if(!i){i=a}n[r]=u;o[r]=a;let f=s;let d=0;while(f!==r){d+=n[f++];f=f%t}r=(r+1)%t;if(r===s){s=(s+1)%t}if(a-i<e){return}const h=l&&a-l;return h?Math.round(d*1e3/h):undefined}}function he(t,e){let n=0;let o=1e3/e;let r;let s;const i=(e,o=Date.now())=>{n=o;r=null;if(s){clearTimeout(s);s=null}t.apply(null,e)};const c=(...t)=>{const e=Date.now();const c=e-n;if(c>=o){i(t,e)}else{r=t;if(!s){s=setTimeout((()=>{s=null;i(r)}),o-c)}}};const u=()=>r&&i(r);return[c,u]}const pe=(t,e,n=3)=>{let o=0;const r=de(50,250);return he((n=>{const s=n.loaded;const i=n.lengthComputable?n.total:undefined;const c=s-o;const u=r(c);const a=s<=i;o=s;const l={loaded:s,total:i,progress:i?s/i:undefined,bytes:c,rate:u?u:undefined,estimated:u&&i&&a?(i-s)/u:undefined,event:n,lengthComputable:i!=null,[e?"download":"upload"]:true};t(l)}),n)};const me=(t,e)=>{const n=t!=null;return[o=>e[0]({lengthComputable:n,total:t,loaded:o}),e[1]]};const we=t=>(...e)=>dt.asap((()=>t(...e)));const ye=zt.hasStandardBrowserEnv?function t(){const e=zt.navigator&&/(msie|trident)/i.test(zt.navigator.userAgent);const n=document.createElement("a");let o;function r(t){let o=t;if(e){n.setAttribute("href",o);o=n.href}n.setAttribute("href",o);return{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}o=r(window.location.href);return function t(e){const n=dt.isString(e)?r(e):e;return n.protocol===o.protocol&&n.host===o.host}}():function t(){return function t(){return true}}();const be=zt.hasStandardBrowserEnv?{write(t,e,n,o,r,s){const i=[t+"="+encodeURIComponent(e)];dt.isNumber(n)&&i.push("expires="+new Date(n).toGMTString());dt.isString(o)&&i.push("path="+o);dt.isString(r)&&i.push("domain="+r);s===true&&i.push("secure");document.cookie=i.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ge(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Re(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Oe(t,e){if(t&&!ge(e)){return Re(t,e)}return e}const Se=t=>t instanceof ie?{...t}:t;function Ee(t,e){e=e||{};const n={};function o(t,e,n){if(dt.isPlainObject(t)&&dt.isPlainObject(e)){return dt.merge.call({caseless:n},t,e)}else if(dt.isPlainObject(e)){return dt.merge({},e)}else if(dt.isArray(e)){return e.slice()}return e}function r(t,e,n){if(!dt.isUndefined(e)){return o(t,e,n)}else if(!dt.isUndefined(t)){return o(undefined,t,n)}}function s(t,e){if(!dt.isUndefined(e)){return o(undefined,e)}}function i(t,e){if(!dt.isUndefined(e)){return o(undefined,e)}else if(!dt.isUndefined(t)){return o(undefined,t)}}function c(n,r,s){if(s in e){return o(n,r)}else if(s in t){return o(undefined,n)}}const u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(t,e)=>r(Se(t),Se(e),true)};dt.forEach(Object.keys(Object.assign({},t,e)),(function o(s){const i=u[s]||r;const a=i(t[s],e[s],s);dt.isUndefined(a)&&i!==c||(n[s]=a)}));return n}const Te=t=>{const e=Ee({},t);let{data:n,withXSRFToken:o,xsrfHeaderName:r,xsrfCookieName:s,headers:i,auth:c}=e;e.headers=i=ie.from(i);e.url=Nt(Oe(e.baseURL,e.url),t.params,t.paramsSerializer);if(c){i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")))}let u;if(dt.isFormData(n)){if(zt.hasStandardBrowserEnv||zt.hasStandardBrowserWebWorkerEnv){i.setContentType(undefined)}else if((u=i.getContentType())!==false){const[t,...e]=u?u.split(";").map((t=>t.trim())).filter(Boolean):[];i.setContentType([t||"multipart/form-data",...e].join("; "))}}if(zt.hasStandardBrowserEnv){o&&dt.isFunction(o)&&(o=o(e));if(o||o!==false&&ye(e.url)){const t=r&&s&&be.read(s);if(t){i.set(r,t)}}}return e};const Ae=typeof XMLHttpRequest!=="undefined";const je=Ae&&function(t){return new Promise((function e(n,o){const r=Te(t);let s=r.data;const i=ie.from(r.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:a}=r;let l;let f,d;let h,p;function m(){h&&h();p&&p();r.cancelToken&&r.cancelToken.unsubscribe(l);r.signal&&r.signal.removeEventListener("abort",l)}let w=new XMLHttpRequest;w.open(r.method.toUpperCase(),r.url,true);w.timeout=r.timeout;function y(){if(!w){return}const e=ie.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders());const r=!c||c==="text"||c==="json"?w.responseText:w.response;const s={data:r,status:w.status,statusText:w.statusText,headers:e,config:t,request:w};le((function t(e){n(e);m()}),(function t(e){o(e);m()}),s);w=null}if("onloadend"in w){w.onloadend=y}else{w.onreadystatechange=function t(){if(!w||w.readyState!==4){return}if(w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)){return}setTimeout(y)}}w.onabort=function e(){if(!w){return}o(new ht("Request aborted",ht.ECONNABORTED,t,w));w=null};w.onerror=function e(){o(new ht("Network Error",ht.ERR_NETWORK,t,w));w=null};w.ontimeout=function e(){let n=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||Ct;if(r.timeoutErrorMessage){n=r.timeoutErrorMessage}o(new ht(n,s.clarifyTimeoutError?ht.ETIMEDOUT:ht.ECONNABORTED,t,w));w=null};s===undefined&&i.setContentType(null);if("setRequestHeader"in w){dt.forEach(i.toJSON(),(function t(e,n){w.setRequestHeader(n,e)}))}if(!dt.isUndefined(r.withCredentials)){w.withCredentials=!!r.withCredentials}if(c&&c!=="json"){w.responseType=r.responseType}if(a){[d,p]=pe(a,true);w.addEventListener("progress",d)}if(u&&w.upload){[f,h]=pe(u);w.upload.addEventListener("progress",f);w.upload.addEventListener("loadend",h)}if(r.cancelToken||r.signal){l=e=>{if(!w){return}o(!e||e.type?new ae(null,t,w):e);w.abort();w=null};r.cancelToken&&r.cancelToken.subscribe(l);if(r.signal){r.signal.aborted?l():r.signal.addEventListener("abort",l)}}const b=fe(r.url);if(b&&zt.protocols.indexOf(b)===-1){o(new ht("Unsupported protocol "+b+":",ht.ERR_BAD_REQUEST,t));return}w.send(s||null)}))};const Ne=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n=new AbortController;let o;const r=function(t){if(!o){o=true;i();const e=t instanceof Error?t:this.reason;n.abort(e instanceof ht?e:new ae(e instanceof Error?e.message:e))}};let s=e&&setTimeout((()=>{s=null;r(new ht(`timeout ${e} of ms exceeded`,ht.ETIMEDOUT))}),e);const i=()=>{if(t){s&&clearTimeout(s);s=null;t.forEach((t=>{t.unsubscribe?t.unsubscribe(r):t.removeEventListener("abort",r)}));t=null}};t.forEach((t=>t.addEventListener("abort",r)));const{signal:c}=n;c.unsubscribe=()=>dt.asap(i);return c}};const xe=Ne;const ve=function*(t,e){let n=t.byteLength;if(!e||n<e){yield t;return}let o=0;let r;while(o<n){r=o+e;yield t.slice(o,r);o=r}};const Ce=async function*(t,e){for await(const n of Pe(t)){yield*ve(n,e)}};const Pe=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t){break}yield n}}finally{await e.cancel()}};const Be=(t,e,n,o)=>{const r=Ce(t,e);let s=0;let i;let c=t=>{if(!i){i=true;o&&o(t)}};return new ReadableStream({async pull(t){try{const{done:e,value:o}=await r.next();if(e){c();t.close();return}let i=o.byteLength;if(n){let t=s+=i;n(t)}t.enqueue(new Uint8Array(o))}catch(t){c(t);throw t}},cancel(t){c(t);return r.return()}},{highWaterMark:2})};const Fe=typeof fetch==="function"&&typeof Request==="function"&&typeof Response==="function";const De=Fe&&typeof ReadableStream==="function";const Ue=Fe&&(typeof TextEncoder==="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer()));const _e=(t,...e)=>{try{return!!t(...e)}catch(t){return false}};const ke=De&&_e((()=>{let t=false;const e=new Request(zt.origin,{body:new ReadableStream,method:"POST",get duplex(){t=true;return"half"}}).headers.has("Content-Type");return t&&!e}));const qe=64*1024;const Le=De&&_e((()=>dt.isReadableStream(new Response("").body)));const Ie={stream:Le&&(t=>t.body)};Fe&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Ie[e]&&(Ie[e]=dt.isFunction(t[e])?t=>t[e]():(t,n)=>{throw new ht(`Response type '${e}' is not supported`,ht.ERR_NOT_SUPPORT,n)})}))})(new Response);const ze=async t=>{if(t==null){return 0}if(dt.isBlob(t)){return t.size}if(dt.isSpecCompliantForm(t)){const e=new Request(zt.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}if(dt.isArrayBufferView(t)||dt.isArrayBuffer(t)){return t.byteLength}if(dt.isURLSearchParams(t)){t=t+""}if(dt.isString(t)){return(await Ue(t)).byteLength}};const $e=async(t,e)=>{const n=dt.toFiniteNumber(t.getContentLength());return n==null?ze(e):n};const Me=Fe&&(async t=>{let{url:e,method:n,data:o,signal:r,cancelToken:s,timeout:i,onDownloadProgress:c,onUploadProgress:u,responseType:a,headers:l,withCredentials:f="same-origin",fetchOptions:d}=Te(t);a=a?(a+"").toLowerCase():"text";let h=xe([r,s&&s.toAbortSignal()],i);let p;const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let w;try{if(u&&ke&&n!=="get"&&n!=="head"&&(w=await $e(l,o))!==0){let t=new Request(e,{method:"POST",body:o,duplex:"half"});let n;if(dt.isFormData(o)&&(n=t.headers.get("content-type"))){l.setContentType(n)}if(t.body){const[e,n]=me(w,pe(we(u)));o=Be(t.body,qe,e,n)}}if(!dt.isString(f)){f=f?"include":"omit"}const r="credentials"in Request.prototype;p=new Request(e,{...d,signal:h,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:o,duplex:"half",credentials:r?f:undefined});let s=await fetch(p);const i=Le&&(a==="stream"||a==="response");if(Le&&(c||i&&m)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=s[e]}));const e=dt.toFiniteNumber(s.headers.get("content-length"));const[n,o]=c&&me(e,pe(we(c),true))||[];s=new Response(Be(s.body,qe,n,(()=>{o&&o();m&&m()})),t)}a=a||"text";let y=await Ie[dt.findKey(Ie,a)||"text"](s,t);!i&&m&&m();return await new Promise(((e,n)=>{le(e,n,{data:y,headers:ie.from(s.headers),status:s.status,statusText:s.statusText,config:t,request:p})}))}catch(e){m&&m();if(e&&e.name==="TypeError"&&/fetch/i.test(e.message)){throw Object.assign(new ht("Network Error",ht.ERR_NETWORK,t,p),{cause:e.cause||e})}throw ht.from(e,e&&e.code,t,p)}});const He={http:wt,xhr:je,fetch:Me};dt.forEach(He,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const Je=t=>`- ${t}`;const Ke=t=>dt.isFunction(t)||t===null||t===false;const Ve={getAdapter:t=>{t=dt.isArray(t)?t:[t];const{length:e}=t;let n;let o;const r={};for(let s=0;s<e;s++){n=t[s];let e;o=n;if(!Ke(n)){o=He[(e=String(n)).toLowerCase()];if(o===undefined){throw new ht(`Unknown adapter '${e}'`)}}if(o){break}r[e||"#"+s]=o}if(!o){const t=Object.entries(r).map((([t,e])=>`adapter ${t} `+(e===false?"is not supported by the environment":"is not available in the build")));let n=e?t.length>1?"since :\n"+t.map(Je).join("\n"):" "+Je(t[0]):"as no adapter specified";throw new ht(`There is no suitable adapter to dispatch the request `+n,"ERR_NOT_SUPPORT")}return o},adapters:He};function We(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new ae(null,t)}}function Ge(t){We(t);t.headers=ie.from(t.headers);t.data=ce.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=Ve.getAdapter(t.adapter||Wt.adapter);return e(t).then((function e(n){We(t);n.data=ce.call(t,t.transformResponse,n);n.headers=ie.from(n.headers);return n}),(function e(n){if(!ue(n)){We(t);if(n&&n.response){n.response.data=ce.call(t,t.transformResponse,n.response);n.response.headers=ie.from(n.response.headers)}}return Promise.reject(n)}))}const Xe="1.7.7";const Ye={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Ye[t]=function n(o){return typeof o===t||"a"+(e<1?"n ":" ")+t}}));const Ze={};Ye.transitional=function t(e,n,o){function r(t,e){return"[Axios v"+Xe+"] Transitional option '"+t+"'"+e+(o?". "+o:"")}return(t,o,s)=>{if(e===false){throw new ht(r(o," has been removed"+(n?" in "+n:"")),ht.ERR_DEPRECATED)}if(n&&!Ze[o]){Ze[o]=true;console.warn(r(o," has been deprecated since v"+n+" and will be removed in the near future"))}return e?e(t,o,s):true}};function Qe(t,e,n){if(typeof t!=="object"){throw new ht("options must be an object",ht.ERR_BAD_OPTION_VALUE)}const o=Object.keys(t);let r=o.length;while(r-- >0){const s=o[r];const i=e[s];if(i){const e=t[s];const n=e===undefined||i(e,s,t);if(n!==true){throw new ht("option "+s+" must be "+n,ht.ERR_BAD_OPTION_VALUE)}continue}if(n!==true){throw new ht("Unknown option "+s,ht.ERR_BAD_OPTION)}}}const tn={assertOptions:Qe,validators:Ye};const en=tn.validators;class nn{constructor(t){this.defaults=t;this.interceptors={request:new vt,response:new vt}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e;Error.captureStackTrace?Error.captureStackTrace(e={}):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{if(!t.stack){t.stack=n}else if(n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))){t.stack+="\n"+n}}catch(t){}}throw t}}_request(t,e){if(typeof t==="string"){e=e||{};e.url=t}else{e=t||{}}e=Ee(this.defaults,e);const{transitional:n,paramsSerializer:o,headers:r}=e;if(n!==undefined){tn.assertOptions(n,{silentJSONParsing:en.transitional(en.boolean),forcedJSONParsing:en.transitional(en.boolean),clarifyTimeoutError:en.transitional(en.boolean)},false)}if(o!=null){if(dt.isFunction(o)){e.paramsSerializer={serialize:o}}else{tn.assertOptions(o,{encode:en.function,serialize:en.function},true)}}e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=r&&dt.merge(r.common,r[e.method]);r&&dt.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete r[t]}));e.headers=ie.concat(s,r);const i=[];let c=true;this.interceptors.request.forEach((function t(n){if(typeof n.runWhen==="function"&&n.runWhen(e)===false){return}c=c&&n.synchronous;i.unshift(n.fulfilled,n.rejected)}));const u=[];this.interceptors.response.forEach((function t(e){u.push(e.fulfilled,e.rejected)}));let a;let l=0;let f;if(!c){const t=[Ge.bind(this),undefined];t.unshift.apply(t,i);t.push.apply(t,u);f=t.length;a=Promise.resolve(e);while(l<f){a=a.then(t[l++],t[l++])}return a}f=i.length;let d=e;l=0;while(l<f){const t=i[l++];const e=i[l++];try{d=t(d)}catch(t){e.call(this,t);break}}try{a=Ge.call(this,d)}catch(t){return Promise.reject(t)}l=0;f=u.length;while(l<f){a=a.then(u[l++],u[l++])}return a}getUri(t){t=Ee(this.defaults,t);const e=Oe(t.baseURL,t.url);return Nt(e,t.params,t.paramsSerializer)}}dt.forEach(["delete","get","head","options"],(function t(e){nn.prototype[e]=function(t,n){return this.request(Ee(n||{},{method:e,url:t,data:(n||{}).data}))}}));dt.forEach(["post","put","patch"],(function t(e){function n(t){return function n(o,r,s){return this.request(Ee(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:o,data:r}))}}nn.prototype[e]=n();nn.prototype[e+"Form"]=n(true)}));const on=nn;class rn{constructor(t){if(typeof t!=="function"){throw new TypeError("executor must be a function.")}let e;this.promise=new Promise((function t(n){e=n}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;while(e-- >0){n._listeners[e](t)}n._listeners=null}));this.promise.then=t=>{let e;const o=new Promise((t=>{n.subscribe(t);e=t})).then(t);o.cancel=function t(){n.unsubscribe(e)};return o};t((function t(o,r,s){if(n.reason){return}n.reason=new ae(o,r,s);e(n.reason)}))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}}unsubscribe(t){if(!this._listeners){return}const e=this._listeners.indexOf(t);if(e!==-1){this._listeners.splice(e,1)}}toAbortSignal(){const t=new AbortController;const e=e=>{t.abort(e)};this.subscribe(e);t.signal.unsubscribe=()=>this.unsubscribe(e);return t.signal}static source(){let t;const e=new rn((function e(n){t=n}));return{token:e,cancel:t}}}const sn=rn;function cn(t){return function e(n){return t.apply(null,n)}}function un(t){return dt.isObject(t)&&t.isAxiosError===true}const an={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(an).forEach((([t,e])=>{an[e]=t}));const ln=an;function fn(t){const e=new on(t);const n=r(on.prototype.request,e);dt.extend(n,on.prototype,e,{allOwnKeys:true});dt.extend(n,e,null,{allOwnKeys:true});n.create=function e(n){return fn(Ee(t,n))};return n}const dn=fn(Wt);dn.Axios=on;dn.CanceledError=ae;dn.CancelToken=sn;dn.isCancel=ue;dn.VERSION=Xe;dn.toFormData=St;dn.AxiosError=ht;dn.Cancel=dn.CanceledError;dn.all=function t(e){return Promise.all(e)};dn.spread=cn;dn.isAxiosError=un;dn.mergeConfig=Ee;dn.AxiosHeaders=ie;dn.formToJSON=t=>Jt(dt.isHTMLForm(t)?new FormData(t):t);dn.getAdapter=Ve.getAdapter;dn.HttpStatusCode=ln;dn.default=dn;const hn=dn;const pn="https://wake-middleware.crmbonus.com/api";const mn="http://localhost:3001";class wn{constructor(){this.axiosInstance=hn.create({baseURL:pn,headers:{"Content-Type":"application/json",accept:"application/json"}})}static getInstance(){if(this._instance){return this._instance}this._instance=new wn;return this._instance}async getCustomer(t,e){var n,o;const r={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const s=await this.axiosInstance.get(`/store/${e}/customer/${t}`,{headers:r});this.token=(n=s===null||s===void 0?void 0:s.data)===null||n===void 0?void 0:n.token;return(o=s===null||s===void 0?void 0:s.data)===null||o===void 0?void 0:o.customer}async updateOrder(n){const o=localStorage.getItem("@BYCODERS_KEY");const r={"Content-Type":"application/json",Authorization:`Bearer ${o}`};await this.axiosInstance.patch(`/checkouts/${n.cartId}/updateOrder`,{orderId:n.orderId,externalId:n.cartIdCrm},{headers:r});localStorage.removeItem("@BYCODERS_KEY");localStorage.removeItem(t);localStorage.removeItem(e(n.cartId))}async sendPin(t,e,n){const o={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const r=await this.axiosInstance.post("/crmbonus/send-pin",{cellphone:t,name:e,storeName:n},{headers:o});return{storeId:r.data.storeId,userId:r.data.userId}}async validatePinBonus(t){const e={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const n=await this.axiosInstance.post("/crmbonus/process-pin-bonus",t,{headers:e});return n.data}async reserve(t){const e={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const n=await this.axiosInstance.post("/crmbonus/redeem-bonus",t,{headers:e});return n.data}async cancel(t){const e={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const n=await this.axiosInstance.post("/crmbonus/cancel-apply-bonus",{ticket:t},{headers:e});return n.data}async getToken(t){var e,o;const r=await this.axiosInstance.post("/wake/requestToken",{storeName:t});this.token=(e=r===null||r===void 0?void 0:r.data)===null||e===void 0?void 0:e.token;localStorage.setItem(n,this.token);return(o=r===null||r===void 0?void 0:r.data)===null||o===void 0?void 0:o.token}async getCustomization(t){const e={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const n=await this.axiosInstance.get(`/stores/${t}/customizations`,{headers:e});localStorage.setItem(o(t),JSON.stringify(n.data))}async cancelBonus(e,o){const r=localStorage.getItem(n);const s={"Content-Type":"application/json",Authorization:`Bearer ${r}`};await this.axiosInstance.post(`/crmbonus/cancel-bonus`,{cartId:e,usedBonus:true,storeName:o},{headers:s});localStorage.setItem(e,"0");localStorage.removeItem(t)}async getInfoCart(t){const e=await this.axiosInstance.get(`${t}/api/carrinho`);return e.data}}wn._instance=null;export{wn as C,mn as a};
|
2
|
-
//# sourceMappingURL=p-
|
1
|
+
import{U as t,g as e,B as n,a as o}from"./p-f9aeffc1.js";function r(t,e){return function n(){return t.apply(e,arguments)}}const{toString:s}=Object.prototype;const{getPrototypeOf:i}=Object;const c=(t=>e=>{const n=s.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null));const u=t=>{t=t.toLowerCase();return e=>c(e)===t};const a=t=>e=>typeof e===t;const{isArray:l}=Array;const f=a("undefined");function d(t){return t!==null&&!f(t)&&t.constructor!==null&&!f(t.constructor)&&w(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const h=u("ArrayBuffer");function p(t){let e;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){e=ArrayBuffer.isView(t)}else{e=t&&t.buffer&&h(t.buffer)}return e}const m=a("string");const w=a("function");const y=a("number");const b=t=>t!==null&&typeof t==="object";const g=t=>t===true||t===false;const R=t=>{if(c(t)!=="object"){return false}const e=i(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};const O=u("Date");const S=u("File");const E=u("Blob");const T=u("FileList");const A=t=>b(t)&&w(t.pipe);const j=t=>{let e;return t&&(typeof FormData==="function"&&t instanceof FormData||w(t.append)&&((e=c(t))==="formdata"||e==="object"&&w(t.toString)&&t.toString()==="[object FormData]"))};const N=u("URLSearchParams");const[x,v,C,P]=["ReadableStream","Request","Response","Headers"].map(u);const B=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function F(t,e,{allOwnKeys:n=false}={}){if(t===null||typeof t==="undefined"){return}let o;let r;if(typeof t!=="object"){t=[t]}if(l(t)){for(o=0,r=t.length;o<r;o++){e.call(null,t[o],o,t)}}else{const r=n?Object.getOwnPropertyNames(t):Object.keys(t);const s=r.length;let i;for(o=0;o<s;o++){i=r[o];e.call(null,t[i],i,t)}}}function D(t,e){e=e.toLowerCase();const n=Object.keys(t);let o=n.length;let r;while(o-- >0){r=n[o];if(e===r.toLowerCase()){return r}}return null}const U=(()=>{if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global})();const _=t=>!f(t)&&t!==U;function k(){const{caseless:t}=_(this)&&this||{};const e={};const n=(n,o)=>{const r=t&&D(e,o)||o;if(R(e[r])&&R(n)){e[r]=k(e[r],n)}else if(R(n)){e[r]=k({},n)}else if(l(n)){e[r]=n.slice()}else{e[r]=n}};for(let t=0,e=arguments.length;t<e;t++){arguments[t]&&F(arguments[t],n)}return e}const q=(t,e,n,{allOwnKeys:o}={})=>{F(e,((e,o)=>{if(n&&w(e)){t[o]=r(e,n)}else{t[o]=e}}),{allOwnKeys:o});return t};const L=t=>{if(t.charCodeAt(0)===65279){t=t.slice(1)}return t};const I=(t,e,n,o)=>{t.prototype=Object.create(e.prototype,o);t.prototype.constructor=t;Object.defineProperty(t,"super",{value:e.prototype});n&&Object.assign(t.prototype,n)};const z=(t,e,n,o)=>{let r;let s;let c;const u={};e=e||{};if(t==null)return e;do{r=Object.getOwnPropertyNames(t);s=r.length;while(s-- >0){c=r[s];if((!o||o(c,t,e))&&!u[c]){e[c]=t[c];u[c]=true}}t=n!==false&&i(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e};const $=(t,e,n)=>{t=String(t);if(n===undefined||n>t.length){n=t.length}n-=e.length;const o=t.indexOf(e,n);return o!==-1&&o===n};const M=t=>{if(!t)return null;if(l(t))return t;let e=t.length;if(!y(e))return null;const n=new Array(e);while(e-- >0){n[e]=t[e]}return n};const H=(t=>e=>t&&e instanceof t)(typeof Uint8Array!=="undefined"&&i(Uint8Array));const J=(t,e)=>{const n=t&&t[Symbol.iterator];const o=n.call(t);let r;while((r=o.next())&&!r.done){const n=r.value;e.call(t,n[0],n[1])}};const K=(t,e)=>{let n;const o=[];while((n=t.exec(e))!==null){o.push(n)}return o};const V=u("HTMLFormElement");const W=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function t(e,n,o){return n.toUpperCase()+o}));const G=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype);const X=u("RegExp");const Y=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t);const o={};F(n,((n,r)=>{let s;if((s=e(n,r,t))!==false){o[r]=s||n}}));Object.defineProperties(t,o)};const Z=t=>{Y(t,((e,n)=>{if(w(t)&&["arguments","caller","callee"].indexOf(n)!==-1){return false}const o=t[n];if(!w(o))return;e.enumerable=false;if("writable"in e){e.writable=false;return}if(!e.set){e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}}}))};const Q=(t,e)=>{const n={};const o=t=>{t.forEach((t=>{n[t]=true}))};l(t)?o(t):o(String(t).split(e));return n};const tt=()=>{};const et=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;const nt="abcdefghijklmnopqrstuvwxyz";const ot="0123456789";const rt={DIGIT:ot,ALPHA:nt,ALPHA_DIGIT:nt+nt.toUpperCase()+ot};const st=(t=16,e=rt.ALPHA_DIGIT)=>{let n="";const{length:o}=e;while(t--){n+=e[Math.random()*o|0]}return n};function it(t){return!!(t&&w(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const ct=t=>{const e=new Array(10);const n=(t,o)=>{if(b(t)){if(e.indexOf(t)>=0){return}if(!("toJSON"in t)){e[o]=t;const r=l(t)?[]:{};F(t,((t,e)=>{const s=n(t,o+1);!f(s)&&(r[e]=s)}));e[o]=undefined;return r}}return t};return n(t,0)};const ut=u("AsyncFunction");const at=t=>t&&(b(t)||w(t))&&w(t.then)&&w(t.catch);const lt=((t,e)=>{if(t){return setImmediate}return e?((t,e)=>{U.addEventListener("message",(({source:n,data:o})=>{if(n===U&&o===t){e.length&&e.shift()()}}),false);return n=>{e.push(n);U.postMessage(t,"*")}})(`axios@${Math.random()}`,[]):t=>setTimeout(t)})(typeof setImmediate==="function",w(U.postMessage));const ft=typeof queueMicrotask!=="undefined"?queueMicrotask.bind(U):typeof process!=="undefined"&&process.nextTick||lt;const dt={isArray:l,isArrayBuffer:h,isBuffer:d,isFormData:j,isArrayBufferView:p,isString:m,isNumber:y,isBoolean:g,isObject:b,isPlainObject:R,isReadableStream:x,isRequest:v,isResponse:C,isHeaders:P,isUndefined:f,isDate:O,isFile:S,isBlob:E,isRegExp:X,isFunction:w,isStream:A,isURLSearchParams:N,isTypedArray:H,isFileList:T,forEach:F,merge:k,extend:q,trim:B,stripBOM:L,inherits:I,toFlatObject:z,kindOf:c,kindOfTest:u,endsWith:$,toArray:M,forEachEntry:J,matchAll:K,isHTMLForm:V,hasOwnProperty:G,hasOwnProp:G,reduceDescriptors:Y,freezeMethods:Z,toObjectSet:Q,toCamelCase:W,noop:tt,toFiniteNumber:et,findKey:D,global:U,isContextDefined:_,ALPHABET:rt,generateString:st,isSpecCompliantForm:it,toJSONObject:ct,isAsyncFn:ut,isThenable:at,setImmediate:lt,asap:ft};function ht(t,e,n,o,r){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=(new Error).stack}this.message=t;this.name="AxiosError";e&&(this.code=e);n&&(this.config=n);o&&(this.request=o);if(r){this.response=r;this.status=r.status?r.status:null}}dt.inherits(ht,Error,{toJSON:function t(){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:dt.toJSONObject(this.config),code:this.code,status:this.status}}});const pt=ht.prototype;const mt={};["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((t=>{mt[t]={value:t}}));Object.defineProperties(ht,mt);Object.defineProperty(pt,"isAxiosError",{value:true});ht.from=(t,e,n,o,r,s)=>{const i=Object.create(pt);dt.toFlatObject(t,i,(function t(e){return e!==Error.prototype}),(t=>t!=="isAxiosError"));ht.call(i,t.message,e,n,o,r);i.cause=t;i.name=t.name;s&&Object.assign(i,s);return i};const wt=null;function yt(t){return dt.isPlainObject(t)||dt.isArray(t)}function bt(t){return dt.endsWith(t,"[]")?t.slice(0,-2):t}function gt(t,e,n){if(!t)return e;return t.concat(e).map((function t(e,o){e=bt(e);return!n&&o?"["+e+"]":e})).join(n?".":"")}function Rt(t){return dt.isArray(t)&&!t.some(yt)}const Ot=dt.toFlatObject(dt,{},null,(function t(e){return/^is[A-Z]/.test(e)}));function St(t,e,n){if(!dt.isObject(t)){throw new TypeError("target must be an object")}e=e||new FormData;n=dt.toFlatObject(n,{metaTokens:true,dots:false,indexes:false},false,(function t(e,n){return!dt.isUndefined(n[e])}));const o=n.metaTokens;const r=n.visitor||l;const s=n.dots;const i=n.indexes;const c=n.Blob||typeof Blob!=="undefined"&&Blob;const u=c&&dt.isSpecCompliantForm(e);if(!dt.isFunction(r)){throw new TypeError("visitor must be a function")}function a(t){if(t===null)return"";if(dt.isDate(t)){return t.toISOString()}if(!u&&dt.isBlob(t)){throw new ht("Blob is not supported. Use a Buffer instead.")}if(dt.isArrayBuffer(t)||dt.isTypedArray(t)){return u&&typeof Blob==="function"?new Blob([t]):Buffer.from(t)}return t}function l(t,n,r){let c=t;if(t&&!r&&typeof t==="object"){if(dt.endsWith(n,"{}")){n=o?n:n.slice(0,-2);t=JSON.stringify(t)}else if(dt.isArray(t)&&Rt(t)||(dt.isFileList(t)||dt.endsWith(n,"[]"))&&(c=dt.toArray(t))){n=bt(n);c.forEach((function t(o,r){!(dt.isUndefined(o)||o===null)&&e.append(i===true?gt([n],r,s):i===null?n:n+"[]",a(o))}));return false}}if(yt(t)){return true}e.append(gt(r,n,s),a(t));return false}const f=[];const d=Object.assign(Ot,{defaultVisitor:l,convertValue:a,isVisitable:yt});function h(t,n){if(dt.isUndefined(t))return;if(f.indexOf(t)!==-1){throw Error("Circular reference detected in "+n.join("."))}f.push(t);dt.forEach(t,(function t(o,s){const i=!(dt.isUndefined(o)||o===null)&&r.call(e,o,dt.isString(s)?s.trim():s,n,d);if(i===true){h(o,n?n.concat(s):[s])}}));f.pop()}if(!dt.isObject(t)){throw new TypeError("data must be an object")}h(t);return e}function Et(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function t(n){return e[n]}))}function Tt(t,e){this._pairs=[];t&&St(t,this,e)}const At=Tt.prototype;At.append=function t(e,n){this._pairs.push([e,n])};At.toString=function t(e){const n=e?function(t){return e.call(this,t,Et)}:Et;return this._pairs.map((function t(e){return n(e[0])+"="+n(e[1])}),"").join("&")};function jt(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Nt(t,e,n){if(!e){return t}const o=n&&n.encode||jt;const r=n&&n.serialize;let s;if(r){s=r(e,n)}else{s=dt.isURLSearchParams(e)?e.toString():new Tt(e,n).toString(o)}if(s){const e=t.indexOf("#");if(e!==-1){t=t.slice(0,e)}t+=(t.indexOf("?")===-1?"?":"&")+s}return t}class xt{constructor(){this.handlers=[]}use(t,e,n){this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:false,runWhen:n?n.runWhen:null});return this.handlers.length-1}eject(t){if(this.handlers[t]){this.handlers[t]=null}}clear(){if(this.handlers){this.handlers=[]}}forEach(t){dt.forEach(this.handlers,(function e(n){if(n!==null){t(n)}}))}}const vt=xt;const Ct={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};const Pt=typeof URLSearchParams!=="undefined"?URLSearchParams:Tt;const Bt=typeof FormData!=="undefined"?FormData:null;const Ft=typeof Blob!=="undefined"?Blob:null;const Dt={isBrowser:true,classes:{URLSearchParams:Pt,FormData:Bt,Blob:Ft},protocols:["http","https","file","blob","url","data"]};const Ut=typeof window!=="undefined"&&typeof document!=="undefined";const _t=typeof navigator==="object"&&navigator||undefined;const kt=Ut&&(!_t||["ReactNative","NativeScript","NS"].indexOf(_t.product)<0);const qt=(()=>typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function")();const Lt=Ut&&window.location.href||"http://localhost";const It=Object.freeze({__proto__:null,hasBrowserEnv:Ut,hasStandardBrowserWebWorkerEnv:qt,hasStandardBrowserEnv:kt,navigator:_t,origin:Lt});const zt={...It,...Dt};function $t(t,e){return St(t,new zt.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,o){if(zt.isNode&&dt.isBuffer(t)){this.append(e,t.toString("base64"));return false}return o.defaultVisitor.apply(this,arguments)}},e))}function Mt(t){return dt.matchAll(/\w+|\[(\w*)]/g,t).map((t=>t[0]==="[]"?"":t[1]||t[0]))}function Ht(t){const e={};const n=Object.keys(t);let o;const r=n.length;let s;for(o=0;o<r;o++){s=n[o];e[s]=t[s]}return e}function Jt(t){function e(t,n,o,r){let s=t[r++];if(s==="__proto__")return true;const i=Number.isFinite(+s);const c=r>=t.length;s=!s&&dt.isArray(o)?o.length:s;if(c){if(dt.hasOwnProp(o,s)){o[s]=[o[s],n]}else{o[s]=n}return!i}if(!o[s]||!dt.isObject(o[s])){o[s]=[]}const u=e(t,n,o[s],r);if(u&&dt.isArray(o[s])){o[s]=Ht(o[s])}return!i}if(dt.isFormData(t)&&dt.isFunction(t.entries)){const n={};dt.forEachEntry(t,((t,o)=>{e(Mt(t),o,n,0)}));return n}return null}function Kt(t,e,n){if(dt.isString(t)){try{(e||JSON.parse)(t);return dt.trim(t)}catch(t){if(t.name!=="SyntaxError"){throw t}}}return(n||JSON.stringify)(t)}const Vt={transitional:Ct,adapter:["xhr","http","fetch"],transformRequest:[function t(e,n){const o=n.getContentType()||"";const r=o.indexOf("application/json")>-1;const s=dt.isObject(e);if(s&&dt.isHTMLForm(e)){e=new FormData(e)}const i=dt.isFormData(e);if(i){return r?JSON.stringify(Jt(e)):e}if(dt.isArrayBuffer(e)||dt.isBuffer(e)||dt.isStream(e)||dt.isFile(e)||dt.isBlob(e)||dt.isReadableStream(e)){return e}if(dt.isArrayBufferView(e)){return e.buffer}if(dt.isURLSearchParams(e)){n.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return e.toString()}let c;if(s){if(o.indexOf("application/x-www-form-urlencoded")>-1){return $t(e,this.formSerializer).toString()}if((c=dt.isFileList(e))||o.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return St(c?{"files[]":e}:e,t&&new t,this.formSerializer)}}if(s||r){n.setContentType("application/json",false);return Kt(e)}return e}],transformResponse:[function t(e){const n=this.transitional||Vt.transitional;const o=n&&n.forcedJSONParsing;const r=this.responseType==="json";if(dt.isResponse(e)||dt.isReadableStream(e)){return e}if(e&&dt.isString(e)&&(o&&!this.responseType||r)){const t=n&&n.silentJSONParsing;const o=!t&&r;try{return JSON.parse(e)}catch(t){if(o){if(t.name==="SyntaxError"){throw ht.from(t,ht.ERR_BAD_RESPONSE,this,null,this.response)}throw t}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:zt.classes.FormData,Blob:zt.classes.Blob},validateStatus:function t(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":undefined}}};dt.forEach(["delete","get","head","post","put","patch"],(t=>{Vt.headers[t]={}}));const Wt=Vt;const Gt=dt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Xt=t=>{const e={};let n;let o;let r;t&&t.split("\n").forEach((function t(s){r=s.indexOf(":");n=s.substring(0,r).trim().toLowerCase();o=s.substring(r+1).trim();if(!n||e[n]&&Gt[n]){return}if(n==="set-cookie"){if(e[n]){e[n].push(o)}else{e[n]=[o]}}else{e[n]=e[n]?e[n]+", "+o:o}}));return e};const Yt=Symbol("internals");function Zt(t){return t&&String(t).trim().toLowerCase()}function Qt(t){if(t===false||t==null){return t}return dt.isArray(t)?t.map(Qt):String(t)}function te(t){const e=Object.create(null);const n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let o;while(o=n.exec(t)){e[o[1]]=o[2]}return e}const ee=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function ne(t,e,n,o,r){if(dt.isFunction(o)){return o.call(this,e,n)}if(r){e=n}if(!dt.isString(e))return;if(dt.isString(o)){return e.indexOf(o)!==-1}if(dt.isRegExp(o)){return o.test(e)}}function oe(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,n)=>e.toUpperCase()+n))}function re(t,e){const n=dt.toCamelCase(" "+e);["get","set","has"].forEach((o=>{Object.defineProperty(t,o+n,{value:function(t,n,r){return this[o].call(this,e,t,n,r)},configurable:true})}))}class se{constructor(t){t&&this.set(t)}set(t,e,n){const o=this;function r(t,e,n){const r=Zt(e);if(!r){throw new Error("header name must be a non-empty string")}const s=dt.findKey(o,r);if(!s||o[s]===undefined||n===true||n===undefined&&o[s]!==false){o[s||e]=Qt(t)}}const s=(t,e)=>dt.forEach(t,((t,n)=>r(t,n,e)));if(dt.isPlainObject(t)||t instanceof this.constructor){s(t,e)}else if(dt.isString(t)&&(t=t.trim())&&!ee(t)){s(Xt(t),e)}else if(dt.isHeaders(t)){for(const[e,o]of t.entries()){r(o,e,n)}}else{t!=null&&r(e,t,n)}return this}get(t,e){t=Zt(t);if(t){const n=dt.findKey(this,t);if(n){const t=this[n];if(!e){return t}if(e===true){return te(t)}if(dt.isFunction(e)){return e.call(this,t,n)}if(dt.isRegExp(e)){return e.exec(t)}throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){t=Zt(t);if(t){const n=dt.findKey(this,t);return!!(n&&this[n]!==undefined&&(!e||ne(this,this[n],n,e)))}return false}delete(t,e){const n=this;let o=false;function r(t){t=Zt(t);if(t){const r=dt.findKey(n,t);if(r&&(!e||ne(n,n[r],r,e))){delete n[r];o=true}}}if(dt.isArray(t)){t.forEach(r)}else{r(t)}return o}clear(t){const e=Object.keys(this);let n=e.length;let o=false;while(n--){const r=e[n];if(!t||ne(this,this[r],r,t,true)){delete this[r];o=true}}return o}normalize(t){const e=this;const n={};dt.forEach(this,((o,r)=>{const s=dt.findKey(n,r);if(s){e[s]=Qt(o);delete e[r];return}const i=t?oe(r):String(r).trim();if(i!==r){delete e[r]}e[i]=Qt(o);n[i]=true}));return this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);dt.forEach(this,((n,o)=>{n!=null&&n!==false&&(e[o]=t&&dt.isArray(n)?n.join(", "):n)}));return e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const n=new this(t);e.forEach((t=>n.set(t)));return n}static accessor(t){const e=this[Yt]=this[Yt]={accessors:{}};const n=e.accessors;const o=this.prototype;function r(t){const e=Zt(t);if(!n[e]){re(o,t);n[e]=true}}dt.isArray(t)?t.forEach(r):r(t);return this}}se.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);dt.reduceDescriptors(se.prototype,(({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[n]=t}}}));dt.freezeMethods(se);const ie=se;function ce(t,e){const n=this||Wt;const o=e||n;const r=ie.from(o.headers);let s=o.data;dt.forEach(t,(function t(o){s=o.call(n,s,r.normalize(),e?e.status:undefined)}));r.normalize();return s}function ue(t){return!!(t&&t.__CANCEL__)}function ae(t,e,n){ht.call(this,t==null?"canceled":t,ht.ERR_CANCELED,e,n);this.name="CanceledError"}dt.inherits(ae,ht,{__CANCEL__:true});function le(t,e,n){const o=n.config.validateStatus;if(!n.status||!o||o(n.status)){t(n)}else{e(new ht("Request failed with status code "+n.status,[ht.ERR_BAD_REQUEST,ht.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}}function fe(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function de(t,e){t=t||10;const n=new Array(t);const o=new Array(t);let r=0;let s=0;let i;e=e!==undefined?e:1e3;return function c(u){const a=Date.now();const l=o[s];if(!i){i=a}n[r]=u;o[r]=a;let f=s;let d=0;while(f!==r){d+=n[f++];f=f%t}r=(r+1)%t;if(r===s){s=(s+1)%t}if(a-i<e){return}const h=l&&a-l;return h?Math.round(d*1e3/h):undefined}}function he(t,e){let n=0;let o=1e3/e;let r;let s;const i=(e,o=Date.now())=>{n=o;r=null;if(s){clearTimeout(s);s=null}t.apply(null,e)};const c=(...t)=>{const e=Date.now();const c=e-n;if(c>=o){i(t,e)}else{r=t;if(!s){s=setTimeout((()=>{s=null;i(r)}),o-c)}}};const u=()=>r&&i(r);return[c,u]}const pe=(t,e,n=3)=>{let o=0;const r=de(50,250);return he((n=>{const s=n.loaded;const i=n.lengthComputable?n.total:undefined;const c=s-o;const u=r(c);const a=s<=i;o=s;const l={loaded:s,total:i,progress:i?s/i:undefined,bytes:c,rate:u?u:undefined,estimated:u&&i&&a?(i-s)/u:undefined,event:n,lengthComputable:i!=null,[e?"download":"upload"]:true};t(l)}),n)};const me=(t,e)=>{const n=t!=null;return[o=>e[0]({lengthComputable:n,total:t,loaded:o}),e[1]]};const we=t=>(...e)=>dt.asap((()=>t(...e)));const ye=zt.hasStandardBrowserEnv?function t(){const e=zt.navigator&&/(msie|trident)/i.test(zt.navigator.userAgent);const n=document.createElement("a");let o;function r(t){let o=t;if(e){n.setAttribute("href",o);o=n.href}n.setAttribute("href",o);return{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}o=r(window.location.href);return function t(e){const n=dt.isString(e)?r(e):e;return n.protocol===o.protocol&&n.host===o.host}}():function t(){return function t(){return true}}();const be=zt.hasStandardBrowserEnv?{write(t,e,n,o,r,s){const i=[t+"="+encodeURIComponent(e)];dt.isNumber(n)&&i.push("expires="+new Date(n).toGMTString());dt.isString(o)&&i.push("path="+o);dt.isString(r)&&i.push("domain="+r);s===true&&i.push("secure");document.cookie=i.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function ge(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Re(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Oe(t,e){if(t&&!ge(e)){return Re(t,e)}return e}const Se=t=>t instanceof ie?{...t}:t;function Ee(t,e){e=e||{};const n={};function o(t,e,n){if(dt.isPlainObject(t)&&dt.isPlainObject(e)){return dt.merge.call({caseless:n},t,e)}else if(dt.isPlainObject(e)){return dt.merge({},e)}else if(dt.isArray(e)){return e.slice()}return e}function r(t,e,n){if(!dt.isUndefined(e)){return o(t,e,n)}else if(!dt.isUndefined(t)){return o(undefined,t,n)}}function s(t,e){if(!dt.isUndefined(e)){return o(undefined,e)}}function i(t,e){if(!dt.isUndefined(e)){return o(undefined,e)}else if(!dt.isUndefined(t)){return o(undefined,t)}}function c(n,r,s){if(s in e){return o(n,r)}else if(s in t){return o(undefined,n)}}const u={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(t,e)=>r(Se(t),Se(e),true)};dt.forEach(Object.keys(Object.assign({},t,e)),(function o(s){const i=u[s]||r;const a=i(t[s],e[s],s);dt.isUndefined(a)&&i!==c||(n[s]=a)}));return n}const Te=t=>{const e=Ee({},t);let{data:n,withXSRFToken:o,xsrfHeaderName:r,xsrfCookieName:s,headers:i,auth:c}=e;e.headers=i=ie.from(i);e.url=Nt(Oe(e.baseURL,e.url),t.params,t.paramsSerializer);if(c){i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")))}let u;if(dt.isFormData(n)){if(zt.hasStandardBrowserEnv||zt.hasStandardBrowserWebWorkerEnv){i.setContentType(undefined)}else if((u=i.getContentType())!==false){const[t,...e]=u?u.split(";").map((t=>t.trim())).filter(Boolean):[];i.setContentType([t||"multipart/form-data",...e].join("; "))}}if(zt.hasStandardBrowserEnv){o&&dt.isFunction(o)&&(o=o(e));if(o||o!==false&&ye(e.url)){const t=r&&s&&be.read(s);if(t){i.set(r,t)}}}return e};const Ae=typeof XMLHttpRequest!=="undefined";const je=Ae&&function(t){return new Promise((function e(n,o){const r=Te(t);let s=r.data;const i=ie.from(r.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:a}=r;let l;let f,d;let h,p;function m(){h&&h();p&&p();r.cancelToken&&r.cancelToken.unsubscribe(l);r.signal&&r.signal.removeEventListener("abort",l)}let w=new XMLHttpRequest;w.open(r.method.toUpperCase(),r.url,true);w.timeout=r.timeout;function y(){if(!w){return}const e=ie.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders());const r=!c||c==="text"||c==="json"?w.responseText:w.response;const s={data:r,status:w.status,statusText:w.statusText,headers:e,config:t,request:w};le((function t(e){n(e);m()}),(function t(e){o(e);m()}),s);w=null}if("onloadend"in w){w.onloadend=y}else{w.onreadystatechange=function t(){if(!w||w.readyState!==4){return}if(w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)){return}setTimeout(y)}}w.onabort=function e(){if(!w){return}o(new ht("Request aborted",ht.ECONNABORTED,t,w));w=null};w.onerror=function e(){o(new ht("Network Error",ht.ERR_NETWORK,t,w));w=null};w.ontimeout=function e(){let n=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const s=r.transitional||Ct;if(r.timeoutErrorMessage){n=r.timeoutErrorMessage}o(new ht(n,s.clarifyTimeoutError?ht.ETIMEDOUT:ht.ECONNABORTED,t,w));w=null};s===undefined&&i.setContentType(null);if("setRequestHeader"in w){dt.forEach(i.toJSON(),(function t(e,n){w.setRequestHeader(n,e)}))}if(!dt.isUndefined(r.withCredentials)){w.withCredentials=!!r.withCredentials}if(c&&c!=="json"){w.responseType=r.responseType}if(a){[d,p]=pe(a,true);w.addEventListener("progress",d)}if(u&&w.upload){[f,h]=pe(u);w.upload.addEventListener("progress",f);w.upload.addEventListener("loadend",h)}if(r.cancelToken||r.signal){l=e=>{if(!w){return}o(!e||e.type?new ae(null,t,w):e);w.abort();w=null};r.cancelToken&&r.cancelToken.subscribe(l);if(r.signal){r.signal.aborted?l():r.signal.addEventListener("abort",l)}}const b=fe(r.url);if(b&&zt.protocols.indexOf(b)===-1){o(new ht("Unsupported protocol "+b+":",ht.ERR_BAD_REQUEST,t));return}w.send(s||null)}))};const Ne=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let n=new AbortController;let o;const r=function(t){if(!o){o=true;i();const e=t instanceof Error?t:this.reason;n.abort(e instanceof ht?e:new ae(e instanceof Error?e.message:e))}};let s=e&&setTimeout((()=>{s=null;r(new ht(`timeout ${e} of ms exceeded`,ht.ETIMEDOUT))}),e);const i=()=>{if(t){s&&clearTimeout(s);s=null;t.forEach((t=>{t.unsubscribe?t.unsubscribe(r):t.removeEventListener("abort",r)}));t=null}};t.forEach((t=>t.addEventListener("abort",r)));const{signal:c}=n;c.unsubscribe=()=>dt.asap(i);return c}};const xe=Ne;const ve=function*(t,e){let n=t.byteLength;if(!e||n<e){yield t;return}let o=0;let r;while(o<n){r=o+e;yield t.slice(o,r);o=r}};const Ce=async function*(t,e){for await(const n of Pe(t)){yield*ve(n,e)}};const Pe=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:t,value:n}=await e.read();if(t){break}yield n}}finally{await e.cancel()}};const Be=(t,e,n,o)=>{const r=Ce(t,e);let s=0;let i;let c=t=>{if(!i){i=true;o&&o(t)}};return new ReadableStream({async pull(t){try{const{done:e,value:o}=await r.next();if(e){c();t.close();return}let i=o.byteLength;if(n){let t=s+=i;n(t)}t.enqueue(new Uint8Array(o))}catch(t){c(t);throw t}},cancel(t){c(t);return r.return()}},{highWaterMark:2})};const Fe=typeof fetch==="function"&&typeof Request==="function"&&typeof Response==="function";const De=Fe&&typeof ReadableStream==="function";const Ue=Fe&&(typeof TextEncoder==="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer()));const _e=(t,...e)=>{try{return!!t(...e)}catch(t){return false}};const ke=De&&_e((()=>{let t=false;const e=new Request(zt.origin,{body:new ReadableStream,method:"POST",get duplex(){t=true;return"half"}}).headers.has("Content-Type");return t&&!e}));const qe=64*1024;const Le=De&&_e((()=>dt.isReadableStream(new Response("").body)));const Ie={stream:Le&&(t=>t.body)};Fe&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!Ie[e]&&(Ie[e]=dt.isFunction(t[e])?t=>t[e]():(t,n)=>{throw new ht(`Response type '${e}' is not supported`,ht.ERR_NOT_SUPPORT,n)})}))})(new Response);const ze=async t=>{if(t==null){return 0}if(dt.isBlob(t)){return t.size}if(dt.isSpecCompliantForm(t)){const e=new Request(zt.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}if(dt.isArrayBufferView(t)||dt.isArrayBuffer(t)){return t.byteLength}if(dt.isURLSearchParams(t)){t=t+""}if(dt.isString(t)){return(await Ue(t)).byteLength}};const $e=async(t,e)=>{const n=dt.toFiniteNumber(t.getContentLength());return n==null?ze(e):n};const Me=Fe&&(async t=>{let{url:e,method:n,data:o,signal:r,cancelToken:s,timeout:i,onDownloadProgress:c,onUploadProgress:u,responseType:a,headers:l,withCredentials:f="same-origin",fetchOptions:d}=Te(t);a=a?(a+"").toLowerCase():"text";let h=xe([r,s&&s.toAbortSignal()],i);let p;const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let w;try{if(u&&ke&&n!=="get"&&n!=="head"&&(w=await $e(l,o))!==0){let t=new Request(e,{method:"POST",body:o,duplex:"half"});let n;if(dt.isFormData(o)&&(n=t.headers.get("content-type"))){l.setContentType(n)}if(t.body){const[e,n]=me(w,pe(we(u)));o=Be(t.body,qe,e,n)}}if(!dt.isString(f)){f=f?"include":"omit"}const r="credentials"in Request.prototype;p=new Request(e,{...d,signal:h,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:o,duplex:"half",credentials:r?f:undefined});let s=await fetch(p);const i=Le&&(a==="stream"||a==="response");if(Le&&(c||i&&m)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=s[e]}));const e=dt.toFiniteNumber(s.headers.get("content-length"));const[n,o]=c&&me(e,pe(we(c),true))||[];s=new Response(Be(s.body,qe,n,(()=>{o&&o();m&&m()})),t)}a=a||"text";let y=await Ie[dt.findKey(Ie,a)||"text"](s,t);!i&&m&&m();return await new Promise(((e,n)=>{le(e,n,{data:y,headers:ie.from(s.headers),status:s.status,statusText:s.statusText,config:t,request:p})}))}catch(e){m&&m();if(e&&e.name==="TypeError"&&/fetch/i.test(e.message)){throw Object.assign(new ht("Network Error",ht.ERR_NETWORK,t,p),{cause:e.cause||e})}throw ht.from(e,e&&e.code,t,p)}});const He={http:wt,xhr:je,fetch:Me};dt.forEach(He,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const Je=t=>`- ${t}`;const Ke=t=>dt.isFunction(t)||t===null||t===false;const Ve={getAdapter:t=>{t=dt.isArray(t)?t:[t];const{length:e}=t;let n;let o;const r={};for(let s=0;s<e;s++){n=t[s];let e;o=n;if(!Ke(n)){o=He[(e=String(n)).toLowerCase()];if(o===undefined){throw new ht(`Unknown adapter '${e}'`)}}if(o){break}r[e||"#"+s]=o}if(!o){const t=Object.entries(r).map((([t,e])=>`adapter ${t} `+(e===false?"is not supported by the environment":"is not available in the build")));let n=e?t.length>1?"since :\n"+t.map(Je).join("\n"):" "+Je(t[0]):"as no adapter specified";throw new ht(`There is no suitable adapter to dispatch the request `+n,"ERR_NOT_SUPPORT")}return o},adapters:He};function We(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new ae(null,t)}}function Ge(t){We(t);t.headers=ie.from(t.headers);t.data=ce.call(t,t.transformRequest);if(["post","put","patch"].indexOf(t.method)!==-1){t.headers.setContentType("application/x-www-form-urlencoded",false)}const e=Ve.getAdapter(t.adapter||Wt.adapter);return e(t).then((function e(n){We(t);n.data=ce.call(t,t.transformResponse,n);n.headers=ie.from(n.headers);return n}),(function e(n){if(!ue(n)){We(t);if(n&&n.response){n.response.data=ce.call(t,t.transformResponse,n.response);n.response.headers=ie.from(n.response.headers)}}return Promise.reject(n)}))}const Xe="1.7.7";const Ye={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Ye[t]=function n(o){return typeof o===t||"a"+(e<1?"n ":" ")+t}}));const Ze={};Ye.transitional=function t(e,n,o){function r(t,e){return"[Axios v"+Xe+"] Transitional option '"+t+"'"+e+(o?". "+o:"")}return(t,o,s)=>{if(e===false){throw new ht(r(o," has been removed"+(n?" in "+n:"")),ht.ERR_DEPRECATED)}if(n&&!Ze[o]){Ze[o]=true;console.warn(r(o," has been deprecated since v"+n+" and will be removed in the near future"))}return e?e(t,o,s):true}};function Qe(t,e,n){if(typeof t!=="object"){throw new ht("options must be an object",ht.ERR_BAD_OPTION_VALUE)}const o=Object.keys(t);let r=o.length;while(r-- >0){const s=o[r];const i=e[s];if(i){const e=t[s];const n=e===undefined||i(e,s,t);if(n!==true){throw new ht("option "+s+" must be "+n,ht.ERR_BAD_OPTION_VALUE)}continue}if(n!==true){throw new ht("Unknown option "+s,ht.ERR_BAD_OPTION)}}}const tn={assertOptions:Qe,validators:Ye};const en=tn.validators;class nn{constructor(t){this.defaults=t;this.interceptors={request:new vt,response:new vt}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e;Error.captureStackTrace?Error.captureStackTrace(e={}):e=new Error;const n=e.stack?e.stack.replace(/^.+\n/,""):"";try{if(!t.stack){t.stack=n}else if(n&&!String(t.stack).endsWith(n.replace(/^.+\n.+\n/,""))){t.stack+="\n"+n}}catch(t){}}throw t}}_request(t,e){if(typeof t==="string"){e=e||{};e.url=t}else{e=t||{}}e=Ee(this.defaults,e);const{transitional:n,paramsSerializer:o,headers:r}=e;if(n!==undefined){tn.assertOptions(n,{silentJSONParsing:en.transitional(en.boolean),forcedJSONParsing:en.transitional(en.boolean),clarifyTimeoutError:en.transitional(en.boolean)},false)}if(o!=null){if(dt.isFunction(o)){e.paramsSerializer={serialize:o}}else{tn.assertOptions(o,{encode:en.function,serialize:en.function},true)}}e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=r&&dt.merge(r.common,r[e.method]);r&&dt.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete r[t]}));e.headers=ie.concat(s,r);const i=[];let c=true;this.interceptors.request.forEach((function t(n){if(typeof n.runWhen==="function"&&n.runWhen(e)===false){return}c=c&&n.synchronous;i.unshift(n.fulfilled,n.rejected)}));const u=[];this.interceptors.response.forEach((function t(e){u.push(e.fulfilled,e.rejected)}));let a;let l=0;let f;if(!c){const t=[Ge.bind(this),undefined];t.unshift.apply(t,i);t.push.apply(t,u);f=t.length;a=Promise.resolve(e);while(l<f){a=a.then(t[l++],t[l++])}return a}f=i.length;let d=e;l=0;while(l<f){const t=i[l++];const e=i[l++];try{d=t(d)}catch(t){e.call(this,t);break}}try{a=Ge.call(this,d)}catch(t){return Promise.reject(t)}l=0;f=u.length;while(l<f){a=a.then(u[l++],u[l++])}return a}getUri(t){t=Ee(this.defaults,t);const e=Oe(t.baseURL,t.url);return Nt(e,t.params,t.paramsSerializer)}}dt.forEach(["delete","get","head","options"],(function t(e){nn.prototype[e]=function(t,n){return this.request(Ee(n||{},{method:e,url:t,data:(n||{}).data}))}}));dt.forEach(["post","put","patch"],(function t(e){function n(t){return function n(o,r,s){return this.request(Ee(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:o,data:r}))}}nn.prototype[e]=n();nn.prototype[e+"Form"]=n(true)}));const on=nn;class rn{constructor(t){if(typeof t!=="function"){throw new TypeError("executor must be a function.")}let e;this.promise=new Promise((function t(n){e=n}));const n=this;this.promise.then((t=>{if(!n._listeners)return;let e=n._listeners.length;while(e-- >0){n._listeners[e](t)}n._listeners=null}));this.promise.then=t=>{let e;const o=new Promise((t=>{n.subscribe(t);e=t})).then(t);o.cancel=function t(){n.unsubscribe(e)};return o};t((function t(o,r,s){if(n.reason){return}n.reason=new ae(o,r,s);e(n.reason)}))}throwIfRequested(){if(this.reason){throw this.reason}}subscribe(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}}unsubscribe(t){if(!this._listeners){return}const e=this._listeners.indexOf(t);if(e!==-1){this._listeners.splice(e,1)}}toAbortSignal(){const t=new AbortController;const e=e=>{t.abort(e)};this.subscribe(e);t.signal.unsubscribe=()=>this.unsubscribe(e);return t.signal}static source(){let t;const e=new rn((function e(n){t=n}));return{token:e,cancel:t}}}const sn=rn;function cn(t){return function e(n){return t.apply(null,n)}}function un(t){return dt.isObject(t)&&t.isAxiosError===true}const an={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(an).forEach((([t,e])=>{an[e]=t}));const ln=an;function fn(t){const e=new on(t);const n=r(on.prototype.request,e);dt.extend(n,on.prototype,e,{allOwnKeys:true});dt.extend(n,e,null,{allOwnKeys:true});n.create=function e(n){return fn(Ee(t,n))};return n}const dn=fn(Wt);dn.Axios=on;dn.CanceledError=ae;dn.CancelToken=sn;dn.isCancel=ue;dn.VERSION=Xe;dn.toFormData=St;dn.AxiosError=ht;dn.Cancel=dn.CanceledError;dn.all=function t(e){return Promise.all(e)};dn.spread=cn;dn.isAxiosError=un;dn.mergeConfig=Ee;dn.AxiosHeaders=ie;dn.formToJSON=t=>Jt(dt.isHTMLForm(t)?new FormData(t):t);dn.getAdapter=Ve.getAdapter;dn.HttpStatusCode=ln;dn.default=dn;const hn=dn;const pn="https://wake.crmbonus.com/api";const mn="http://localhost:3001";class wn{constructor(){this.axiosInstance=hn.create({baseURL:pn,headers:{"Content-Type":"application/json",accept:"application/json"}})}static getInstance(){if(this._instance){return this._instance}this._instance=new wn;return this._instance}async getCustomer(t,e){var n,o;const r={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const s=await this.axiosInstance.get(`/store/${e}/customer/${t}`,{headers:r});this.token=(n=s===null||s===void 0?void 0:s.data)===null||n===void 0?void 0:n.token;return(o=s===null||s===void 0?void 0:s.data)===null||o===void 0?void 0:o.customer}async updateOrder(n){const o=localStorage.getItem("@BYCODERS_KEY");const r={"Content-Type":"application/json",Authorization:`Bearer ${o}`};await this.axiosInstance.patch(`/checkouts/${n.cartId}/updateOrder`,{orderId:n.orderId,externalId:n.cartIdCrm},{headers:r});localStorage.removeItem("@BYCODERS_KEY");localStorage.removeItem(t);localStorage.removeItem(e(n.cartId))}async sendPin(t,e,n){const o={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const r=await this.axiosInstance.post("/crmbonus/send-pin",{cellphone:t,name:e,storeName:n},{headers:o});return{storeId:r.data.storeId,userId:r.data.userId}}async validatePinBonus(t){const e={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const n=await this.axiosInstance.post("/crmbonus/process-pin-bonus",t,{headers:e});return n.data}async reserve(t){const e={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const n=await this.axiosInstance.post("/crmbonus/redeem-bonus",t,{headers:e});return n.data}async cancel(t){const e={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const n=await this.axiosInstance.post("/crmbonus/cancel-apply-bonus",{ticket:t},{headers:e});return n.data}async getToken(t){var e,o;const r=await this.axiosInstance.post("/wake/requestToken",{storeName:t});this.token=(e=r===null||r===void 0?void 0:r.data)===null||e===void 0?void 0:e.token;localStorage.setItem(n,this.token);return(o=r===null||r===void 0?void 0:r.data)===null||o===void 0?void 0:o.token}async getCustomization(t){const e={"Content-Type":"application/json",Authorization:`Bearer ${this.token}`};const n=await this.axiosInstance.get(`/stores/${t}/customizations`,{headers:e});localStorage.setItem(o(t),JSON.stringify(n.data))}async cancelBonus(e,o){const r=localStorage.getItem(n);const s={"Content-Type":"application/json",Authorization:`Bearer ${r}`};await this.axiosInstance.post(`/crmbonus/cancel-bonus`,{cartId:e,usedBonus:true,storeName:o},{headers:s});localStorage.setItem(e,"0");localStorage.removeItem(t)}async getInfoCart(t){const e=await this.axiosInstance.get(`${t}/api/carrinho`);return e.data}}wn._instance=null;export{wn as C,mn as a};
|
2
|
+
//# sourceMappingURL=p-6eda79c3.js.map
|