crmbonus-component-wake 2.1.17-homolog → 2.1.18-homolog

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.
Files changed (46) hide show
  1. package/dist/cjs/crm-bonus-note.cjs.entry.js +1 -1
  2. package/dist/cjs/crm-bonus.cjs.entry.js +1 -1
  3. package/dist/cjs/crm-giftback-form_2.cjs.entry.js +1 -1
  4. package/dist/cjs/crm-tooltip_4.cjs.entry.js +7 -7
  5. package/dist/cjs/crm-tooltip_4.cjs.entry.js.map +1 -1
  6. package/dist/cjs/{i18n-f2a6f60e.js → i18n-defaa4f8.js} +2 -2
  7. package/dist/cjs/{i18n-f2a6f60e.js.map → i18n-defaa4f8.js.map} +1 -1
  8. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js +6 -6
  9. package/dist/collection/components/giftback-form/subcomponents/giftback-info/giftback-info.js.map +1 -1
  10. package/dist/collection/i18n/i18n.js +1 -1
  11. package/dist/collection/i18n/i18n.js.map +1 -1
  12. package/dist/components/crm-bonus-note.js +1 -1
  13. package/dist/components/crm-bonus.js +4 -4
  14. package/dist/components/crm-giftback-form.js +1 -1
  15. package/dist/components/giftback-info.js +1 -1
  16. package/dist/components/{p-3af6c647.js → p-1a20b231.js} +8 -8
  17. package/dist/components/p-1a20b231.js.map +1 -0
  18. package/dist/components/{p-4b131051.js → p-8b7e3ba9.js} +4 -4
  19. package/dist/components/{p-4b131051.js.map → p-8b7e3ba9.js.map} +1 -1
  20. package/dist/components/{p-e8c19a64.js → p-c53241bf.js} +2 -2
  21. package/dist/components/{p-e8c19a64.js.map → p-c53241bf.js.map} +1 -1
  22. package/dist/components/{p-70b3b7b3.js → p-ef285153.js} +2 -2
  23. package/dist/components/{p-70b3b7b3.js.map → p-ef285153.js.map} +1 -1
  24. package/dist/components/pin-form.js +1 -1
  25. package/dist/crmbonus-component-wake/crmbonus-component-wake.esm.js +1 -1
  26. package/dist/crmbonus-component-wake/{p-50d1cbaa.entry.js → p-68b058e9.entry.js} +2 -2
  27. package/dist/crmbonus-component-wake/p-898ab1b3.entry.js +2 -0
  28. package/dist/crmbonus-component-wake/p-898ab1b3.entry.js.map +1 -0
  29. package/dist/crmbonus-component-wake/{p-68de3204.entry.js → p-b307cbed.entry.js} +2 -2
  30. package/dist/crmbonus-component-wake/{p-e8c19a64.js → p-c53241bf.js} +2 -2
  31. package/dist/crmbonus-component-wake/{p-e8c19a64.js.map → p-c53241bf.js.map} +1 -1
  32. package/dist/crmbonus-component-wake/{p-ac32b78a.entry.js → p-ee132b98.entry.js} +2 -2
  33. package/dist/esm/crm-bonus-note.entry.js +1 -1
  34. package/dist/esm/crm-bonus.entry.js +1 -1
  35. package/dist/esm/crm-giftback-form_2.entry.js +1 -1
  36. package/dist/esm/crm-tooltip_4.entry.js +7 -7
  37. package/dist/esm/crm-tooltip_4.entry.js.map +1 -1
  38. package/dist/esm/{i18n-e8150dff.js → i18n-b9d8b0cc.js} +2 -2
  39. package/dist/esm/{i18n-e8150dff.js.map → i18n-b9d8b0cc.js.map} +1 -1
  40. package/package.json +1 -1
  41. package/dist/components/p-3af6c647.js.map +0 -1
  42. package/dist/crmbonus-component-wake/p-73efceb1.entry.js +0 -2
  43. package/dist/crmbonus-component-wake/p-73efceb1.entry.js.map +0 -1
  44. /package/dist/crmbonus-component-wake/{p-50d1cbaa.entry.js.map → p-68b058e9.entry.js.map} +0 -0
  45. /package/dist/crmbonus-component-wake/{p-68de3204.entry.js.map → p-b307cbed.entry.js.map} +0 -0
  46. /package/dist/crmbonus-component-wake/{p-ac32b78a.entry.js.map → p-ee132b98.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { p as proxyCustomElement, H, h } from './p-9d950d25.js';
2
- import { i as instance } from './p-e8c19a64.js';
2
+ import { i as instance } from './p-c53241bf.js';
3
3
  import { d as defineCustomElement$3 } from './p-30d12b1b.js';
4
4
  import { d as defineCustomElement$2 } from './p-8f1485e7.js';
5
5
  import { d as defineCustomElement$1 } from './p-82ea12ff.js';
@@ -106,4 +106,4 @@ defineCustomElement();
106
106
 
107
107
  export { GiftbackPin as G, defineCustomElement as d };
108
108
 
109
- //# sourceMappingURL=p-70b3b7b3.js.map
109
+ //# sourceMappingURL=p-ef285153.js.map
@@ -1 +1 @@
1
- {"file":"p-70b3b7b3.js","mappings":"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","names":["i18next"],"sources":["src/components/giftback-form/subcomponents/pin-form/pin-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/giftback-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/subcomponents/pin-form/pin-form.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.form-container-pin {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.pin-container {\n display: flex;\n /* margin: 26px 0; */\n justify-content: start;\n gap: 10px;\n}\n\n.pin-container input {\n width: 100%;\n height: 48px;\n /* font-size: 14px; */\n text-align: center;\n border: 1px solid #ccc;\n border-radius: 5px;\n}\n\nbutton {\n padding: 10px 20px;\n background-color: #ddd;\n border: none;\n border-radius: 5px;\n cursor: pointer;\n}\n\n\n.success {\n color: green;\n margin-top: 10px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n border-radius: 10px;\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n /* font-size: 20px; */\n cursor: pointer;\n}\n\n.button-cancel {\n top: 50%;\n background-color: #ffffff;\n color: #1e1c1c;\n border: 1px solid gray;\n border-radius: 10px;\n padding: 10px;\n min-height: 30px;\n min-width: 120px;\n /* font-size: 19px; */\n cursor: pointer;\n}\n\n.crm-description {\n /* font-size: 14px; */\n width: 100%;\n display: flex;\n gap: 9px;\n flex-wrap: wrap;\n}\n\n.crm-description a {\n font-weight: bold;\n cursor: pointer;\n text-decoration: underline;\n}\n\n.crm-description div {\n display: flex;\n gap: 5px;\n}","* {\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-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 font-size: .875rem;\n line-height: 1.25rem;\n \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, h, Prop, State } from '@stencil/core';\nimport { IPinSent } from '../../../../dto/pin.sent';\nimport i18next from '../../../../i18n/i18n'\nimport { IInfoStore } from '../../../../helpers/info.config.helper';\n\n@Component({\n tag: 'pin-form',\n styleUrls: ['pin-form.css', '../../giftback-form.css'],\n shadow: true,\n})\nexport class GiftbackPin {\n\n @Prop() validate: (pin: string) => void;\n @Prop() cancel: () => void;\n @Prop() resend: () => void;\n\n @Prop() sent: IPinSent;\n @Prop() loading: boolean = false;\n @Prop() phone: string;\n @Prop() config: IInfoStore;\n\n @State() pin: string[] = ['', '', '', ''];\n @State() isVerified: boolean = false;\n @State() canResend: boolean = false;\n\n componentWillLoad() {\n this.canResend = false;\n }\n\n handleInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement;\n const value = input.value.slice(0, 1); // Limitar a um único dígito\n this.pin[index] = value;\n\n // Focar no próximo campo, se possível\n if (value && index < this.pin.length - 1) {\n const nextInput = input.nextElementSibling as HTMLInputElement;\n nextInput?.focus();\n }\n\n this.pin = [...this.pin];\n }\n\n validatePin() {\n this.validate(this.pin.join(\"\"))\n }\n\n verifyPin() {\n const pinCode = this.pin.join('');\n if (pinCode === '9999') {\n this.isVerified = true;\n }\n }\n\n handleTimeout() {\n this.canResend = true;\n }\n\n async handleResend() {\n await this.resend();\n\n this.canResend = false;\n this.pin = ['', '', '', '']\n }\n\n render() {\n return (\n <div class=\"crm-phone-form\">\n <label class=\"crm-subtitle\" >{i18next.t('pin-sutitle')} <strong>+55 {this.phone}</strong></label>\n <div class=\"pin-container\">\n {this.pin.map((_, index) => (\n <input\n type=\"text\"\n maxLength={1}\n value={this.pin[index]}\n onInput={(event) => this.handleInput(event, index)}\n />\n ))}\n </div>\n\n <slot></slot>\n\n <p class=\"crm-description\"> Não recebeu?\n {\n !this.canResend && <label> Reenviar em <countdown-timer initialValue={30} downtime={() => this.handleTimeout()} /> </label>\n }\n {\n this.canResend && (\n <div >\n <a onClick={() => this.handleResend()}>Reenviar</a>\n <a onClick={() => this.cancel()}>Trocar número</a>\n </div>\n )\n }\n </p>\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.validatePin()} />\n </div >\n );\n }\n}\n"],"version":3}
1
+ {"file":"p-ef285153.js","mappings":"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","names":["i18next"],"sources":["src/components/giftback-form/subcomponents/pin-form/pin-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/giftback-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/subcomponents/pin-form/pin-form.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.form-container-pin {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.pin-container {\n display: flex;\n /* margin: 26px 0; */\n justify-content: start;\n gap: 10px;\n}\n\n.pin-container input {\n width: 100%;\n height: 48px;\n /* font-size: 14px; */\n text-align: center;\n border: 1px solid #ccc;\n border-radius: 5px;\n}\n\nbutton {\n padding: 10px 20px;\n background-color: #ddd;\n border: none;\n border-radius: 5px;\n cursor: pointer;\n}\n\n\n.success {\n color: green;\n margin-top: 10px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n border-radius: 10px;\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n /* font-size: 20px; */\n cursor: pointer;\n}\n\n.button-cancel {\n top: 50%;\n background-color: #ffffff;\n color: #1e1c1c;\n border: 1px solid gray;\n border-radius: 10px;\n padding: 10px;\n min-height: 30px;\n min-width: 120px;\n /* font-size: 19px; */\n cursor: pointer;\n}\n\n.crm-description {\n /* font-size: 14px; */\n width: 100%;\n display: flex;\n gap: 9px;\n flex-wrap: wrap;\n}\n\n.crm-description a {\n font-weight: bold;\n cursor: pointer;\n text-decoration: underline;\n}\n\n.crm-description div {\n display: flex;\n gap: 5px;\n}","* {\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-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 font-size: .875rem;\n line-height: 1.25rem;\n \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, h, Prop, State } from '@stencil/core';\nimport { IPinSent } from '../../../../dto/pin.sent';\nimport i18next from '../../../../i18n/i18n'\nimport { IInfoStore } from '../../../../helpers/info.config.helper';\n\n@Component({\n tag: 'pin-form',\n styleUrls: ['pin-form.css', '../../giftback-form.css'],\n shadow: true,\n})\nexport class GiftbackPin {\n\n @Prop() validate: (pin: string) => void;\n @Prop() cancel: () => void;\n @Prop() resend: () => void;\n\n @Prop() sent: IPinSent;\n @Prop() loading: boolean = false;\n @Prop() phone: string;\n @Prop() config: IInfoStore;\n\n @State() pin: string[] = ['', '', '', ''];\n @State() isVerified: boolean = false;\n @State() canResend: boolean = false;\n\n componentWillLoad() {\n this.canResend = false;\n }\n\n handleInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement;\n const value = input.value.slice(0, 1); // Limitar a um único dígito\n this.pin[index] = value;\n\n // Focar no próximo campo, se possível\n if (value && index < this.pin.length - 1) {\n const nextInput = input.nextElementSibling as HTMLInputElement;\n nextInput?.focus();\n }\n\n this.pin = [...this.pin];\n }\n\n validatePin() {\n this.validate(this.pin.join(\"\"))\n }\n\n verifyPin() {\n const pinCode = this.pin.join('');\n if (pinCode === '9999') {\n this.isVerified = true;\n }\n }\n\n handleTimeout() {\n this.canResend = true;\n }\n\n async handleResend() {\n await this.resend();\n\n this.canResend = false;\n this.pin = ['', '', '', '']\n }\n\n render() {\n return (\n <div class=\"crm-phone-form\">\n <label class=\"crm-subtitle\" >{i18next.t('pin-sutitle')} <strong>+55 {this.phone}</strong></label>\n <div class=\"pin-container\">\n {this.pin.map((_, index) => (\n <input\n type=\"text\"\n maxLength={1}\n value={this.pin[index]}\n onInput={(event) => this.handleInput(event, index)}\n />\n ))}\n </div>\n\n <slot></slot>\n\n <p class=\"crm-description\"> Não recebeu?\n {\n !this.canResend && <label> Reenviar em <countdown-timer initialValue={30} downtime={() => this.handleTimeout()} /> </label>\n }\n {\n this.canResend && (\n <div >\n <a onClick={() => this.handleResend()}>Reenviar</a>\n <a onClick={() => this.cancel()}>Trocar número</a>\n </div>\n )\n }\n </p>\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.validatePin()} />\n </div >\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { G as GiftbackPin, d as defineCustomElement$1 } from './p-70b3b7b3.js';
1
+ import { G as GiftbackPin, d as defineCustomElement$1 } from './p-ef285153.js';
2
2
 
3
3
  const PinForm = GiftbackPin;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,2 +1,2 @@
1
- import{p as e,b as n}from"./p-8c362346.js";export{s as setNonce}from"./p-8c362346.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-50d1cbaa",[[1,"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],styles:[32],reservedInfo:[32],resetBonus:[64],setloading:[64],reprocess:[64]}]]],["p-09e26da2",[[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-53b6a7e8",[[1,"phone-cancel-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-1b0969ff",[[1,"phone-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-ac32b78a",[[0,"crm-bonus-note",{cart:[8],cartWake:[32],url:[32],config:[32],bonus:[32],showEdit:[32],styles:[32]}]]],["p-d3ed9573",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-08af385f",[[0,"pedido-finalizado",{cart:[8]}]]],["p-cc754208",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}]]],["p-5cfc2702",[[1,"countdown-timer",{downtime:[16],initialValue:[2,"initial-value"],dates:[16],seconds:[32],minutes:[32]}]]],["p-402ead13",[[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-a6a4a314",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-73efceb1",[[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],infoBonus:[16],storeName:[1,"store-name"],usedValue:[32],selectedOption:[32],sliderPosition:[32],sliderValuePosition:[32],loadingTime:[32]},null,{bonus:["changedBonus"]}],[0,"crm-tooltip",{text:[1],identity:[1]}]]],["p-68de3204",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],loadProducts:[16],loadAll:[16],customStyles:[8,"custom-styles"],reservedInfo:[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-bcb65b4e",[[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]}],[1,"name-input",{value:[1],loading:[4],applyName:[16],cancel:[16],newValue:[32],message:[32]}],[1,"giftback-finish"]]]],e)}));
1
+ import{p as e,b as n}from"./p-8c362346.js";export{s as setNonce}from"./p-8c362346.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-68b058e9",[[1,"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],styles:[32],reservedInfo:[32],resetBonus:[64],setloading:[64],reprocess:[64]}]]],["p-09e26da2",[[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-53b6a7e8",[[1,"phone-cancel-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-1b0969ff",[[1,"phone-input",{sendPin:[16],loading:[4],value:[1]}]]],["p-ee132b98",[[0,"crm-bonus-note",{cart:[8],cartWake:[32],url:[32],config:[32],bonus:[32],showEdit:[32],styles:[32]}]]],["p-d3ed9573",[[1,"app-modal",{isOpen:[516,"is-open"],modalTitle:[1,"modal-title"]}]]],["p-08af385f",[[0,"pedido-finalizado",{cart:[8]}]]],["p-cc754208",[[0,"crm-button",{txtBtn:[1,"txt-btn"],loading:[4],handleClick:[16]}]]],["p-5cfc2702",[[1,"countdown-timer",{downtime:[16],initialValue:[2,"initial-value"],dates:[16],seconds:[32],minutes:[32]}]]],["p-402ead13",[[1,"phone-input-mask",{initialValue:[1,"initial-value"],disabled:[4],phone:[32],message:[32],getPhone:[64]}]]],["p-a6a4a314",[[1,"loading-spinner",{size:[1],color:[1]}]]],["p-898ab1b3",[[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],infoBonus:[16],storeName:[1,"store-name"],usedValue:[32],selectedOption:[32],sliderPosition:[32],sliderValuePosition:[32],loadingTime:[32]},null,{bonus:["changedBonus"]}],[0,"crm-tooltip",{text:[1],identity:[1]}]]],["p-b307cbed",[[0,"crm-giftback-form",{storeName:[8,"storename"],cartId:[8,"cart-id"],products:[16],customer:[16],loadProducts:[16],loadAll:[16],customStyles:[8,"custom-styles"],reservedInfo:[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-bcb65b4e",[[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]}],[1,"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-8c362346.js";import{C as i,U as o}from"./p-3eba0eba.js";import{d as e,S as a}from"./p-ecc51430.js";import{i as n}from"./p-e8c19a64.js";import{g as r,a as c,C as h}from"./p-b57fbd6d.js";var d;(function(t){t["P"]="Promocao"})(d||(d={}));function l(t=[]){const s=[];for(const i of t){let t=u(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 u(t=[]){let s=0;for(const i of t){if(i.Tipo===d.P){s+=i.Valor}}return s}const f=".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;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 .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{color:#df4d4d;margin-top:5px}";const m=f;const p=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;this.styles=e;this.reservedInfo=undefined}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(a.STEP_PHONE)}finally{this.loading=false}}async setloading(){this.loading_reprocess=!this.loading_reprocess}async reprocess(){console.log("[CRMBONUS] - reprocess");this.loading_reprocess=true;try{const t=localStorage.getItem(o);if(!t)return;this.cartWake=await r();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async componentWillLoad(){window.addEventListener("productRemovedFromCart",(async()=>{console.log("[CRMBONUS] - productRemovedFromCart");await this.reprocess()}));window.addEventListener("productAddedToCart",(async()=>{console.log("[CRMBONUS] - productAddedToCart");await this.reprocess()}));document.querySelectorAll("form").forEach((t=>{t.addEventListener("submit",(()=>{console.log("[CRMBONUS] - Formulário está sendo submetido!");setTimeout((async()=>{await this.reprocess()}))}))}));n.changeLanguage(n.language);await this.handleLoad();await this.loadSession();await this.loadConfigStore()}async loadConfigStore(){const[t,s]=await Promise.all([this.crmBonusService.getCustomization(this.cartWake.store.name),c(this.cartWake.id,this.cartWake.store.name)]);console.log("[infoBonus]",s);this.reservedInfo=s;if(t.keepStoreFrontStyle){this.styles=null}}async handleLoad(){try{this.cartWake=this.cart?new h(JSON.parse(this.cart)):await r();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(a.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(a.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 l(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(a.STEP_NAME);this.showModal=true}render(){return s("loading-container",{key:"20e05271df4405a6ca83fe154a3305ef74358004",loading:this.loading_reprocess},s("crm-giftback-form",{key:"c67857b2ea47c32fd5ca1419cc7cc5909f0bc310",customStyles:this.styles,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(),loadAll:()=>this.handleLoad(),reservedInfo:this.reservedInfo}))}static get assetsDirs(){return["assets"]}};p.style=m;export{p as crm_bonus};
2
- //# sourceMappingURL=p-50d1cbaa.entry.js.map
1
+ import{r as t,h as s}from"./p-8c362346.js";import{C as i,U as o}from"./p-3eba0eba.js";import{d as e,S as n}from"./p-ecc51430.js";import{i as a}from"./p-c53241bf.js";import{g as r,a as c,C as h}from"./p-b57fbd6d.js";var d;(function(t){t["P"]="Promocao"})(d||(d={}));function l(t=[]){const s=[];for(const i of t){let t=u(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 u(t=[]){let s=0;for(const i of t){if(i.Tipo===d.P){s+=i.Valor}}return s}const f=".container-button{cursor:pointer;padding:5px 5px 5px 14px;}.section-crm{border:1px solid #dbd4d4;text-align:-webkit-center;margin-bottom:20px}.section-cart-crm{margin-top:10px}.section-cart-crm p{padding:0;margin:0px 0px 0px 15px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;padding:15px;min-height:30px;min-width:120px;cursor:pointer;margin-left:10px;height:70px}.form-container{width:97%;display:flex;justify-content:space-around}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;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 .btnCrm{background:#00162e;border-color:#00162e;width:30%;color:#fff}.message-alert{color:#df4d4d;margin-top:5px}";const m=f;const p=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;this.styles=e;this.reservedInfo=undefined}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(n.STEP_PHONE)}finally{this.loading=false}}async setloading(){this.loading_reprocess=!this.loading_reprocess}async reprocess(){console.log("[CRMBONUS] - reprocess");this.loading_reprocess=true;try{const t=localStorage.getItem(o);if(!t)return;this.cartWake=await r();await this.resetBonus()}catch(t){console.debug("[watchProducts]",t.message)}finally{this.loading_reprocess=false}}async componentWillLoad(){window.addEventListener("productRemovedFromCart",(async()=>{console.log("[CRMBONUS] - productRemovedFromCart");await this.reprocess()}));window.addEventListener("productAddedToCart",(async()=>{console.log("[CRMBONUS] - productAddedToCart");await this.reprocess()}));document.querySelectorAll("form").forEach((t=>{t.addEventListener("submit",(()=>{console.log("[CRMBONUS] - Formulário está sendo submetido!");setTimeout((async()=>{await this.reprocess()}))}))}));a.changeLanguage(a.language);await this.handleLoad();await this.loadSession();await this.loadConfigStore()}async loadConfigStore(){const[t,s]=await Promise.all([this.crmBonusService.getCustomization(this.cartWake.store.name),c(this.cartWake.id,this.cartWake.store.name)]);console.log("[infoBonus]",s);this.reservedInfo=s;if(t.keepStoreFrontStyle){this.styles=null}}async handleLoad(){try{this.cartWake=this.cart?new h(JSON.parse(this.cart)):await r();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(n.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(n.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 l(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(n.STEP_NAME);this.showModal=true}render(){return s("loading-container",{key:"20e05271df4405a6ca83fe154a3305ef74358004",loading:this.loading_reprocess},s("crm-giftback-form",{key:"c67857b2ea47c32fd5ca1419cc7cc5909f0bc310",customStyles:this.styles,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(),loadAll:()=>this.handleLoad(),reservedInfo:this.reservedInfo}))}static get assetsDirs(){return["assets"]}};p.style=m;export{p as crm_bonus};
2
+ //# sourceMappingURL=p-68b058e9.entry.js.map
@@ -0,0 +1,2 @@
1
+ import{r as e,h as i,H as t}from"./p-8c362346.js";import{i as n}from"./p-c53241bf.js";import{U as o}from"./p-3eba0eba.js";import{d as a,a as c}from"./p-af3ba015.js";import{p as r}from"./p-b57fbd6d.js";const d="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPg0KPHN2ZyB3aWR0aD0iODAwcHgiIGhlaWdodD0iODAwcHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxwYXRoIGQ9Ik0xMiAxNy43NUMxMi40MTQyIDE3Ljc1IDEyLjc1IDE3LjQxNDIgMTIuNzUgMTdWMTFDMTIuNzUgMTAuNTg1OCAxMi40MTQyIDEwLjI1IDEyIDEwLjI1QzExLjU4NTggMTAuMjUgMTEuMjUgMTAuNTg1OCAxMS4yNSAxMVYxN0MxMS4yNSAxNy40MTQyIDExLjU4NTggMTcuNzUgMTIgMTcuNzVaIiBmaWxsPSIjMUMyNzRDIi8+DQo8cGF0aCBkPSJNMTIgN0MxMi41NTIzIDcgMTMgNy40NDc3MiAxMyA4QzEzIDguNTUyMjggMTIuNTUyMyA5IDEyIDlDMTEuNDQ3NyA5IDExIDguNTUyMjggMTEgOEMxMSA3LjQ0NzcyIDExLjQ0NzcgNyAxMiA3WiIgZmlsbD0iIzFDMjc0QyIvPg0KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xLjI1IDEyQzEuMjUgNi4wNjI5NCA2LjA2Mjk0IDEuMjUgMTIgMS4yNUMxNy45MzcxIDEuMjUgMjIuNzUgNi4wNjI5NCAyMi43NSAxMkMyMi43NSAxNy45MzcxIDE3LjkzNzEgMjIuNzUgMTIgMjIuNzVDNi4wNjI5NCAyMi43NSAxLjI1IDE3LjkzNzEgMS4yNSAxMlpNMTIgMi43NUM2Ljg5MTM3IDIuNzUgMi43NSA2Ljg5MTM3IDIuNzUgMTJDMi43NSAxNy4xMDg2IDYuODkxMzcgMjEuMjUgMTIgMjEuMjVDMTcuMTA4NiAyMS4yNSAyMS4yNSAxNy4xMDg2IDIxLjI1IDEyQzIxLjI1IDYuODkxMzcgMTcuMTA4NiAyLjc1IDEyIDIuNzVaIiBmaWxsPSIjMUMyNzRDIi8+DQo8L3N2Zz4=";const s=".crm-tooltip-container {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@container (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@container (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}";const l=s;const p=class{constructor(i){e(this,i);this.text=undefined;this.identity=undefined}render(){return i("div",{key:"3582af9cc751c10b237ab086a711ecaaedaded27",class:"crm-tooltip-container crm-tooltip"},i("img",{key:"4f8c3e3da55ec000759864d8facde5002c759426",src:d}),i("span",{key:"7f1f591d486d51c31adc5c383dcbbcce6732f765",id:this.identity,class:"tooltiptext"},this.text))}};p.style=l;const f=":host{--text-color:#6D6D5F}.giftback-container{display:flex;flex-direction:column;gap:14px}h3{margin-bottom:8px;color:#333}.container-description{display:flex;align-items:center;gap:5px;margin:0 0 10px 0}.container-description p{font-weight:400;margin:0px}p{color:#000}.value-display h2{color:#6D6D5F;margin:16px 0}input[type='range']{width:100%;margin:12px 0;-webkit-appearance:none;background:#ddd;height:4px;border-radius:4px;outline:none;padding:3px 0px 3px 3px}input[type=\"range\"]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:20px;height:20px;background:rgb(109, 109, 95);border-radius:50%;cursor:pointer}.options{margin:0px 0;display:flex;gap:10px;flex-direction:column}.options label{display:flex;margin:0px 0;color:#333;align-items:center}.options input[type='radio']{margin-right:8px;height:16px;width:16px}.options input[type='radio']{appearance:none;-webkit-appearance:none;margin-right:8px;width:16px;height:16px;border:2px solid #ddd;border-radius:50%;background-color:#fff;cursor:pointer;transition:all 0.3s;padding:0px}.options input[type='radio']:checked{border-color:#000;background-color:#FAFAFA;border:4px solid #000}.info-box{background-color:#f9f9f9;border:1px solid #e0e0e0;border-radius:4px;padding:8px;color:#262626;line-height:20px}.info-icon{cursor:pointer;color:#888}h3{margin-bottom:8px;color:#333}.slider-wrapper{position:relative;margin:21px 0px 0px 0px}.slider{width:100%;-webkit-appearance:none;background:#ddd;height:4px;border-radius:2px;outline:none}.slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;background:var(--text-color);border-radius:50%;cursor:pointer}.slider-value{position:absolute;top:-30px;font-weight:700;color:var(--text-color);transform:translateX(-50%);white-space:nowrap;}.options-option{display:flex}";const h=f;const b=class{constructor(i){e(this,i);this.usedValue=0;this.selectedOption="none";this.loading=false;this.bonus={totalBonus:0,cartId:"",minimumPurchase:0,bonusBalance:0,calculatedValue:0,firstValidityDate:"",totalValue:0};this.reserve=undefined;this.cancel=undefined;this.config=undefined;this.infoBonus=undefined;this.storeName=undefined;this.sliderPosition=0;this.sliderValuePosition=0;this.loadingTime=false}changedBonus(){this.updateBonus()}updateBonus(){this.usedValue=this.bonus.bonusBalance;this.buildPositionSlider(0,this.bonus.totalBonus)}componentWillLoad(){this.updateBonus();this.selectedOption=localStorage.getItem(o)}handleSliderChange(e){const i=e.target;this.usedValue=parseFloat(i.value);this.buildPositionSlider(parseFloat(i.min),parseFloat(i.max))}componentDidLoad(){var e;if(this.bonus){this._refIinputRange.value=(e=this.bonus)===null||e===void 0?void 0:e.bonusBalance.toString()}}buildPositionSlider(e,i){const t=i*.1;const n=(this.usedValue-e)/(i-e)*100;this.sliderPosition=n;this.sliderValuePosition=n+(this.usedValue<=t?10:0)}async handleOptionChange(e){this.selectedOption=e;localStorage.setItem(o,e);localStorage.removeItem("bc:time-allow");switch(this.selectedOption){case"use":await this.reserve(this.usedValue);break;case"dontUse":await this.cancel();break}}showTime(){if(!this.infoBonus)return false;return!this.infoBonus.isExpired()}getTime(){var e,i;const t=new Date((i=(e=this.infoBonus)===null||e===void 0?void 0:e.metadata)===null||i===void 0?void 0:i.createdAt);const n=new Date(t);n.setMinutes(n.getMinutes()+6);return{createdAt:t,expiration:n}}async downtime(){await r(this.storeName,this.bonus.cartId,{createdAt:null})}render(){var e,t,o;const r=this.bonus.minimumPurchase-this.bonus.totalValue;const d=n.t("giftDescription",{amount:`${this.bonus.totalBonus.toFixed(2).replace(".",",")}`,custom_name:"Giftback"});const s=a(r);return i("div",{key:"7ee0699043559c731e310c96401bcc771355e69a",class:"giftback-container"},i("div",{key:"b71239675ce42aa4f6624d317b667864d4d6eef5",class:"container-description"},i("p",{key:"1dd1a053a72936ec5da769dca945d31406fa3ebf",innerHTML:d}),i("crm-tooltip",{key:"cf0858a52b8ea1d77221ff3f41dadff604fc8e1f",identity:"crm-role-description",text:n.t("labelUseGiftback",{minimumPurchase:this.bonus.minimumPurchase,expírationDate:c(this.bonus.firstValidityDate)})})),i("div",{key:"9015cba54d44de0a324d7988b77fa99ad84926a0",class:"slider-wrapper"},i("div",{key:"64191e7b52279beb9f056fcc870f0105a1f0dd81",class:"slider-value",style:{left:`calc(${this.sliderValuePosition}% - 20px)`}},"R$ ",this.usedValue.toFixed(2).replace(".",",")),i("input",{key:"61e4340cf14e7b93d7fc3e5dffb4b78555617136",ref:e=>this._refIinputRange=e,id:"position_value_id",disabled:true,type:"range",min:"0",max:this.bonus.totalBonus,value:this.usedValue,class:"slider",step:"0.01",onInput:e=>this.handleSliderChange(e),style:{background:`linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`}})),s.isComplete&&i("p",{key:"122c8ea188ff2ccf75e0faf4f80e3e1ca88529db"},n.t("maxAmount")),!s.isComplete&&i("div",{key:"e9222a7f225d7caa715bd959074c6e8ba5cf21ac",class:"container-description"},i("p",{key:"b5294e55da5af17c73c17c6b015746b26f075501"},"Adicione ",i("strong",{key:"6304ffef00a53c2d6576070d464d79e35074d14b"},"R$ ",r<0?"0,00":r.toFixed(2).replace(".",","))," ao carrinho para atingir o valor máximo!"),i("crm-tooltip",{key:"965b7bd00789b8b8dc00439e8611cdb2341c762e",identity:"crm-max-description",text:n.t("labelamountPartial")})),i("div",{key:"c17234e28ba1b2c732ffce295149a9491747e9f2",class:"options"},i("div",{key:"f67b0fcbd130be6c6c93e30322c7970b6791ac75",class:"options-option"},i("input",{key:"335ee43aae0344a066e791ca9ccfc6f4aaae11d7",disabled:this.showTime(),type:"radio",name:"giftbackOption",value:"use",checked:this.selectedOption==="use",onChange:()=>this.handleOptionChange("use")}),i("p",{key:"efb1dc748d85aca38f52fb2817100f2f8d7c56e2"},"Usar o meu ",(e=this.config)===null||e===void 0?void 0:e.giftbackTitle)),i("div",{key:"9162b1f79d35331522de68020799a18558746c3e",class:"options-option"},i("input",{key:"18f9a8f963bb6de8ef7d50df3cc2026238ed9c6e",disabled:this.showTime(),type:"radio",name:"giftbackOption",value:"dontUse",checked:this.selectedOption==="dontUse",onChange:()=>this.handleOptionChange("dontUse")}),i("p",{key:"1641d0f9543df7f2944b5ad495267d46bfadb79f"},"Não usar o meu ",(t=this.config)===null||t===void 0?void 0:t.giftbackTitle))),this.showTime()&&i("div",{key:"519560cff38936ea193513fb9567abbd93d2e612",class:"info-box"},"Após ",i("countdown-timer",{key:"3dabd9cf02437c102e533499ccb12cc16206fc7b",dates:this.getTime(),downtime:()=>{this.loadingTime=true}}),", você poderá alterar sua escolha de usar ou não o Giftback."),!((o=this===null||this===void 0?void 0:this.infoBonus)===null||o===void 0?void 0:o.isBonusProcessed)&&i("div",{key:"0aa87e872d44e41114ad8a4e3c145382c6b16f75",class:"info-box"},"O Giftback será aplicado na próxima etapa."))}static get watchers(){return{bonus:["changedBonus"]}}};b.style=h;const g="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:.875rem;line-height:1.25rem}.crm-title{font-weight:700;line-height:20px;color:#262626;}.crm-message-info{color:#619013;font-weight:500;}.crm-message-error{color:#E11D48;font-weight:500;}";const x=g;const u=class{constructor(i){e(this,i);this.value=undefined;this.loading=undefined;this.handlerSubmit=undefined;this.config=undefined}async handlePhone(){const e=await this.phoneInputMask.getPhone();await this.handlerSubmit(e)}render(){var e;return i(t,{key:"33cfa4dfdd805c81743db679267b82a63fa753e7",class:"crm-phone-form"},i("p",{key:"0ef790c33e48c646898feb1a5cdb98cea7e5be43",class:"crm-subtitle"},"Digite o seu celular para verificar se há desconto disponível nessa compra:"),i("phone-input-mask",{key:"46eb2b3b3741ffce1ff7d28b39c6964180919e1e",initialValue:this.value,ref:e=>this.phoneInputMask=e}),i("crm-button",{key:"9b75600c3c8e0352eab7778f5f281b71035383d8",txtBtn:((e=this.config)===null||e===void 0?void 0:e.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.handlePhone()}))}};u.style=x;const m=":host{display:block}.form-container-pin{display:flex;flex-direction:column;align-items:center}.pin-container{display:flex;justify-content:start;gap:10px}.pin-container input{width:100%;height:48px;text-align:center;border:1px solid #ccc;border-radius:5px}button{padding:10px 20px;background-color:#ddd;border:none;border-radius:5px;cursor:pointer}.success{color:green;margin-top:10px}.button{top:50%;background-color:#6c6c7e;color:#fff;border:none;border-radius:10px;padding:15px;min-height:30px;min-width:120px;cursor:pointer}.button-cancel{top:50%;background-color:#ffffff;color:#1e1c1c;border:1px solid gray;border-radius:10px;padding:10px;min-height:30px;min-width:120px;cursor:pointer}.crm-description{width:100%;display:flex;gap:9px;flex-wrap:wrap}.crm-description a{font-weight:bold;cursor:pointer;text-decoration:underline}.crm-description div{display:flex;gap:5px}";const y=m;const k="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:.875rem;line-height:1.25rem}.crm-title{font-weight:700;line-height:20px;color:#262626;}.crm-message-info{color:#619013;font-weight:500;}.crm-message-error{color:#E11D48;font-weight:500;}";const M=k;const I=class{constructor(i){e(this,i);this.validate=undefined;this.cancel=undefined;this.resend=undefined;this.sent=undefined;this.loading=false;this.phone=undefined;this.config=undefined;this.pin=["","","",""];this.isVerified=false;this.canResend=false}componentWillLoad(){this.canResend=false}handleInput(e,i){const t=e.target;const n=t.value.slice(0,1);this.pin[i]=n;if(n&&i<this.pin.length-1){const e=t.nextElementSibling;e===null||e===void 0?void 0:e.focus()}this.pin=[...this.pin]}validatePin(){this.validate(this.pin.join(""))}verifyPin(){const e=this.pin.join("");if(e==="9999"){this.isVerified=true}}handleTimeout(){this.canResend=true}async handleResend(){await this.resend();this.canResend=false;this.pin=["","","",""]}render(){var e;return i("div",{key:"15aa6a8fe4e0fa3ea1a35e68b7853a4ca392899c",class:"crm-phone-form"},i("label",{key:"83d48a38bc6cbbdbd391d7253a1e1fc3d01c44d2",class:"crm-subtitle"},n.t("pin-sutitle")," ",i("strong",{key:"e88a16f28032afb4746dc8f97e83e2794b75f3fd"},"+55 ",this.phone)),i("div",{key:"516969313ac099dfa1e4761784ef5f4e5c5225c3",class:"pin-container"},this.pin.map(((e,t)=>i("input",{type:"text",maxLength:1,value:this.pin[t],onInput:e=>this.handleInput(e,t)})))),i("slot",{key:"b0ffbe2329a9e010766f3cf8e52943ebdbfe101e"}),i("p",{key:"91e9372e69f32ce93806ca194bf6347cd0a0a3ce",class:"crm-description"}," Não recebeu?",!this.canResend&&i("label",{key:"ed22df22e0498434ff3d6a187387aa8ddc48f6ef"}," Reenviar em ",i("countdown-timer",{key:"a81630d82997e9b74ceb08b52cd818d0aa81f00e",initialValue:30,downtime:()=>this.handleTimeout()})," "),this.canResend&&i("div",{key:"417c6dc13b0e87993c8dbb71d9e263678e1025d8"},i("a",{key:"9832f3c85b503e820d2452d76dc60a008ec250c9",onClick:()=>this.handleResend()},"Reenviar"),i("a",{key:"9c6ff0ab7b1e0f46235eed0a2e0c2142f3bd41f6",onClick:()=>this.cancel()},"Trocar número"))),i("crm-button",{key:"f347d33b491d5dae491ce5ed77e7f20734cfa76b",txtBtn:((e=this.config)===null||e===void 0?void 0:e.btnApplyBonusLabel)||"Avançar",loading:this.loading,handleClick:()=>this.validatePin()}))}};I.style=y+M;export{p as crm_tooltip,b as giftback_info,u as phone_form,I as pin_form};
2
+ //# sourceMappingURL=p-898ab1b3.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["infoCircleSvgrepoComSvg","crmTooltipCss","CrmTooltipStyle0","Tooltip","render","h","key","class","src","info","id","this","identity","text","giftbackInfoCss","GiftbackInfoStyle0","GiftbackInfo","totalBonus","cartId","minimumPurchase","bonusBalance","calculatedValue","firstValidityDate","totalValue","changedBonus","updateBonus","usedValue","bonus","buildPositionSlider","componentWillLoad","selectedOption","localStorage","getItem","USED_KEY","handleSliderChange","event","input","target","parseFloat","value","min","max","componentDidLoad","_refIinputRange","_a","toString","percentage_init","percentage","sliderPosition","sliderValuePosition","handleOptionChange","option","setItem","removeItem","reserve","cancel","showTime","infoBonus","isExpired","getTime","createdAt","Date","_b","metadata","expiration","setMinutes","getMinutes","downtime","persisteMetadata","storeName","remainingGiftback","translateDescription","i18next","t","amount","toFixed","replace","custom_name","limit","defineLimit","innerHTML","formatDateToBr","style","left","ref","disabled","type","step","onInput","background","isComplete","name","checked","onChange","config","giftbackTitle","dates","loadingTime","_c","isBonusProcessed","giftbackFormCss","PhoneFormStyle0","PhoneForm","handlePhone","phone","phoneInputMask","getPhone","handlerSubmit","Host","initialValue","txtBtn","btnApplyBonusLabel","loading","handleClick","pinFormCss","PinFormStyle0","PinFormStyle1","GiftbackPin","canResend","handleInput","index","slice","pin","length","nextInput","nextElementSibling","focus","validatePin","validate","join","verifyPin","pinCode","isVerified","handleTimeout","handleResend","resend","map","_","maxLength","onClick"],"sources":["src/assets/svg/info-circle-svgrepo-com.svg","src/components/tooltip/crm-tooltip.css?tag=crm-tooltip","src/components/tooltip/tooltip.tsx","src/components/giftback-form/subcomponents/giftback-info/giftback-info.css?tag=giftback-info","src/components/giftback-form/subcomponents/giftback-info/giftback-info.tsx","src/components/giftback-form/giftback-form.css?tag=phone-form","src/components/giftback-form/subcomponents/phone-form/phone-form.tsx","src/components/giftback-form/subcomponents/pin-form/pin-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/giftback-form.css?tag=pin-form&encapsulation=shadow","src/components/giftback-form/subcomponents/pin-form/pin-form.tsx"],"sourcesContent":["<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->\r\n<svg width=\"800px\" height=\"800px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n<path d=\"M12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V11C12.75 10.5858 12.4142 10.25 12 10.25C11.5858 10.25 11.25 10.5858 11.25 11V17C11.25 17.4142 11.5858 17.75 12 17.75Z\" fill=\"#1C274C\"/>\r\n<path d=\"M12 7C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9C11.4477 9 11 8.55228 11 8C11 7.44772 11.4477 7 12 7Z\" fill=\"#1C274C\"/>\r\n<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M1.25 12C1.25 6.06294 6.06294 1.25 12 1.25C17.9371 1.25 22.75 6.06294 22.75 12C22.75 17.9371 17.9371 22.75 12 22.75C6.06294 22.75 1.25 17.9371 1.25 12ZM12 2.75C6.89137 2.75 2.75 6.89137 2.75 12C2.75 17.1086 6.89137 21.25 12 21.25C17.1086 21.25 21.25 17.1086 21.25 12C21.25 6.89137 17.1086 2.75 12 2.75Z\" fill=\"#1C274C\"/>\r\n</svg>",".crm-tooltip-container {\n display: flex;\n\n & img {\n width: 16px;\n margin-left: 3px;\n position: relative;\n }\n}\n\n.crm-tooltip {\n position: relative;\n display: inline-block;\n}\n\n.crm-tooltip .tooltiptext {\n visibility: hidden;\n background-color: black;\n color: #fff;\n text-align: center;\n padding: 8px 12px;\n border-radius: 0px;\n position: absolute;\n z-index: 1;\n min-width: 271px;\n top: 100%;\n left: 50%;\n margin-left: -238px;\n}\n\n@container (max-width: 410px) {\n .crm-tooltip .tooltiptext {\n margin-left: -14px;\n }\n\n .crm-tooltip #crm-role-description {\n margin-left: -151px;\n }\n}\n\n@container (max-width: 250px) {\n .crm-tooltip .tooltiptext {\n margin-left: -201px;\n }\n}\n\n.crm-tooltip:hover .tooltiptext {\n visibility: visible;\n}","import { Component, h, Prop } from \"@stencil/core\";\nimport info from '../../assets/svg/info-circle-svgrepo-com.svg';\n\n\n@Component({\n tag: 'crm-tooltip',\n styleUrl: 'crm-tooltip.css'\n})\nexport class Tooltip {\n\n @Prop() text: string;\n @Prop() identity: string;\n\n render() {\n return (\n <div class=\"crm-tooltip-container crm-tooltip\">\n <img src={info} />\n <span id={this.identity} class=\"tooltiptext\">{this.text}</span>\n </div>\n );\n }\n}",":host {\n --text-color: #6D6D5F\n}\n\n.giftback-container {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\nh3 {\n /* font-size: 1.2rem; */\n margin-bottom: 8px;\n color: #333;\n}\n\n.container-description {\n display: flex;\n align-items: center;\n gap: 5px;\n margin: 0 0 10px 0;\n}\n\n.container-description p {\n /* font-size: 14px; */\n font-weight: 400;\n margin: 0px;\n}\n\n\np {\n /* font-size: 14px; */\n color: #000;\n}\n\n.value-display h2 {\n color: #6D6D5F;\n /* Verde para o valor atual */\n /* font-size: 1.6rem; */\n margin: 16px 0;\n}\n\ninput[type='range'] {\n width: 100%;\n margin: 12px 0;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 4px;\n outline: none;\n padding: 3px 0px 3px 3px;\n}\n\n/* input[type='range']::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n border-radius: 50%;\n cursor: pointer;\n} */\n\ninput[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n background: rgb(109, 109, 95);\n /* Cor do botão */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.options {\n margin: 0px 0;\n display: flex;\n gap: 10px;\n flex-direction: column;\n}\n\n.options label {\n display: flex;\n margin: 0px 0;\n /* font-size: 0.9rem; */\n color: #333;\n align-items: center;\n}\n\n.options input[type='radio'] {\n margin-right: 8px;\n height: 16px;\n width: 16px;\n}\n\n.options input[type='radio'] {\n appearance: none;\n -webkit-appearance: none;\n margin-right: 8px;\n width: 16px;\n height: 16px;\n border: 2px solid #ddd;\n border-radius: 50%;\n background-color: #fff;\n cursor: pointer;\n transition: all 0.3s;\n padding: 0px;\n}\n\n.options input[type='radio']:checked {\n border-color: #000;\n background-color: #FAFAFA;\n border: 4px solid #000;\n}\n\n.info-box {\n background-color: #f9f9f9;\n border: 1px solid #e0e0e0;\n border-radius: 4px;\n padding: 8px;\n /* font-size: 14px; */\n color: #262626;\n line-height: 20px;\n}\n\n.info-icon {\n /* font-size: 0.9rem; */\n cursor: pointer;\n color: #888;\n}\n\nh3 {\n /* font-size: 1.2rem; */\n margin-bottom: 8px;\n color: #333;\n}\n\n.slider-wrapper {\n position: relative;\n margin: 21px 0px 0px 0px;\n}\n\n.slider {\n width: 100%;\n -webkit-appearance: none;\n background: #ddd;\n height: 4px;\n border-radius: 2px;\n outline: none;\n}\n\n.slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 16px;\n height: 16px;\n background: var(--text-color);\n /* Azul para o slider */\n border-radius: 50%;\n cursor: pointer;\n}\n\n.slider-value {\n position: absolute;\n top: -30px;\n /* Posição acima do slider */\n /* font-size: 16px; */\n font-weight: 700;\n color: var(--text-color);\n /* Verde para o texto */\n transform: translateX(-50%);\n white-space: nowrap;\n /* margin-left: 23px; */\n}\n\n.options-option {\n display: flex;\n}\n\n\n/* ########################################## */\n","import { Component, Prop, State, Watch, h } from \"@stencil/core\";\nimport { IBonus } from \"../../../../dto/validate.pin.bonus\";\n\nimport i18next from '../../../../i18n/i18n'\nimport { USED_KEY } from \"../../../../utils/keys.storage\";\nimport { defineLimit, formatDateToBr } from \"../../../../utils/utils\";\nimport { IInfoStore } from \"../../../../helpers/info.config.helper\";\nimport { ReservedInfoDTO } from \"../../../../dto/reserved-info.dto\";\nimport { persisteMetadata } from \"../../../../helpers/cart.helper\";\n\n@Component({\n tag: 'giftback-info',\n styleUrls: ['giftback-info.css']\n})\nexport class GiftbackInfo {\n\n private _refIinputRange: HTMLInputElement;\n\n @State() usedValue: number = 0;\n @State() selectedOption: string = 'none';\n\n @Prop() loading: boolean = false;\n @Prop() bonus: Partial<IBonus> = {\n totalBonus: 0,\n cartId: \"\",\n minimumPurchase: 0,\n bonusBalance: 0,\n calculatedValue: 0,\n firstValidityDate: \"\",\n totalValue: 0\n };\n @Prop() reserve: (amountRedeemed: number) => void;\n @Prop() cancel: () => void;\n @Prop() config: IInfoStore;\n @Prop() infoBonus: ReservedInfoDTO;\n @Prop() storeName: string\n\n @State() sliderPosition: number = 0;\n @State() sliderValuePosition: number = 0;\n\n @State() loadingTime = false;\n\n @Watch(\"bonus\")\n changedBonus() {\n this.updateBonus()\n }\n\n private updateBonus() {\n this.usedValue = this.bonus.bonusBalance;\n this.buildPositionSlider(0, this.bonus.totalBonus);\n }\n\n componentWillLoad() {\n this.updateBonus();\n this.selectedOption = localStorage.getItem(USED_KEY);\n }\n\n handleSliderChange(event: Event) {\n const input = event.target as HTMLInputElement;\n this.usedValue = parseFloat(input.value);\n\n // Calculando a posição do texto com base no valor do slider\n // const percentage = ((this.usedValue - parseInt(input.min)) / (parseInt(input.max) - parseInt(input.min))) * 100;\n // this.sliderPosition = percentage;\n\n this.buildPositionSlider(parseFloat(input.min), parseFloat(input.max))\n }\n\n componentDidLoad() {\n if (this.bonus) {\n this._refIinputRange.value = this.bonus?.bonusBalance.toString();\n }\n }\n\n private buildPositionSlider(min: number, max: number) {\n\n const percentage_init = max * 0.1;\n\n // Calculando a posição do texto com base no valor do slider\n const percentage = ((this.usedValue - min) / (max - min)) * 100;\n\n this.sliderPosition = percentage;\n this.sliderValuePosition = percentage + (this.usedValue <= percentage_init ? 10 : 0);\n }\n\n async handleOptionChange(option: string) {\n this.selectedOption = option;\n\n localStorage.setItem(USED_KEY, option);\n\n localStorage.removeItem(\"bc:time-allow\")\n\n switch (this.selectedOption) {\n case 'use':\n await this.reserve(this.usedValue);\n break;\n case 'dontUse':\n await this.cancel();\n break;\n default:\n }\n }\n\n showTime() {\n if (!this.infoBonus) return false;\n\n return !this.infoBonus.isExpired();\n\n // return this.infoBonus.isBonusProcessed\n }\n\n getTime() {\n\n const createdAt = new Date(this.infoBonus?.metadata?.createdAt);\n const expiration = new Date(createdAt);\n expiration.setMinutes(expiration.getMinutes() + 6);\n\n return {\n createdAt,\n expiration\n }\n }\n\n async downtime() {\n await persisteMetadata(this.storeName, this.bonus.cartId, {\n createdAt: null,\n })\n }\n\n render() {\n const remainingGiftback = this.bonus.minimumPurchase - this.bonus.totalValue;\n\n const translateDescription = i18next.t(\"giftDescription\", { amount: `${this.bonus.totalBonus.toFixed(2).replace(\".\", \",\")}`, custom_name: \"Giftback\" })\n\n const limit = defineLimit(remainingGiftback);\n\n return (\n\n <div class=\"giftback-container\">\n <div class=\"container-description\">\n <p innerHTML={translateDescription}></p>\n <crm-tooltip identity=\"crm-role-description\" text={i18next.t(\"labelUseGiftback\", { minimumPurchase: this.bonus.minimumPurchase, expírationDate: formatDateToBr(this.bonus.firstValidityDate) })} />\n </div>\n <div class=\"slider-wrapper\">\n <div\n class=\"slider-value\"\n style={{\n left: `calc(${this.sliderValuePosition}% - 20px)`, // Ajuste para centralizar o texto\n\n }}\n >\n R$ {this.usedValue.toFixed(2).replace(\".\", \",\")}\n </div>\n <input\n ref={ref => this._refIinputRange = ref}\n id=\"position_value_id\"\n disabled\n type=\"range\"\n min=\"0\"\n max={this.bonus.totalBonus}\n value={this.usedValue}\n class=\"slider\"\n step=\"0.01\"\n onInput={(event) => this.handleSliderChange(event)}\n style={{\n background: `linear-gradient(to right, #6D6D5F ${this.sliderPosition}%, #ddd ${this.sliderPosition}%)`,\n }}\n />\n </div>\n\n {\n limit.isComplete && (\n <p>\n {i18next.t(\"maxAmount\")}\n </p>\n )\n }\n\n {\n !limit.isComplete && (\n <div class=\"container-description\">\n <p>\n Adicione <strong>R$ {remainingGiftback < 0 ? \"0,00\" : remainingGiftback.toFixed(2).replace(\".\", \",\")}</strong> ao carrinho para atingir o valor\n máximo!\n </p>\n <crm-tooltip identity=\"crm-max-description\" text={i18next.t(\"labelamountPartial\")} />\n </div>\n )\n }\n\n\n <div class=\"options\">\n <div class=\"options-option\">\n <input\n disabled={this.showTime()}\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"use\"\n checked={this.selectedOption === 'use'}\n onChange={() => this.handleOptionChange('use')}\n />\n <p>Usar o meu {this.config?.giftbackTitle}</p>\n </div>\n <div class=\"options-option\">\n <input\n disabled={this.showTime()}\n type=\"radio\"\n name=\"giftbackOption\"\n value=\"dontUse\"\n checked={this.selectedOption === 'dontUse'}\n onChange={() => this.handleOptionChange('dontUse')}\n />\n <p>Não usar o meu {this.config?.giftbackTitle}</p>\n </div>\n </div>\n\n {\n this.showTime() &&\n (\n <div class=\"info-box\">\n Após <countdown-timer dates={this.getTime()} downtime={() => { this.loadingTime = true }} />, você poderá alterar sua escolha de usar ou não o Giftback.\n </div>\n )\n }\n\n {\n !this?.infoBonus?.isBonusProcessed && (\n <div class=\"info-box\">\n O Giftback será aplicado na próxima etapa.\n </div>\n )\n }\n\n </div>\n );\n }\n}","* {\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-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 font-size: .875rem;\n line-height: 1.25rem;\n \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, Host, Prop, h } from \"@stencil/core\";\nimport { IInfoStore } from \"../../../../helpers/info.config.helper\";\n\n@Component({\n tag: 'phone-form',\n styleUrl: '../../giftback-form.css',\n shadow: false\n})\nexport class PhoneForm {\n\n private phoneInputMask: HTMLPhoneInputMaskElement;\n\n @Prop() value: string;\n @Prop() loading: boolean;\n @Prop() handlerSubmit: (phone: string) => void;\n\n @Prop() config: IInfoStore;\n\n\n async handlePhone() {\n\n const phone = await this.phoneInputMask.getPhone()\n\n await this.handlerSubmit(phone);\n }\n\n\n render() {\n return (\n <Host class=\"crm-phone-form\">\n <p class=\"crm-subtitle\" >Digite o seu celular para verificar se há desconto disponível nessa compra:</p>\n <phone-input-mask initialValue={this.value} ref={ref => this.phoneInputMask = ref} />\n\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.handlePhone() } />\n </Host>\n )\n }\n}",":host {\n display: block;\n}\n\n.form-container-pin {\n display: flex;\n flex-direction: column;\n align-items: center;\n}\n\n.pin-container {\n display: flex;\n /* margin: 26px 0; */\n justify-content: start;\n gap: 10px;\n}\n\n.pin-container input {\n width: 100%;\n height: 48px;\n /* font-size: 14px; */\n text-align: center;\n border: 1px solid #ccc;\n border-radius: 5px;\n}\n\nbutton {\n padding: 10px 20px;\n background-color: #ddd;\n border: none;\n border-radius: 5px;\n cursor: pointer;\n}\n\n\n.success {\n color: green;\n margin-top: 10px;\n}\n\n.button {\n top: 50%;\n background-color: #6c6c7e;\n color: #fff;\n border: none;\n border-radius: 10px;\n padding: 15px;\n min-height: 30px;\n min-width: 120px;\n /* font-size: 20px; */\n cursor: pointer;\n}\n\n.button-cancel {\n top: 50%;\n background-color: #ffffff;\n color: #1e1c1c;\n border: 1px solid gray;\n border-radius: 10px;\n padding: 10px;\n min-height: 30px;\n min-width: 120px;\n /* font-size: 19px; */\n cursor: pointer;\n}\n\n.crm-description {\n /* font-size: 14px; */\n width: 100%;\n display: flex;\n gap: 9px;\n flex-wrap: wrap;\n}\n\n.crm-description a {\n font-weight: bold;\n cursor: pointer;\n text-decoration: underline;\n}\n\n.crm-description div {\n display: flex;\n gap: 5px;\n}","* {\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-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 font-size: .875rem;\n line-height: 1.25rem;\n \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, h, Prop, State } from '@stencil/core';\nimport { IPinSent } from '../../../../dto/pin.sent';\nimport i18next from '../../../../i18n/i18n'\nimport { IInfoStore } from '../../../../helpers/info.config.helper';\n\n@Component({\n tag: 'pin-form',\n styleUrls: ['pin-form.css', '../../giftback-form.css'],\n shadow: true,\n})\nexport class GiftbackPin {\n\n @Prop() validate: (pin: string) => void;\n @Prop() cancel: () => void;\n @Prop() resend: () => void;\n\n @Prop() sent: IPinSent;\n @Prop() loading: boolean = false;\n @Prop() phone: string;\n @Prop() config: IInfoStore;\n\n @State() pin: string[] = ['', '', '', ''];\n @State() isVerified: boolean = false;\n @State() canResend: boolean = false;\n\n componentWillLoad() {\n this.canResend = false;\n }\n\n handleInput(event: Event, index: number) {\n const input = event.target as HTMLInputElement;\n const value = input.value.slice(0, 1); // Limitar a um único dígito\n this.pin[index] = value;\n\n // Focar no próximo campo, se possível\n if (value && index < this.pin.length - 1) {\n const nextInput = input.nextElementSibling as HTMLInputElement;\n nextInput?.focus();\n }\n\n this.pin = [...this.pin];\n }\n\n validatePin() {\n this.validate(this.pin.join(\"\"))\n }\n\n verifyPin() {\n const pinCode = this.pin.join('');\n if (pinCode === '9999') {\n this.isVerified = true;\n }\n }\n\n handleTimeout() {\n this.canResend = true;\n }\n\n async handleResend() {\n await this.resend();\n\n this.canResend = false;\n this.pin = ['', '', '', '']\n }\n\n render() {\n return (\n <div class=\"crm-phone-form\">\n <label class=\"crm-subtitle\" >{i18next.t('pin-sutitle')} <strong>+55 {this.phone}</strong></label>\n <div class=\"pin-container\">\n {this.pin.map((_, index) => (\n <input\n type=\"text\"\n maxLength={1}\n value={this.pin[index]}\n onInput={(event) => this.handleInput(event, index)}\n />\n ))}\n </div>\n\n <slot></slot>\n\n <p class=\"crm-description\"> Não recebeu?\n {\n !this.canResend && <label> Reenviar em <countdown-timer initialValue={30} downtime={() => this.handleTimeout()} /> </label>\n }\n {\n this.canResend && (\n <div >\n <a onClick={() => this.handleResend()}>Reenviar</a>\n <a onClick={() => this.cancel()}>Trocar número</a>\n </div>\n )\n }\n </p>\n <crm-button txtBtn={this.config?.btnApplyBonusLabel || \"Avançar\"} loading={this.loading} handleClick={() => this.validatePin()} />\n </div >\n );\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import{r as t,h as i}from"./p-8c362346.js";import{C as s,g as e,U as a}from"./p-3eba0eba.js";import{S as o}from"./p-ecc51430.js";import{g as n}from"./p-1b441909.js";import{i as c}from"./p-e8c19a64.js";import{p as h}from"./p-b57fbd6d.js";const r="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:.875rem;line-height:1.25rem}.crm-title{font-weight:700;line-height:20px;color:#262626;}.crm-message-info{color:#619013;font-weight:500;}.crm-message-error{color:#E11D48;font-weight:500;}";const d=r;const l=class{constructor(i){t(this,i);this.crmBonusService=s.getInstance();this.storeName=undefined;this.cartId=undefined;this.products=undefined;this.customer=undefined;this.loadProducts=undefined;this.loadAll=undefined;this.customStyles=undefined;this.reservedInfo=undefined;this.value=undefined;this.loading=false;this.message=undefined;this.phone=undefined;this.pinInfo=undefined;this.step=o.STEP_RESERVE;this.bonus=undefined;this.sucess="";this.error="";this.config=undefined;this.hasApplyBonus=false}async setStep(t){this.step=t}async processBonus(t=[],i=false){await this.loadProducts();this.sucess="";console.log("processBonus",[]);if(i){this.products=t}const s=localStorage.getItem(e(this.cartId));if(s){const t=JSON.parse(s);this.bonus=t;this.phone=t.phone;this.pinInfo={storeId:t.storeId,userId:t.userId};await this.validateBonus("2018")}}async handleSendPin(t){await this.loadAll();this.message="";if(!t){this.message="Informe seu telefone";return}this.phone=t;this.sendPin()}async componentWillLoad(){this.sucess="";this.error="";this.config=n(this.storeName);const t=this.getPhoneNumberAgain();if(t){this.step=o.STEP_PHONE;return}await this.processBonus()}getPhoneNumberAgain(){const t=localStorage.getItem(e(this.cartId));if(!t)return true;const i=JSON.parse(t);return!i.hasBonus}convertStringToNumber(){const t=this.phone.replace(/\D/g,"");return Number(t)}async sendPin(){var t,i,s;this.loading=true;this.message="";this.sucess="";this.error="";try{const i=this.convertStringToNumber();const s=localStorage.getItem(`bc:${this.phone}`);if(!s){this.pinInfo=await this.crmBonusService.sendPin(i,(t=this.customer)===null||t===void 0?void 0:t.name,this.storeName)}if(s){const t=JSON.parse(s);this.pinInfo={storeId:t.storeId,userId:t.userId};await this.validateBonus("2018");this.step=o.STEP_RESERVE}else{this.step=o.STEP_PIN}}catch(t){this.message=(s=(i=t===null||t===void 0?void 0:t.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.message}finally{this.loading=false}}changePhone(){this.sucess="";this.error="";this.step=o.STEP_PHONE}async validateBonus(t){var i,s,n;await this.loadProducts();const c=localStorage.getItem(a);if(c=="dontUse"){this.step=o.STEP_RESERVE;return}this.loading=true;this.sucess="";this.error="";const h={pin:t,cellphone:this.convertStringToNumber(),storeId:this.pinInfo.storeId.toString(),userId:this.pinInfo.userId.toString(),checkoutId:this.cartId,checkoutProducts:this.products,name:(i=this.customer)===null||i===void 0?void 0:i.name,storeName:this.storeName};try{this.bonus=await this.crmBonusService.validatePinBonus(h);if(!this.bonus.hasBonus){localStorage.setItem(e(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})));this.loading=false;this.step=o.STEP_NO_BONUS;return}this.sucess="Código validado com sucesso!";localStorage.setItem(e(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})));localStorage.setItem(`bc:${this.phone}`,JSON.stringify(this.bonus));localStorage.setItem(a,"use");localStorage.setItem(this.cartId,this.bonus.bonusBalance.toString());await this.updateMetadata();this.step=o.STEP_RESERVE}catch(t){const i=(n=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||n===void 0?void 0:n.response;if(i&&i.includes("Pin")){this.error="Código inválido!"}else{this.error=i;this.step=o.STEP_NO_BONUS}}finally{this.loading=false}}async updateMetadata(){try{if(!this.reservedInfo.isBonusProcessed)return;if(this.reservedInfo.isExpired()){console.log("[CRM:updateMetadata]");await h(this.storeName,this.cartId,{createdAt:Date.now(),url:window.location.href});localStorage.removeItem("bc:time")}}catch(t){console.error("[CRMBONUS:updateMetadata]: ",t)}}handleCancel(){this.cancel()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartId);localStorage.setItem(a,"dontUse");this.save(0)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async reserveApply(t){this.loading=true;this.message="";try{await this.reserve(t);this.save(t)}catch(t){this.message="ocorreu um error ao solicitar a aplicação do bonus! tente novamente";this.step=o.STEP_NO_BONUS;localStorage.removeItem(this.cartId)}finally{this.loading=false}}save(t){localStorage.setItem(this.cartId,t.toString())}async reserve(t){await this.crmBonusService.reserve({redeemedBonus:t,cartId:this.cartId,ticket:this.cartId,grossValue:Number(this.bonus.totalValue),storeName:this.storeName,storeId:this.bonus.storeId.toString(),userId:this.bonus.userId})}render(){return i("div",{key:"8e0415c740327afcfe26d3c9bffa31d5902275c5",class:"crm-container-form fbits-responsive-carrinho-desconto",style:this.customStyles},i("label",{key:"194c30eddf8b11f5f4e807543d4883c7d2142609",class:"crm-title"},this.config.giftbackTitle),this.step===o.STEP_PHONE&&i("phone-form",{key:"dcf325716e8c13c2aa5a6d9fcb8dd841a0e63828",value:this.customer.phone,config:this.config,loading:this.loading,handlerSubmit:t=>this.handleSendPin(t)}),this.step===o.STEP_PIN&&i("pin-form",{key:"2f978f70fadc4c96ac3f439a89092ac086378b8b",config:this.config,phone:this.phone,cancel:()=>this.changePhone(),resend:()=>this.sendPin(),validate:t=>this.validateBonus(t),loading:this.loading},this.sucess&&i("p",{key:"c4f628efffa8b160940ed727daf4bd75e3541e6e",class:"crm-message-info"},this.sucess),this.error&&i("p",{key:"923b9775109435b5b9bb54640672be066023fd2d",class:"crm-message-error"},this.error)),this.step===o.STEP_RESERVE&&i("giftback-info",{key:"2d9c19a37c3ff59518891dc512c4109c6b12c6b4",storeName:this.storeName,infoBonus:this.reservedInfo,config:this.config,loading:this.loading,cancel:()=>this.handleCancel(),bonus:this.bonus,reserve:()=>this.processBonus()}),this.step===o.STEP_NO_BONUS&&i("div",{key:"1fafa25f50b6a3ebbd8fbb53fc796419c2f7a45c",class:"container-message"},c.t("noGiftback",{storename:this.config.giftbackTitle})))}};l.style=d;const f=".loading-container{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;z-index:1000;}.loading-spinner{width:50px;height:50px;border:5px solid rgba(255, 255, 255, 0.3);border-top:5px solid white;border-radius:50%;animation:spin 1s linear infinite;}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.relative-xy{position:relative}";const u=f;const m=class{constructor(i){t(this,i);this.loading=true}render(){return i("div",{key:"06a7a57acb07c91ca75d00dd42ca568ac708a3ef",class:"relative-xy"},this.loading&&i("div",{key:"6eee6954ce47b3a60cc9d3f599aa826c30e522db",class:"loading-container"},i("div",{key:"8747ac17ca30704d18739ccd1cf7d31fbbb05419",class:"loading-spinner"})),i("slot",{key:"32ffc7a17474372cf35fe7812fa4f193d00aa224"}))}};m.style=u;export{l as crm_giftback_form,m as loading_container};
2
- //# sourceMappingURL=p-68de3204.entry.js.map
1
+ import{r as t,h as i}from"./p-8c362346.js";import{C as s,g as e,U as a}from"./p-3eba0eba.js";import{S as o}from"./p-ecc51430.js";import{g as n}from"./p-1b441909.js";import{i as c}from"./p-c53241bf.js";import{p as h}from"./p-b57fbd6d.js";const r="*{margin:0;padding:0;box-sizing:border-box}:host{--crmfont-sizebodymd:14px;--crmline-heightbodymd:20px;--crmletter-spacingtitle-md:0px}.container-message{font-weight:400;line-height:var(--crmline-heightbodymd);letter-spacing:var(--crmletter-spacingtitle-md);text-align:left;text-underline-position:from-font;text-decoration-skip-ink:none}.crm-container-form{display:flex;flex-direction:column;justify-content:space-around;height:auto;padding:20px 24px 20px 24px;border:1px solid #CCCC;writing-mode:horizontal-tb;gap:16px;border-top:1px solid #ccc !important;border-bottom:1px solid #ccc !important}.crm-phone-form{display:flex;flex-direction:column;height:100%;gap:16px}.crm-subtitle{font-size:.875rem;line-height:1.25rem}.crm-title{font-weight:700;line-height:20px;color:#262626;}.crm-message-info{color:#619013;font-weight:500;}.crm-message-error{color:#E11D48;font-weight:500;}";const d=r;const l=class{constructor(i){t(this,i);this.crmBonusService=s.getInstance();this.storeName=undefined;this.cartId=undefined;this.products=undefined;this.customer=undefined;this.loadProducts=undefined;this.loadAll=undefined;this.customStyles=undefined;this.reservedInfo=undefined;this.value=undefined;this.loading=false;this.message=undefined;this.phone=undefined;this.pinInfo=undefined;this.step=o.STEP_RESERVE;this.bonus=undefined;this.sucess="";this.error="";this.config=undefined;this.hasApplyBonus=false}async setStep(t){this.step=t}async processBonus(t=[],i=false){await this.loadProducts();this.sucess="";console.log("processBonus",[]);if(i){this.products=t}const s=localStorage.getItem(e(this.cartId));if(s){const t=JSON.parse(s);this.bonus=t;this.phone=t.phone;this.pinInfo={storeId:t.storeId,userId:t.userId};await this.validateBonus("2018")}}async handleSendPin(t){await this.loadAll();this.message="";if(!t){this.message="Informe seu telefone";return}this.phone=t;this.sendPin()}async componentWillLoad(){this.sucess="";this.error="";this.config=n(this.storeName);const t=this.getPhoneNumberAgain();if(t){this.step=o.STEP_PHONE;return}await this.processBonus()}getPhoneNumberAgain(){const t=localStorage.getItem(e(this.cartId));if(!t)return true;const i=JSON.parse(t);return!i.hasBonus}convertStringToNumber(){const t=this.phone.replace(/\D/g,"");return Number(t)}async sendPin(){var t,i,s;this.loading=true;this.message="";this.sucess="";this.error="";try{const i=this.convertStringToNumber();const s=localStorage.getItem(`bc:${this.phone}`);if(!s){this.pinInfo=await this.crmBonusService.sendPin(i,(t=this.customer)===null||t===void 0?void 0:t.name,this.storeName)}if(s){const t=JSON.parse(s);this.pinInfo={storeId:t.storeId,userId:t.userId};await this.validateBonus("2018");this.step=o.STEP_RESERVE}else{this.step=o.STEP_PIN}}catch(t){this.message=(s=(i=t===null||t===void 0?void 0:t.response)===null||i===void 0?void 0:i.data)===null||s===void 0?void 0:s.message}finally{this.loading=false}}changePhone(){this.sucess="";this.error="";this.step=o.STEP_PHONE}async validateBonus(t){var i,s,n;await this.loadProducts();const c=localStorage.getItem(a);if(c=="dontUse"){this.step=o.STEP_RESERVE;return}this.loading=true;this.sucess="";this.error="";const h={pin:t,cellphone:this.convertStringToNumber(),storeId:this.pinInfo.storeId.toString(),userId:this.pinInfo.userId.toString(),checkoutId:this.cartId,checkoutProducts:this.products,name:(i=this.customer)===null||i===void 0?void 0:i.name,storeName:this.storeName};try{this.bonus=await this.crmBonusService.validatePinBonus(h);if(!this.bonus.hasBonus){localStorage.setItem(e(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})));this.loading=false;this.step=o.STEP_NO_BONUS;return}this.sucess="Código validado com sucesso!";localStorage.setItem(e(this.cartId),JSON.stringify(Object.assign(Object.assign({},this.bonus),{phone:this.phone})));localStorage.setItem(`bc:${this.phone}`,JSON.stringify(this.bonus));localStorage.setItem(a,"use");localStorage.setItem(this.cartId,this.bonus.bonusBalance.toString());await this.updateMetadata();this.step=o.STEP_RESERVE}catch(t){const i=(n=(s=t===null||t===void 0?void 0:t.response)===null||s===void 0?void 0:s.data)===null||n===void 0?void 0:n.response;if(i&&i.includes("Pin")){this.error="Código inválido!"}else{this.error=i;this.step=o.STEP_NO_BONUS}}finally{this.loading=false}}async updateMetadata(){try{if(!this.reservedInfo.isBonusProcessed)return;if(this.reservedInfo.isExpired()){console.log("[CRM:updateMetadata]");await h(this.storeName,this.cartId,{createdAt:Date.now(),url:window.location.href});localStorage.removeItem("bc:time")}}catch(t){console.error("[CRMBONUS:updateMetadata]: ",t)}}handleCancel(){this.cancel()}async cancel(){this.message="";this.loading=true;try{await this.crmBonusService.cancel(this.cartId);localStorage.setItem(a,"dontUse");this.save(0)}catch(t){this.message="Não consegui cancelar o bônus, tente novamente!"}finally{this.loading=false}}async reserveApply(t){this.loading=true;this.message="";try{await this.reserve(t);this.save(t)}catch(t){this.message="ocorreu um error ao solicitar a aplicação do bonus! tente novamente";this.step=o.STEP_NO_BONUS;localStorage.removeItem(this.cartId)}finally{this.loading=false}}save(t){localStorage.setItem(this.cartId,t.toString())}async reserve(t){await this.crmBonusService.reserve({redeemedBonus:t,cartId:this.cartId,ticket:this.cartId,grossValue:Number(this.bonus.totalValue),storeName:this.storeName,storeId:this.bonus.storeId.toString(),userId:this.bonus.userId})}render(){return i("div",{key:"8e0415c740327afcfe26d3c9bffa31d5902275c5",class:"crm-container-form fbits-responsive-carrinho-desconto",style:this.customStyles},i("label",{key:"194c30eddf8b11f5f4e807543d4883c7d2142609",class:"crm-title"},this.config.giftbackTitle),this.step===o.STEP_PHONE&&i("phone-form",{key:"dcf325716e8c13c2aa5a6d9fcb8dd841a0e63828",value:this.customer.phone,config:this.config,loading:this.loading,handlerSubmit:t=>this.handleSendPin(t)}),this.step===o.STEP_PIN&&i("pin-form",{key:"2f978f70fadc4c96ac3f439a89092ac086378b8b",config:this.config,phone:this.phone,cancel:()=>this.changePhone(),resend:()=>this.sendPin(),validate:t=>this.validateBonus(t),loading:this.loading},this.sucess&&i("p",{key:"c4f628efffa8b160940ed727daf4bd75e3541e6e",class:"crm-message-info"},this.sucess),this.error&&i("p",{key:"923b9775109435b5b9bb54640672be066023fd2d",class:"crm-message-error"},this.error)),this.step===o.STEP_RESERVE&&i("giftback-info",{key:"2d9c19a37c3ff59518891dc512c4109c6b12c6b4",storeName:this.storeName,infoBonus:this.reservedInfo,config:this.config,loading:this.loading,cancel:()=>this.handleCancel(),bonus:this.bonus,reserve:()=>this.processBonus()}),this.step===o.STEP_NO_BONUS&&i("div",{key:"1fafa25f50b6a3ebbd8fbb53fc796419c2f7a45c",class:"container-message"},c.t("noGiftback",{storename:this.config.giftbackTitle})))}};l.style=d;const f=".loading-container{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;z-index:1000;}.loading-spinner{width:50px;height:50px;border:5px solid rgba(255, 255, 255, 0.3);border-top:5px solid white;border-radius:50%;animation:spin 1s linear infinite;}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.relative-xy{position:relative}";const u=f;const m=class{constructor(i){t(this,i);this.loading=true}render(){return i("div",{key:"06a7a57acb07c91ca75d00dd42ca568ac708a3ef",class:"relative-xy"},this.loading&&i("div",{key:"6eee6954ce47b3a60cc9d3f599aa826c30e522db",class:"loading-container"},i("div",{key:"8747ac17ca30704d18739ccd1cf7d31fbbb05419",class:"loading-spinner"})),i("slot",{key:"32ffc7a17474372cf35fe7812fa4f193d00aa224"}))}};m.style=u;export{l as crm_giftback_form,m as loading_container};
2
+ //# sourceMappingURL=p-b307cbed.entry.js.map
@@ -1,2 +1,2 @@
1
- const t=t=>typeof t==="string";const e=()=>{let t;let e;const i=new Promise(((i,s)=>{t=i;e=s}));i.resolve=t;i.reject=e;return i};const i=t=>{if(t==null)return"";return""+t};const s=(t,e,i)=>{t.forEach((t=>{if(e[t])i[t]=e[t]}))};const n=/###/g;const r=t=>t&&t.indexOf("###")>-1?t.replace(n,"."):t;const o=e=>!e||t(e);const a=(e,i,s)=>{const n=!t(i)?i:i.split(".");let a=0;while(a<n.length-1){if(o(e))return{};const t=r(n[a]);if(!e[t]&&s)e[t]=new s;if(Object.prototype.hasOwnProperty.call(e,t)){e=e[t]}else{e={}}++a}if(o(e))return{};return{obj:e,k:r(n[a])}};const f=(t,e,i)=>{const{obj:s,k:n}=a(t,e,Object);if(s!==undefined||e.length===1){s[n]=i;return}let r=e[e.length-1];let o=e.slice(0,e.length-1);let f=a(t,o,Object);while(f.obj===undefined&&o.length){r=`${o[o.length-1]}.${r}`;o=o.slice(0,o.length-1);f=a(t,o,Object);if(f?.obj&&typeof f.obj[`${f.k}.${r}`]!=="undefined"){f.obj=undefined}}f.obj[`${f.k}.${r}`]=i};const h=(t,e,i,s)=>{const{obj:n,k:r}=a(t,e,Object);n[r]=n[r]||[];n[r].push(i)};const u=(t,e)=>{const{obj:i,k:s}=a(t,e);if(!i)return undefined;return i[s]};const l=(t,e,i)=>{const s=u(t,i);if(s!==undefined){return s}return u(e,i)};const c=(e,i,s)=>{for(const n in i){if(n!=="__proto__"&&n!=="constructor"){if(n in e){if(t(e[n])||e[n]instanceof String||t(i[n])||i[n]instanceof String){if(s)e[n]=i[n]}else{c(e[n],i[n],s)}}else{e[n]=i[n]}}}return e};const d=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var p={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const g=e=>{if(t(e)){return e.replace(/[&<>"'\/]/g,(t=>p[t]))}return e};class m{constructor(t){this.capacity=t;this.regExpMap=new Map;this.regExpQueue=[]}getRegExp(t){const e=this.regExpMap.get(t);if(e!==undefined){return e}const i=new RegExp(t);if(this.regExpQueue.length===this.capacity){this.regExpMap.delete(this.regExpQueue.shift())}this.regExpMap.set(t,i);this.regExpQueue.push(t);return i}}const y=[" ",",","?","!",";"];const $=new m(20);const b=(t,e,i)=>{e=e||"";i=i||"";const s=y.filter((t=>e.indexOf(t)<0&&i.indexOf(t)<0));if(s.length===0)return true;const n=$.getRegExp(`(${s.map((t=>t==="?"?"\\?":t)).join("|")})`);let r=!n.test(t);if(!r){const e=t.indexOf(i);if(e>0&&!n.test(t.substring(0,e))){r=true}}return r};const w=function(t,e){let i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:".";if(!t)return undefined;if(t[e])return t[e];const s=e.split(i);let n=t;for(let t=0;t<s.length;){if(!n||typeof n!=="object"){return undefined}let e;let r="";for(let o=t;o<s.length;++o){if(o!==t){r+=i}r+=s[o];e=n[r];if(e!==undefined){if(["string","number","boolean"].indexOf(typeof e)>-1&&o<s.length-1){continue}t+=o-t+1;break}}n=e}return n};const v=t=>t?.replace("_","-");const x={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class j{constructor(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};this.init(t,e)}init(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};this.prefix=e.prefix||"i18next:";this.logger=t||x;this.options=e;this.debug=e.debug}log(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.forward(e,"log","",true)}warn(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.forward(e,"warn","",true)}error(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.forward(e,"error","")}deprecate(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.forward(e,"warn","WARNING DEPRECATED: ",true)}forward(e,i,s,n){if(n&&!this.debug)return null;if(t(e[0]))e[0]=`${s}${this.prefix} ${e[0]}`;return this.logger[i](e)}create(t){return new j(this.logger,{...{prefix:`${this.prefix}:${t}:`},...this.options})}clone(t){t=t||this.options;t.prefix=t.prefix||this.prefix;return new j(this.logger,t)}}var k=new j;class O{constructor(){this.observers={}}on(t,e){t.split(" ").forEach((t=>{if(!this.observers[t])this.observers[t]=new Map;const i=this.observers[t].get(e)||0;this.observers[t].set(e,i+1)}));return this}off(t,e){if(!this.observers[t])return;if(!e){delete this.observers[t];return}this.observers[t].delete(e)}emit(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++){i[s-1]=arguments[s]}if(this.observers[t]){const e=Array.from(this.observers[t].entries());e.forEach((t=>{let[e,s]=t;for(let t=0;t<s;t++){e(...i)}}))}if(this.observers["*"]){const e=Array.from(this.observers["*"].entries());e.forEach((e=>{let[s,n]=e;for(let e=0;e<n;e++){s.apply(s,[t,...i])}}))}}}class S extends O{constructor(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{ns:["translation"],defaultNS:"translation"};super();this.data=t||{};this.options=e;if(this.options.keySeparator===undefined){this.options.keySeparator="."}if(this.options.ignoreJSONStructure===undefined){this.options.ignoreJSONStructure=true}}addNamespaces(t){if(this.options.ns.indexOf(t)<0){this.options.ns.push(t)}}removeNamespaces(t){const e=this.options.ns.indexOf(t);if(e>-1){this.options.ns.splice(e,1)}}getResource(e,i,s){let n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};const r=n.keySeparator!==undefined?n.keySeparator:this.options.keySeparator;const o=n.ignoreJSONStructure!==undefined?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;if(e.indexOf(".")>-1){a=e.split(".")}else{a=[e,i];if(s){if(Array.isArray(s)){a.push(...s)}else if(t(s)&&r){a.push(...s.split(r))}else{a.push(s)}}}const f=u(this.data,a);if(!f&&!i&&!s&&e.indexOf(".")>-1){e=a[0];i=a[1];s=a.slice(2).join(".")}if(f||!o||!t(s))return f;return w(this.data?.[e]?.[i],s,r)}addResource(t,e,i,s){let n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:{silent:false};const r=n.keySeparator!==undefined?n.keySeparator:this.options.keySeparator;let o=[t,e];if(i)o=o.concat(r?i.split(r):i);if(t.indexOf(".")>-1){o=t.split(".");s=e;e=o[1]}this.addNamespaces(e);f(this.data,o,s);if(!n.silent)this.emit("added",t,e,i,s)}addResources(e,i,s){let n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{silent:false};for(const n in s){if(t(s[n])||Array.isArray(s[n]))this.addResource(e,i,n,s[n],{silent:true})}if(!n.silent)this.emit("added",e,i,s)}addResourceBundle(t,e,i,s,n){let r=arguments.length>5&&arguments[5]!==undefined?arguments[5]:{silent:false,skipCopy:false};let o=[t,e];if(t.indexOf(".")>-1){o=t.split(".");s=i;i=e;e=o[1]}this.addNamespaces(e);let a=u(this.data,o)||{};if(!r.skipCopy)i=JSON.parse(JSON.stringify(i));if(s){c(a,i,n)}else{a={...a,...i}}f(this.data,o,a);if(!r.silent)this.emit("added",t,e,i)}removeResourceBundle(t,e){if(this.hasResourceBundle(t,e)){delete this.data[t][e]}this.removeNamespaces(e);this.emit("removed",t,e)}hasResourceBundle(t,e){return this.getResource(t,e)!==undefined}getResourceBundle(t,e){if(!e)e=this.options.defaultNS;return this.getResource(t,e)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const e=this.getDataByLanguage(t);const i=e&&Object.keys(e)||[];return!!i.find((t=>e[t]&&Object.keys(e[t]).length>0))}toJSON(){return this.data}}var N={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,i,s,n){t.forEach((t=>{e=this.processors[t]?.process(e,i,s,n)??e}));return e}};const R={};class L extends O{constructor(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};super();s(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this);this.options=e;if(this.options.keySeparator===undefined){this.options.keySeparator="."}this.logger=k.create("translator")}changeLanguage(t){if(t)this.language=t}exists(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{interpolation:{}};if(t===undefined||t===null){return false}const i=this.resolve(t,e);return i?.res!==undefined}extractFromKey(e,i){let s=i.nsSeparator!==undefined?i.nsSeparator:this.options.nsSeparator;if(s===undefined)s=":";const n=i.keySeparator!==undefined?i.keySeparator:this.options.keySeparator;let r=i.ns||this.options.defaultNS||[];const o=s&&e.indexOf(s)>-1;const a=!this.options.userDefinedKeySeparator&&!i.keySeparator&&!this.options.userDefinedNsSeparator&&!i.nsSeparator&&!b(e,s,n);if(o&&!a){const i=e.match(this.interpolator.nestingRegexp);if(i&&i.length>0){return{key:e,namespaces:t(r)?[r]:r}}const o=e.split(s);if(s!==n||s===n&&this.options.ns.indexOf(o[0])>-1)r=o.shift();e=o.join(n)}return{key:e,namespaces:t(r)?[r]:r}}translate(e,i,s){if(typeof i!=="object"&&this.options.overloadTranslationOptionHandler){i=this.options.overloadTranslationOptionHandler(arguments)}if(typeof i==="object")i={...i};if(!i)i={};if(e===undefined||e===null)return"";if(!Array.isArray(e))e=[String(e)];const n=i.returnDetails!==undefined?i.returnDetails:this.options.returnDetails;const r=i.keySeparator!==undefined?i.keySeparator:this.options.keySeparator;const{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],i);const f=a[a.length-1];const h=i.lng||this.language;const u=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode"){if(u){const t=i.nsSeparator||this.options.nsSeparator;if(n){return{res:`${f}${t}${o}`,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:f,usedParams:this.getUsedParamsDetails(i)}}return`${f}${t}${o}`}if(n){return{res:o,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:f,usedParams:this.getUsedParamsDetails(i)}}return o}const l=this.resolve(e,i);let c=l?.res;const d=l?.usedKey||o;const p=l?.exactUsedKey||o;const g=Object.prototype.toString.apply(c);const m=["[object Number]","[object Function]","[object RegExp]"];const y=i.joinArrays!==undefined?i.joinArrays:this.options.joinArrays;const $=!this.i18nFormat||this.i18nFormat.handleAsObject;const b=!t(c)&&typeof c!=="boolean"&&typeof c!=="number";if($&&c&&b&&m.indexOf(g)<0&&!(t(y)&&Array.isArray(c))){if(!i.returnObjects&&!this.options.returnObjects){if(!this.options.returnedObjectHandler){this.logger.warn("accessing an object - but returnObjects options is not enabled!")}const t=this.options.returnedObjectHandler?this.options.returnedObjectHandler(d,c,{...i,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;if(n){l.res=t;l.usedParams=this.getUsedParamsDetails(i);return l}return t}if(r){const t=Array.isArray(c);const e=t?[]:{};const s=t?p:d;for(const t in c){if(Object.prototype.hasOwnProperty.call(c,t)){const n=`${s}${r}${t}`;e[t]=this.translate(n,{...i,...{joinArrays:false,ns:a}});if(e[t]===n)e[t]=c[t]}}c=e}}else if($&&t(y)&&Array.isArray(c)){c=c.join(y);if(c)c=this.extendTranslation(c,e,i,s)}else{let n=false;let a=false;const u=i.count!==undefined&&!t(i.count);const d=L.hasDefaultValue(i);const p=u?this.pluralResolver.getSuffix(h,i.count,i):"";const g=i.ordinal&&u?this.pluralResolver.getSuffix(h,i.count,{ordinal:false}):"";const m=u&&!i.ordinal&&i.count===0;const y=m&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${p}`]||i[`defaultValue${g}`]||i.defaultValue;if(!this.isValidLookup(c)&&d){n=true;c=y}if(!this.isValidLookup(c)){a=true;c=o}const $=i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey;const b=$&&a?undefined:c;const w=d&&y!==c&&this.options.updateMissing;if(a||n||w){this.logger.log(w?"updateKey":"missingKey",h,f,o,w?y:c);if(r){const t=this.resolve(o,{...i,keySeparator:false});if(t&&t.res)this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let t=[];const e=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&e&&e[0]){for(let i=0;i<e.length;i++){t.push(e[i])}}else if(this.options.saveMissingTo==="all"){t=this.languageUtils.toResolveHierarchy(i.lng||this.language)}else{t.push(i.lng||this.language)}const s=(t,e,s)=>{const n=d&&s!==c?s:b;if(this.options.missingKeyHandler){this.options.missingKeyHandler(t,f,e,n,w,i)}else if(this.backendConnector?.saveMissing){this.backendConnector.saveMissing(t,f,e,n,w,i)}this.emit("missingKey",t,f,e,c)};if(this.options.saveMissing){if(this.options.saveMissingPlurals&&u){t.forEach((t=>{const e=this.pluralResolver.getSuffixes(t,i);if(m&&i[`defaultValue${this.options.pluralSeparator}zero`]&&e.indexOf(`${this.options.pluralSeparator}zero`)<0){e.push(`${this.options.pluralSeparator}zero`)}e.forEach((e=>{s([t],o+e,i[`defaultValue${e}`]||y)}))}))}else{s(t,o,y)}}}c=this.extendTranslation(c,e,i,l,s);if(a&&c===o&&this.options.appendNamespaceToMissingKey)c=`${f}:${o}`;if((a||n)&&this.options.parseMissingKeyHandler){c=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}:${o}`:o,n?c:undefined)}}if(n){l.res=c;l.usedParams=this.getUsedParamsDetails(i);return l}return c}extendTranslation(e,i,s,n,r){var o=this;if(this.i18nFormat?.parse){e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n})}else if(!s.skipInterpolation){if(s.interpolation)this.interpolator.init({...s,...{interpolation:{...this.options.interpolation,...s.interpolation}}});const a=t(e)&&(s?.interpolation?.skipOnVariables!==undefined?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(a){const t=e.match(this.interpolator.nestingRegexp);f=t&&t.length}let h=s.replace&&!t(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables)h={...this.options.interpolation.defaultVariables,...h};e=this.interpolator.interpolate(e,h,s.lng||this.language||n.usedLng,s);if(a){const t=e.match(this.interpolator.nestingRegexp);const i=t&&t.length;if(f<i)s.nest=false}if(!s.lng&&n&&n.res)s.lng=this.language||n.usedLng;if(s.nest!==false)e=this.interpolator.nest(e,(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++){e[n]=arguments[n]}if(r?.[0]===e[0]&&!s.context){o.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${i[0]}`);return null}return o.translate(...e,i)}),s);if(s.interpolation)this.interpolator.reset()}const a=s.postProcess||this.options.postProcess;const f=t(a)?[a]:a;if(e!==undefined&&e!==null&&f?.length&&s.applyPostProcessor!==false){e=N.handle(f,e,i,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)}return e}resolve(e){let i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let s;let n;let r;let o;let a;if(t(e))e=[e];e.forEach((e=>{if(this.isValidLookup(s))return;const f=this.extractFromKey(e,i);const h=f.key;n=h;let u=f.namespaces;if(this.options.fallbackNS)u=u.concat(this.options.fallbackNS);const l=i.count!==undefined&&!t(i.count);const c=l&&!i.ordinal&&i.count===0;const d=i.context!==undefined&&(t(i.context)||typeof i.context==="number")&&i.context!=="";const p=i.lngs?i.lngs:this.languageUtils.toResolveHierarchy(i.lng||this.language,i.fallbackLng);u.forEach((t=>{if(this.isValidLookup(s))return;a=t;if(!R[`${p[0]}-${t}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)){R[`${p[0]}-${t}`]=true;this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}p.forEach((e=>{if(this.isValidLookup(s))return;o=e;const n=[h];if(this.i18nFormat?.addLookupKeys){this.i18nFormat.addLookupKeys(n,h,e,t,i)}else{let t;if(l)t=this.pluralResolver.getSuffix(e,i.count,i);const s=`${this.options.pluralSeparator}zero`;const r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(l){n.push(h+t);if(i.ordinal&&t.indexOf(r)===0){n.push(h+t.replace(r,this.options.pluralSeparator))}if(c){n.push(h+s)}}if(d){const e=`${h}${this.options.contextSeparator}${i.context}`;n.push(e);if(l){n.push(e+t);if(i.ordinal&&t.indexOf(r)===0){n.push(e+t.replace(r,this.options.pluralSeparator))}if(c){n.push(e+s)}}}}let a;while(a=n.pop()){if(!this.isValidLookup(s)){r=a;s=this.getResource(e,t,a,i)}}}))}))}));return{res:s,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:a}}isValidLookup(t){return t!==undefined&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,e,i){let s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};if(this.i18nFormat?.getResource)return this.i18nFormat.getResource(t,e,i,s);return this.resourceStore.getResource(t,e,i,s)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};const i=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"];const s=e.replace&&!t(e.replace);let n=s?e.replace:e;if(s&&typeof e.count!=="undefined"){n.count=e.count}if(this.options.interpolation.defaultVariables){n={...this.options.interpolation.defaultVariables,...n}}if(!s){n={...n};for(const t of i){delete n[t]}}return n}static hasDefaultValue(t){const e="defaultValue";for(const i in t){if(Object.prototype.hasOwnProperty.call(t,i)&&e===i.substring(0,e.length)&&undefined!==t[i]){return true}}return false}}class P{constructor(t){this.options=t;this.supportedLngs=this.options.supportedLngs||false;this.logger=k.create("languageUtils")}getScriptPartFromCode(t){t=v(t);if(!t||t.indexOf("-")<0)return null;const e=t.split("-");if(e.length===2)return null;e.pop();if(e[e.length-1].toLowerCase()==="x")return null;return this.formatLanguageCode(e.join("-"))}getLanguagePartFromCode(t){t=v(t);if(!t||t.indexOf("-")<0)return t;const e=t.split("-");return this.formatLanguageCode(e[0])}formatLanguageCode(e){if(t(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(t){}if(t&&this.options.lowerCaseLng){t=t.toLowerCase()}if(t)return t;if(this.options.lowerCaseLng){return e.toLowerCase()}return e}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(t){if(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs){t=this.getLanguagePartFromCode(t)}return!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let e;t.forEach((t=>{if(e)return;const i=this.formatLanguageCode(t);if(!this.options.supportedLngs||this.isSupportedCode(i))e=i}));if(!e&&this.options.supportedLngs){t.forEach((t=>{if(e)return;const i=this.getLanguagePartFromCode(t);if(this.isSupportedCode(i))return e=i;e=this.options.supportedLngs.find((t=>{if(t===i)return t;if(t.indexOf("-")<0&&i.indexOf("-")<0)return;if(t.indexOf("-")>0&&i.indexOf("-")<0&&t.substring(0,t.indexOf("-"))===i)return t;if(t.indexOf(i)===0&&i.length>1)return t}))}))}if(!e)e=this.getFallbackCodes(this.options.fallbackLng)[0];return e}getFallbackCodes(e,i){if(!e)return[];if(typeof e==="function")e=e(i);if(t(e))e=[e];if(Array.isArray(e))return e;if(!i)return e.default||[];let s=e[i];if(!s)s=e[this.getScriptPartFromCode(i)];if(!s)s=e[this.formatLanguageCode(i)];if(!s)s=e[this.getLanguagePartFromCode(i)];if(!s)s=e.default;return s||[]}toResolveHierarchy(e,i){const s=this.getFallbackCodes(i||this.options.fallbackLng||[],e);const n=[];const r=t=>{if(!t)return;if(this.isSupportedCode(t)){n.push(t)}else{this.logger.warn(`rejecting language code not found in supportedLngs: ${t}`)}};if(t(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)){if(this.options.load!=="languageOnly")r(this.formatLanguageCode(e));if(this.options.load!=="languageOnly"&&this.options.load!=="currentOnly")r(this.getScriptPartFromCode(e));if(this.options.load!=="currentOnly")r(this.getLanguagePartFromCode(e))}else if(t(e)){r(this.formatLanguageCode(e))}s.forEach((t=>{if(n.indexOf(t)<0)r(this.formatLanguageCode(t))}));return n}}const A={zero:0,one:1,two:2,few:3,many:4,other:5};const C={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class E{constructor(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};this.languageUtils=t;this.options=e;this.logger=k.create("pluralResolver");this.pluralRulesCache={}}addRule(t,e){this.rules[t]=e}clearCache(){this.pluralRulesCache={}}getRule(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};const i=v(t==="dev"?"en":t);const s=e.ordinal?"ordinal":"cardinal";const n=JSON.stringify({cleanedCode:i,type:s});if(n in this.pluralRulesCache){return this.pluralRulesCache[n]}let r;try{r=new Intl.PluralRules(i,{type:s})}catch(i){if(!Intl){this.logger.error("No Intl support, please use an Intl polyfill!");return C}if(!t.match(/-|_/))return C;const s=this.languageUtils.getLanguagePartFromCode(t);r=this.getRule(s,e)}this.pluralRulesCache[n]=r;return r}needsPlural(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let i=this.getRule(t,e);if(!i)i=this.getRule("dev",e);return i?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,e){let i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return this.getSuffixes(t,i).map((t=>`${e}${t}`))}getSuffixes(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let i=this.getRule(t,e);if(!i)i=this.getRule("dev",e);if(!i)return[];return i.resolvedOptions().pluralCategories.sort(((t,e)=>A[t]-A[e])).map((t=>`${this.options.prepend}${e.ordinal?`ordinal${this.options.prepend}`:""}${t}`))}getSuffix(t,e){let i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};const s=this.getRule(t,i);if(s){return`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${s.select(e)}`}this.logger.warn(`no plural rule found for: ${t}`);return this.getSuffix("dev",e,i)}}const V=function(e,i,s){let n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:".";let r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;let o=l(e,i,s);if(!o&&r&&t(s)){o=w(e,s,n);if(o===undefined)o=w(i,s,n)}return o};const I=t=>t.replace(/\$/g,"$$$$");class z{constructor(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this.logger=k.create("interpolator");this.options=t;this.format=t?.interpolation?.format||(t=>t);this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!t.interpolation)t.interpolation={escapeValue:true};const{escape:e,escapeValue:i,useRawValueToEscape:s,prefix:n,prefixEscaped:r,suffix:o,suffixEscaped:a,formatSeparator:f,unescapeSuffix:h,unescapePrefix:u,nestingPrefix:l,nestingPrefixEscaped:c,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:y,maxReplaces:$,alwaysFormat:b}=t.interpolation;this.escape=e!==undefined?e:g;this.escapeValue=i!==undefined?i:true;this.useRawValueToEscape=s!==undefined?s:false;this.prefix=n?d(n):r||"{{";this.suffix=o?d(o):a||"}}";this.formatSeparator=f||",";this.unescapePrefix=h?"":u||"-";this.unescapeSuffix=this.unescapePrefix?"":h||"";this.nestingPrefix=l?d(l):c||d("$t(");this.nestingSuffix=p?d(p):m||d(")");this.nestingOptionsSeparator=y||",";this.maxReplaces=$||1e3;this.alwaysFormat=b!==undefined?b:false;this.resetRegExp()}reset(){if(this.options)this.init(this.options)}resetRegExp(){const t=(t,e)=>{if(t?.source===e){t.lastIndex=0;return t}return new RegExp(e,"g")};this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`);this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,s,n,r){let o;let a;let f;const h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};const u=t=>{if(t.indexOf(this.formatSeparator)<0){const e=V(s,h,t,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(e,undefined,n,{...r,...s,interpolationkey:t}):e}const e=t.split(this.formatSeparator);const i=e.shift().trim();const o=e.join(this.formatSeparator).trim();return this.format(V(s,h,i,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...s,interpolationkey:i})};this.resetRegExp();const l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler;const c=r?.interpolation?.skipOnVariables!==undefined?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;const d=[{regex:this.regexpUnescape,safeValue:t=>I(t)},{regex:this.regexp,safeValue:t=>this.escapeValue?I(this.escape(t)):I(t)}];d.forEach((s=>{f=0;while(o=s.regex.exec(e)){const n=o[1].trim();a=u(n);if(a===undefined){if(typeof l==="function"){const i=l(e,o,r);a=t(i)?i:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n)){a=""}else if(c){a=o[0];continue}else{this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`);a=""}}else if(!t(a)&&!this.useRawValueToEscape){a=i(a)}const h=s.safeValue(a);e=e.replace(o[0],h);if(c){s.regex.lastIndex+=a.length;s.regex.lastIndex-=o[0].length}else{s.regex.lastIndex=0}f++;if(f>=this.maxReplaces){break}}}));return e}nest(e,s){let n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};let r;let o;let a;const f=(t,e)=>{const i=this.nestingOptionsSeparator;if(t.indexOf(i)<0)return t;const s=t.split(new RegExp(`${i}[ ]*{`));let n=`{${s[1]}`;t=s[0];n=this.interpolate(n,a);const r=n.match(/'/g);const o=n.match(/"/g);if((r?.length??0)%2===0&&!o||o.length%2!==0){n=n.replace(/'/g,'"')}try{a=JSON.parse(n);if(e)a={...e,...a}}catch(e){this.logger.warn(`failed parsing options string in nesting for key ${t}`,e);return`${t}${i}${n}`}if(a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1)delete a.defaultValue;return t};while(r=this.nestingRegexp.exec(e)){let h=[];a={...n};a=a.replace&&!t(a.replace)?a.replace:a;a.applyPostProcessor=false;delete a.defaultValue;let u=false;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const t=r[1].split(this.formatSeparator).map((t=>t.trim()));r[1]=t.shift();h=t;u=true}o=s(f.call(this,r[1].trim(),a),a);if(o&&r[0]===e&&!t(o))return o;if(!t(o))o=i(o);if(!o){this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`);o=""}if(u){o=h.reduce(((t,e)=>this.format(t,e,n.lng,{...n,interpolationkey:r[1].trim()})),o.trim())}e=e.replace(r[0],o);this.regexp.lastIndex=0}return e}}const B=t=>{let e=t.toLowerCase().trim();const i={};if(t.indexOf("(")>-1){const s=t.split("(");e=s[0].toLowerCase().trim();const n=s[1].substring(0,s[1].length-1);if(e==="currency"&&n.indexOf(":")<0){if(!i.currency)i.currency=n.trim()}else if(e==="relativetime"&&n.indexOf(":")<0){if(!i.range)i.range=n.trim()}else{const t=n.split(";");t.forEach((t=>{if(t){const[e,...s]=t.split(":");const n=s.join(":").trim().replace(/^'+|'+$/g,"");const r=e.trim();if(!i[r])i[r]=n;if(n==="false")i[r]=false;if(n==="true")i[r]=true;if(!isNaN(n))i[r]=parseInt(n,10)}}))}}return{formatName:e,formatOptions:i}};const T=t=>{const e={};return(i,s,n)=>{let r=n;if(n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]){r={...r,[n.interpolationkey]:undefined}}const o=s+JSON.stringify(r);let a=e[o];if(!a){a=t(v(s),n);e[o]=a}return a(i)}};class K{constructor(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this.logger=k.create("formatter");this.options=t;this.formats={number:T(((t,e)=>{const i=new Intl.NumberFormat(t,{...e});return t=>i.format(t)})),currency:T(((t,e)=>{const i=new Intl.NumberFormat(t,{...e,style:"currency"});return t=>i.format(t)})),datetime:T(((t,e)=>{const i=new Intl.DateTimeFormat(t,{...e});return t=>i.format(t)})),relativetime:T(((t,e)=>{const i=new Intl.RelativeTimeFormat(t,{...e});return t=>i.format(t,e.range||"day")})),list:T(((t,e)=>{const i=new Intl.ListFormat(t,{...e});return t=>i.format(t)}))};this.init(t)}init(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{interpolation:{}};this.formatSeparator=e.interpolation.formatSeparator||","}add(t,e){this.formats[t.toLowerCase().trim()]=e}addCached(t,e){this.formats[t.toLowerCase().trim()]=T(e)}format(t,e,i){let s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};const n=e.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find((t=>t.indexOf(")")>-1))){const t=n.findIndex((t=>t.indexOf(")")>-1));n[0]=[n[0],...n.splice(1,t)].join(this.formatSeparator)}const r=n.reduce(((t,e)=>{const{formatName:n,formatOptions:r}=B(e);if(this.formats[n]){let e=t;try{const o=s?.formatParams?.[s.interpolationkey]||{};const a=o.locale||o.lng||s.locale||s.lng||i;e=this.formats[n](t,a,{...r,...s,...o})}catch(t){this.logger.warn(t)}return e}else{this.logger.warn(`there was no format function for ${n}`)}return t}),t);return r}}const D=(t,e)=>{if(t.pending[e]!==undefined){delete t.pending[e];t.pendingCount--}};class M extends O{constructor(t,e,i){let s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};super();this.backend=t;this.store=e;this.services=i;this.languageUtils=i.languageUtils;this.options=s;this.logger=k.create("backendConnector");this.waitingReads=[];this.maxParallelReads=s.maxParallelReads||10;this.readingCalls=0;this.maxRetries=s.maxRetries>=0?s.maxRetries:5;this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350;this.state={};this.queue=[];this.backend?.init?.(i,s.backend,s)}queueLoad(t,e,i,s){const n={};const r={};const o={};const a={};t.forEach((t=>{let s=true;e.forEach((e=>{const o=`${t}|${e}`;if(!i.reload&&this.store.hasResourceBundle(t,e)){this.state[o]=2}else if(this.state[o]<0);else if(this.state[o]===1){if(r[o]===undefined)r[o]=true}else{this.state[o]=1;s=false;if(r[o]===undefined)r[o]=true;if(n[o]===undefined)n[o]=true;if(a[e]===undefined)a[e]=true}}));if(!s)o[t]=true}));if(Object.keys(n).length||Object.keys(r).length){this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:s})}return{toLoad:Object.keys(n),pending:Object.keys(r),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(a)}}loaded(t,e,i){const s=t.split("|");const n=s[0];const r=s[1];if(e)this.emit("failedLoading",n,r,e);if(!e&&i){this.store.addResourceBundle(n,r,i,undefined,undefined,{skipCopy:true})}this.state[t]=e?-1:2;if(e&&i)this.state[t]=0;const o={};this.queue.forEach((i=>{h(i.loaded,[n],r);D(i,t);if(e)i.errors.push(e);if(i.pendingCount===0&&!i.done){Object.keys(i.loaded).forEach((t=>{if(!o[t])o[t]={};const e=i.loaded[t];if(e.length){e.forEach((e=>{if(o[t][e]===undefined)o[t][e]=true}))}}));i.done=true;if(i.errors.length){i.callback(i.errors)}else{i.callback()}}}));this.emit("loaded",o);this.queue=this.queue.filter((t=>!t.done))}read(t,e,i){let s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;let n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:this.retryTimeout;let r=arguments.length>5?arguments[5]:undefined;if(!t.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:e,fcName:i,tried:s,wait:n,callback:r});return}this.readingCalls++;const o=(o,a)=>{this.readingCalls--;if(this.waitingReads.length>0){const t=this.waitingReads.shift();this.read(t.lng,t.ns,t.fcName,t.tried,t.wait,t.callback)}if(o&&a&&s<this.maxRetries){setTimeout((()=>{this.read.call(this,t,e,i,s+1,n*2,r)}),n);return}r(o,a)};const a=this.backend[i].bind(this.backend);if(a.length===2){try{const i=a(t,e);if(i&&typeof i.then==="function"){i.then((t=>o(null,t))).catch(o)}else{o(null,i)}}catch(t){o(t)}return}return a(t,e,o)}prepareLoading(e,i){let s=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};let n=arguments.length>3?arguments[3]:undefined;if(!this.backend){this.logger.warn("No backend was added via i18next.use. Will not load resources.");return n&&n()}if(t(e))e=this.languageUtils.toResolveHierarchy(e);if(t(i))i=[i];const r=this.queueLoad(e,i,s,n);if(!r.toLoad.length){if(!r.pending.length)n();return null}r.toLoad.forEach((t=>{this.loadOne(t)}))}load(t,e,i){this.prepareLoading(t,e,{},i)}reload(t,e,i){this.prepareLoading(t,e,{reload:true},i)}loadOne(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";const i=t.split("|");const s=i[0];const n=i[1];this.read(s,n,"read",undefined,undefined,((i,r)=>{if(i)this.logger.warn(`${e}loading namespace ${n} for language ${s} failed`,i);if(!i&&r)this.logger.log(`${e}loaded namespace ${n} for language ${s}`,r);this.loaded(t,i,r)}))}saveMissing(t,e,i,s,n){let r=arguments.length>5&&arguments[5]!==undefined?arguments[5]:{};let o=arguments.length>6&&arguments[6]!==undefined?arguments[6]:()=>{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(e)){this.logger.warn(`did not save key "${i}" as the namespace "${e}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(i===undefined||i===null||i==="")return;if(this.backend?.create){const a={...r,isUpdate:n};const f=this.backend.create.bind(this.backend);if(f.length<6){try{let n;if(f.length===5){n=f(t,e,i,s,a)}else{n=f(t,e,i,s)}if(n&&typeof n.then==="function"){n.then((t=>o(null,t))).catch(o)}else{o(null,n)}}catch(t){o(t)}}else{f(t,e,i,s,o,a)}}if(!t||!t[0])return;this.store.addResource(t[0],e,i,s)}}const F=()=>({debug:false,initAsync:true,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:false,supportedLngs:false,nonExplicitSupportedLngs:false,load:"all",preload:false,simplifyPluralSuffix:true,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:false,saveMissing:false,updateMissing:false,saveMissingTo:"fallback",saveMissingPlurals:true,missingKeyHandler:false,missingInterpolationHandler:false,postProcess:false,postProcessPassResolved:false,returnNull:false,returnEmptyString:true,returnObjects:false,joinArrays:false,returnedObjectHandler:false,parseMissingKeyHandler:false,appendNamespaceToMissingKey:false,appendNamespaceToCIMode:false,overloadTranslationOptionHandler:e=>{let i={};if(typeof e[1]==="object")i=e[1];if(t(e[1]))i.defaultValue=e[1];if(t(e[2]))i.tDescription=e[2];if(typeof e[2]==="object"||typeof e[3]==="object"){const t=e[3]||e[2];Object.keys(t).forEach((e=>{i[e]=t[e]}))}return i},interpolation:{escapeValue:true,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:true}});const _=e=>{if(t(e.ns))e.ns=[e.ns];if(t(e.fallbackLng))e.fallbackLng=[e.fallbackLng];if(t(e.fallbackNS))e.fallbackNS=[e.fallbackNS];if(e.supportedLngs?.indexOf?.("cimode")<0){e.supportedLngs=e.supportedLngs.concat(["cimode"])}if(typeof e.initImmediate==="boolean")e.initAsync=e.initImmediate;return e};const J=()=>{};const U=t=>{const e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach((e=>{if(typeof t[e]==="function"){t[e]=t[e].bind(t)}}))};class q extends O{constructor(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let e=arguments.length>1?arguments[1]:undefined;super();this.options=_(t);this.services={};this.logger=k;this.modules={external:[]};U(this);if(e&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync){this.init(t,e);return this}setTimeout((()=>{this.init(t,e)}),0)}}init(){var i=this;let s=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let n=arguments.length>1?arguments[1]:undefined;this.isInitializing=true;if(typeof s==="function"){n=s;s={}}if(!s.defaultNS&&s.defaultNS!==false&&s.ns){if(t(s.ns)){s.defaultNS=s.ns}else if(s.ns.indexOf("translation")<0){s.defaultNS=s.ns[0]}}const r=F();this.options={...r,...this.options,..._(s)};this.options.interpolation={...r.interpolation,...this.options.interpolation};if(s.keySeparator!==undefined){this.options.userDefinedKeySeparator=s.keySeparator}if(s.nsSeparator!==undefined){this.options.userDefinedNsSeparator=s.nsSeparator}const o=t=>{if(!t)return null;if(typeof t==="function")return new t;return t};if(!this.options.isClone){if(this.modules.logger){k.init(o(this.modules.logger),this.options)}else{k.init(null,this.options)}let t;if(this.modules.formatter){t=this.modules.formatter}else{t=K}const e=new P(this.options);this.store=new S(this.options.resources,this.options);const s=this.services;s.logger=k;s.resourceStore=this.store;s.languageUtils=e;s.pluralResolver=new E(e,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});if(t&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)){s.formatter=o(t);s.formatter.init(s,this.options);this.options.interpolation.format=s.formatter.format.bind(s.formatter)}s.interpolator=new z(this.options);s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)};s.backendConnector=new M(o(this.modules.backend),s.resourceStore,s,this.options);s.backendConnector.on("*",(function(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++){s[n-1]=arguments[n]}i.emit(t,...s)}));if(this.modules.languageDetector){s.languageDetector=o(this.modules.languageDetector);if(s.languageDetector.init)s.languageDetector.init(s,this.options.detection,this.options)}if(this.modules.i18nFormat){s.i18nFormat=o(this.modules.i18nFormat);if(s.i18nFormat.init)s.i18nFormat.init(this)}this.translator=new L(this.services,this.options);this.translator.on("*",(function(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++){s[n-1]=arguments[n]}i.emit(t,...s)}));this.modules.external.forEach((t=>{if(t.init)t.init(this)}))}this.format=this.options.interpolation.format;if(!n)n=J;if(this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const t=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);if(t.length>0&&t[0]!=="dev")this.options.lng=t[0]}if(!this.services.languageDetector&&!this.options.lng){this.logger.warn("init: no languageDetector is used and no lng is defined")}const a=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];a.forEach((t=>{this[t]=function(){return i.store[t](...arguments)}}));const f=["addResource","addResources","addResourceBundle","removeResourceBundle"];f.forEach((t=>{this[t]=function(){i.store[t](...arguments);return i}}));const h=e();const u=()=>{const t=(t,e)=>{this.isInitializing=false;if(this.isInitialized&&!this.initializedStoreOnce)this.logger.warn("init: i18next is already initialized. You should call init just once!");this.isInitialized=true;if(!this.options.isClone)this.logger.log("initialized",this.options);this.emit("initialized",this.options);h.resolve(e);n(t,e)};if(this.languages&&!this.isInitialized)return t(null,this.t.bind(this));this.changeLanguage(this.options.lng,t)};if(this.options.resources||!this.options.initAsync){u()}else{setTimeout(u,0)}return h}loadResources(e){let i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:J;let s=i;const n=t(e)?e:this.language;if(typeof e==="function")s=e;if(!this.options.resources||this.options.partialBundledLanguages){if(n?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const t=[];const e=e=>{if(!e)return;if(e==="cimode")return;const i=this.services.languageUtils.toResolveHierarchy(e);i.forEach((e=>{if(e==="cimode")return;if(t.indexOf(e)<0)t.push(e)}))};if(!n){const t=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);t.forEach((t=>e(t)))}else{e(n)}this.options.preload?.forEach?.((t=>e(t)));this.services.backendConnector.load(t,this.options.ns,(t=>{if(!t&&!this.resolvedLanguage&&this.language)this.setResolvedLanguage(this.language);s(t)}))}else{s(null)}}reloadResources(t,i,s){const n=e();if(typeof t==="function"){s=t;t=undefined}if(typeof i==="function"){s=i;i=undefined}if(!t)t=this.languages;if(!i)i=this.options.ns;if(!s)s=J;this.services.backendConnector.reload(t,i,(t=>{n.resolve();s(t)}));return n}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");if(t.type==="backend"){this.modules.backend=t}if(t.type==="logger"||t.log&&t.warn&&t.error){this.modules.logger=t}if(t.type==="languageDetector"){this.modules.languageDetector=t}if(t.type==="i18nFormat"){this.modules.i18nFormat=t}if(t.type==="postProcessor"){N.addPostProcessor(t)}if(t.type==="formatter"){this.modules.formatter=t}if(t.type==="3rdParty"){this.modules.external.push(t)}return this}setResolvedLanguage(t){if(!t||!this.languages)return;if(["cimode","dev"].indexOf(t)>-1)return;for(let t=0;t<this.languages.length;t++){const e=this.languages[t];if(["cimode","dev"].indexOf(e)>-1)continue;if(this.store.hasLanguageSomeTranslations(e)){this.resolvedLanguage=e;break}}}changeLanguage(i,s){var n=this;this.isLanguageChangingTo=i;const r=e();this.emit("languageChanging",i);const o=t=>{this.language=t;this.languages=this.services.languageUtils.toResolveHierarchy(t);this.resolvedLanguage=undefined;this.setResolvedLanguage(t)};const a=(t,e)=>{if(e){o(e);this.translator.changeLanguage(e);this.isLanguageChangingTo=undefined;this.emit("languageChanged",e);this.logger.log("languageChanged",e)}else{this.isLanguageChangingTo=undefined}r.resolve((function(){return n.t(...arguments)}));if(s)s(t,(function(){return n.t(...arguments)}))};const f=e=>{if(!i&&!e&&this.services.languageDetector)e=[];const s=t(e)?e:this.services.languageUtils.getBestMatchFromCodes(e);if(s){if(!this.language){o(s)}if(!this.translator.language)this.translator.changeLanguage(s);this.services.languageDetector?.cacheUserLanguage?.(s)}this.loadResources(s,(t=>{a(t,s)}))};if(!i&&this.services.languageDetector&&!this.services.languageDetector.async){f(this.services.languageDetector.detect())}else if(!i&&this.services.languageDetector&&this.services.languageDetector.async){if(this.services.languageDetector.detect.length===0){this.services.languageDetector.detect().then(f)}else{this.services.languageDetector.detect(f)}}else{f(i)}return r}getFixedT(e,i,s){var n=this;const r=function(t,e){let i;if(typeof e!=="object"){for(var o=arguments.length,a=new Array(o>2?o-2:0),f=2;f<o;f++){a[f-2]=arguments[f]}i=n.options.overloadTranslationOptionHandler([t,e].concat(a))}else{i={...e}}i.lng=i.lng||r.lng;i.lngs=i.lngs||r.lngs;i.ns=i.ns||r.ns;if(i.keyPrefix!=="")i.keyPrefix=i.keyPrefix||s||r.keyPrefix;const h=n.options.keySeparator||".";let u;if(i.keyPrefix&&Array.isArray(t)){u=t.map((t=>`${i.keyPrefix}${h}${t}`))}else{u=i.keyPrefix?`${i.keyPrefix}${h}${t}`:t}return n.t(u,i)};if(t(e)){r.lng=e}else{r.lngs=e}r.ns=i;r.keyPrefix=s;return r}t(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.translator?.translate(...e)}exists(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.translator?.exists(...e)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!this.isInitialized){this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages);return false}if(!this.languages||!this.languages.length){this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages);return false}const i=e.lng||this.resolvedLanguage||this.languages[0];const s=this.options?this.options.fallbackLng:false;const n=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return true;const r=(t,e)=>{const i=this.services.backendConnector.state[`${t}|${e}`];return i===-1||i===0||i===2};if(e.precheck){const t=e.precheck(this,r);if(t!==undefined)return t}if(this.hasResourceBundle(i,t))return true;if(!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages)return true;if(r(i,t)&&(!s||r(n,t)))return true;return false}loadNamespaces(i,s){const n=e();if(!this.options.ns){if(s)s();return Promise.resolve()}if(t(i))i=[i];i.forEach((t=>{if(this.options.ns.indexOf(t)<0)this.options.ns.push(t)}));this.loadResources((t=>{n.resolve();if(s)s(t)}));return n}loadLanguages(i,s){const n=e();if(t(i))i=[i];const r=this.options.preload||[];const o=i.filter((t=>r.indexOf(t)<0&&this.services.languageUtils.isSupportedCode(t)));if(!o.length){if(s)s();return Promise.resolve()}this.options.preload=r.concat(o);this.loadResources((t=>{n.resolve();if(s)s(t)}));return n}dir(t){if(!t)t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language);if(!t)return"rtl";const e=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"];const i=this.services?.languageUtils||new P(F());return e.indexOf(i.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let e=arguments.length>1?arguments[1]:undefined;return new q(t,e)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:J;const i=t.forkResourceStore;if(i)delete t.forkResourceStore;const s={...this.options,...t,...{isClone:true}};const n=new q(s);if(t.debug!==undefined||t.prefix!==undefined){n.logger=n.logger.clone(t)}const r=["store","services","language"];r.forEach((t=>{n[t]=this[t]}));n.services={...this.services};n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)};if(i){n.store=new S(this.store.data,s);n.services.resourceStore=n.store}n.translator=new L(n.services,s);n.translator.on("*",(function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++){i[s-1]=arguments[s]}n.emit(t,...i)}));n.init(s,e);n.translator.options=s;n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)};return n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const W=q.createInstance();W.createInstance=q.createInstance;W.init({lng:"pt",fallbackLng:"en",interpolation:{escapeValue:false},resources:{en:{translation:{welcome:"Welcome",description:"This is an example","pin-sutitle":"Enter the 4-digit code sent via SMS to the number"}},pt:{translation:{edit:"Editar",welcome:"Bem-vindo",description:"Este é um exemplo","pin-sutitle":"Digite o código de 4 dígitos enviado por SMS ao número",giftDescription:"Você tem até <strong>R$ {{amount}}</strong> de {{custom_name}}",noGiftback:"Você não possui {{storename}} disponível para essa compra.",noBonus:"Não há {{giftbackname}} disponível para essa compra.",withApplyBonus:"{{giftbackname}} aplicado ao pedido: ",maxAmount:"Você atingiu o valor máximo!",labelamountPartial:"Ao utilizar um valor parcial, você perderá a quantia restante.",labelUseGiftback:"Regra de utilização: Valor mínimo de compra de {{minimumPurchase}} reais para usar 100% do Giftback, válido até {{expírationDate}}",backCart:"Retorne ao carrinho e verifique se há descontos disponíveis nessa compra"}}}});export{W as i};
2
- //# sourceMappingURL=p-e8c19a64.js.map
1
+ const t=t=>typeof t==="string";const e=()=>{let t;let e;const i=new Promise(((i,s)=>{t=i;e=s}));i.resolve=t;i.reject=e;return i};const i=t=>{if(t==null)return"";return""+t};const s=(t,e,i)=>{t.forEach((t=>{if(e[t])i[t]=e[t]}))};const n=/###/g;const r=t=>t&&t.indexOf("###")>-1?t.replace(n,"."):t;const o=e=>!e||t(e);const a=(e,i,s)=>{const n=!t(i)?i:i.split(".");let a=0;while(a<n.length-1){if(o(e))return{};const t=r(n[a]);if(!e[t]&&s)e[t]=new s;if(Object.prototype.hasOwnProperty.call(e,t)){e=e[t]}else{e={}}++a}if(o(e))return{};return{obj:e,k:r(n[a])}};const f=(t,e,i)=>{const{obj:s,k:n}=a(t,e,Object);if(s!==undefined||e.length===1){s[n]=i;return}let r=e[e.length-1];let o=e.slice(0,e.length-1);let f=a(t,o,Object);while(f.obj===undefined&&o.length){r=`${o[o.length-1]}.${r}`;o=o.slice(0,o.length-1);f=a(t,o,Object);if(f?.obj&&typeof f.obj[`${f.k}.${r}`]!=="undefined"){f.obj=undefined}}f.obj[`${f.k}.${r}`]=i};const h=(t,e,i,s)=>{const{obj:n,k:r}=a(t,e,Object);n[r]=n[r]||[];n[r].push(i)};const u=(t,e)=>{const{obj:i,k:s}=a(t,e);if(!i)return undefined;return i[s]};const l=(t,e,i)=>{const s=u(t,i);if(s!==undefined){return s}return u(e,i)};const c=(e,i,s)=>{for(const n in i){if(n!=="__proto__"&&n!=="constructor"){if(n in e){if(t(e[n])||e[n]instanceof String||t(i[n])||i[n]instanceof String){if(s)e[n]=i[n]}else{c(e[n],i[n],s)}}else{e[n]=i[n]}}}return e};const d=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var p={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const g=e=>{if(t(e)){return e.replace(/[&<>"'\/]/g,(t=>p[t]))}return e};class m{constructor(t){this.capacity=t;this.regExpMap=new Map;this.regExpQueue=[]}getRegExp(t){const e=this.regExpMap.get(t);if(e!==undefined){return e}const i=new RegExp(t);if(this.regExpQueue.length===this.capacity){this.regExpMap.delete(this.regExpQueue.shift())}this.regExpMap.set(t,i);this.regExpQueue.push(t);return i}}const y=[" ",",","?","!",";"];const $=new m(20);const b=(t,e,i)=>{e=e||"";i=i||"";const s=y.filter((t=>e.indexOf(t)<0&&i.indexOf(t)<0));if(s.length===0)return true;const n=$.getRegExp(`(${s.map((t=>t==="?"?"\\?":t)).join("|")})`);let r=!n.test(t);if(!r){const e=t.indexOf(i);if(e>0&&!n.test(t.substring(0,e))){r=true}}return r};const w=function(t,e){let i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:".";if(!t)return undefined;if(t[e])return t[e];const s=e.split(i);let n=t;for(let t=0;t<s.length;){if(!n||typeof n!=="object"){return undefined}let e;let r="";for(let o=t;o<s.length;++o){if(o!==t){r+=i}r+=s[o];e=n[r];if(e!==undefined){if(["string","number","boolean"].indexOf(typeof e)>-1&&o<s.length-1){continue}t+=o-t+1;break}}n=e}return n};const v=t=>t?.replace("_","-");const x={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,e){console?.[t]?.apply?.(console,e)}};class j{constructor(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};this.init(t,e)}init(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};this.prefix=e.prefix||"i18next:";this.logger=t||x;this.options=e;this.debug=e.debug}log(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.forward(e,"log","",true)}warn(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.forward(e,"warn","",true)}error(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.forward(e,"error","")}deprecate(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.forward(e,"warn","WARNING DEPRECATED: ",true)}forward(e,i,s,n){if(n&&!this.debug)return null;if(t(e[0]))e[0]=`${s}${this.prefix} ${e[0]}`;return this.logger[i](e)}create(t){return new j(this.logger,{...{prefix:`${this.prefix}:${t}:`},...this.options})}clone(t){t=t||this.options;t.prefix=t.prefix||this.prefix;return new j(this.logger,t)}}var k=new j;class O{constructor(){this.observers={}}on(t,e){t.split(" ").forEach((t=>{if(!this.observers[t])this.observers[t]=new Map;const i=this.observers[t].get(e)||0;this.observers[t].set(e,i+1)}));return this}off(t,e){if(!this.observers[t])return;if(!e){delete this.observers[t];return}this.observers[t].delete(e)}emit(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++){i[s-1]=arguments[s]}if(this.observers[t]){const e=Array.from(this.observers[t].entries());e.forEach((t=>{let[e,s]=t;for(let t=0;t<s;t++){e(...i)}}))}if(this.observers["*"]){const e=Array.from(this.observers["*"].entries());e.forEach((e=>{let[s,n]=e;for(let e=0;e<n;e++){s.apply(s,[t,...i])}}))}}}class S extends O{constructor(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{ns:["translation"],defaultNS:"translation"};super();this.data=t||{};this.options=e;if(this.options.keySeparator===undefined){this.options.keySeparator="."}if(this.options.ignoreJSONStructure===undefined){this.options.ignoreJSONStructure=true}}addNamespaces(t){if(this.options.ns.indexOf(t)<0){this.options.ns.push(t)}}removeNamespaces(t){const e=this.options.ns.indexOf(t);if(e>-1){this.options.ns.splice(e,1)}}getResource(e,i,s){let n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};const r=n.keySeparator!==undefined?n.keySeparator:this.options.keySeparator;const o=n.ignoreJSONStructure!==undefined?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let a;if(e.indexOf(".")>-1){a=e.split(".")}else{a=[e,i];if(s){if(Array.isArray(s)){a.push(...s)}else if(t(s)&&r){a.push(...s.split(r))}else{a.push(s)}}}const f=u(this.data,a);if(!f&&!i&&!s&&e.indexOf(".")>-1){e=a[0];i=a[1];s=a.slice(2).join(".")}if(f||!o||!t(s))return f;return w(this.data?.[e]?.[i],s,r)}addResource(t,e,i,s){let n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:{silent:false};const r=n.keySeparator!==undefined?n.keySeparator:this.options.keySeparator;let o=[t,e];if(i)o=o.concat(r?i.split(r):i);if(t.indexOf(".")>-1){o=t.split(".");s=e;e=o[1]}this.addNamespaces(e);f(this.data,o,s);if(!n.silent)this.emit("added",t,e,i,s)}addResources(e,i,s){let n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{silent:false};for(const n in s){if(t(s[n])||Array.isArray(s[n]))this.addResource(e,i,n,s[n],{silent:true})}if(!n.silent)this.emit("added",e,i,s)}addResourceBundle(t,e,i,s,n){let r=arguments.length>5&&arguments[5]!==undefined?arguments[5]:{silent:false,skipCopy:false};let o=[t,e];if(t.indexOf(".")>-1){o=t.split(".");s=i;i=e;e=o[1]}this.addNamespaces(e);let a=u(this.data,o)||{};if(!r.skipCopy)i=JSON.parse(JSON.stringify(i));if(s){c(a,i,n)}else{a={...a,...i}}f(this.data,o,a);if(!r.silent)this.emit("added",t,e,i)}removeResourceBundle(t,e){if(this.hasResourceBundle(t,e)){delete this.data[t][e]}this.removeNamespaces(e);this.emit("removed",t,e)}hasResourceBundle(t,e){return this.getResource(t,e)!==undefined}getResourceBundle(t,e){if(!e)e=this.options.defaultNS;return this.getResource(t,e)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const e=this.getDataByLanguage(t);const i=e&&Object.keys(e)||[];return!!i.find((t=>e[t]&&Object.keys(e[t]).length>0))}toJSON(){return this.data}}var N={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,e,i,s,n){t.forEach((t=>{e=this.processors[t]?.process(e,i,s,n)??e}));return e}};const R={};class L extends O{constructor(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};super();s(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this);this.options=e;if(this.options.keySeparator===undefined){this.options.keySeparator="."}this.logger=k.create("translator")}changeLanguage(t){if(t)this.language=t}exists(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{interpolation:{}};if(t===undefined||t===null){return false}const i=this.resolve(t,e);return i?.res!==undefined}extractFromKey(e,i){let s=i.nsSeparator!==undefined?i.nsSeparator:this.options.nsSeparator;if(s===undefined)s=":";const n=i.keySeparator!==undefined?i.keySeparator:this.options.keySeparator;let r=i.ns||this.options.defaultNS||[];const o=s&&e.indexOf(s)>-1;const a=!this.options.userDefinedKeySeparator&&!i.keySeparator&&!this.options.userDefinedNsSeparator&&!i.nsSeparator&&!b(e,s,n);if(o&&!a){const i=e.match(this.interpolator.nestingRegexp);if(i&&i.length>0){return{key:e,namespaces:t(r)?[r]:r}}const o=e.split(s);if(s!==n||s===n&&this.options.ns.indexOf(o[0])>-1)r=o.shift();e=o.join(n)}return{key:e,namespaces:t(r)?[r]:r}}translate(e,i,s){if(typeof i!=="object"&&this.options.overloadTranslationOptionHandler){i=this.options.overloadTranslationOptionHandler(arguments)}if(typeof i==="object")i={...i};if(!i)i={};if(e===undefined||e===null)return"";if(!Array.isArray(e))e=[String(e)];const n=i.returnDetails!==undefined?i.returnDetails:this.options.returnDetails;const r=i.keySeparator!==undefined?i.keySeparator:this.options.keySeparator;const{key:o,namespaces:a}=this.extractFromKey(e[e.length-1],i);const f=a[a.length-1];const h=i.lng||this.language;const u=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(h?.toLowerCase()==="cimode"){if(u){const t=i.nsSeparator||this.options.nsSeparator;if(n){return{res:`${f}${t}${o}`,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:f,usedParams:this.getUsedParamsDetails(i)}}return`${f}${t}${o}`}if(n){return{res:o,usedKey:o,exactUsedKey:o,usedLng:h,usedNS:f,usedParams:this.getUsedParamsDetails(i)}}return o}const l=this.resolve(e,i);let c=l?.res;const d=l?.usedKey||o;const p=l?.exactUsedKey||o;const g=Object.prototype.toString.apply(c);const m=["[object Number]","[object Function]","[object RegExp]"];const y=i.joinArrays!==undefined?i.joinArrays:this.options.joinArrays;const $=!this.i18nFormat||this.i18nFormat.handleAsObject;const b=!t(c)&&typeof c!=="boolean"&&typeof c!=="number";if($&&c&&b&&m.indexOf(g)<0&&!(t(y)&&Array.isArray(c))){if(!i.returnObjects&&!this.options.returnObjects){if(!this.options.returnedObjectHandler){this.logger.warn("accessing an object - but returnObjects options is not enabled!")}const t=this.options.returnedObjectHandler?this.options.returnedObjectHandler(d,c,{...i,ns:a}):`key '${o} (${this.language})' returned an object instead of string.`;if(n){l.res=t;l.usedParams=this.getUsedParamsDetails(i);return l}return t}if(r){const t=Array.isArray(c);const e=t?[]:{};const s=t?p:d;for(const t in c){if(Object.prototype.hasOwnProperty.call(c,t)){const n=`${s}${r}${t}`;e[t]=this.translate(n,{...i,...{joinArrays:false,ns:a}});if(e[t]===n)e[t]=c[t]}}c=e}}else if($&&t(y)&&Array.isArray(c)){c=c.join(y);if(c)c=this.extendTranslation(c,e,i,s)}else{let n=false;let a=false;const u=i.count!==undefined&&!t(i.count);const d=L.hasDefaultValue(i);const p=u?this.pluralResolver.getSuffix(h,i.count,i):"";const g=i.ordinal&&u?this.pluralResolver.getSuffix(h,i.count,{ordinal:false}):"";const m=u&&!i.ordinal&&i.count===0;const y=m&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${p}`]||i[`defaultValue${g}`]||i.defaultValue;if(!this.isValidLookup(c)&&d){n=true;c=y}if(!this.isValidLookup(c)){a=true;c=o}const $=i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey;const b=$&&a?undefined:c;const w=d&&y!==c&&this.options.updateMissing;if(a||n||w){this.logger.log(w?"updateKey":"missingKey",h,f,o,w?y:c);if(r){const t=this.resolve(o,{...i,keySeparator:false});if(t&&t.res)this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let t=[];const e=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo==="fallback"&&e&&e[0]){for(let i=0;i<e.length;i++){t.push(e[i])}}else if(this.options.saveMissingTo==="all"){t=this.languageUtils.toResolveHierarchy(i.lng||this.language)}else{t.push(i.lng||this.language)}const s=(t,e,s)=>{const n=d&&s!==c?s:b;if(this.options.missingKeyHandler){this.options.missingKeyHandler(t,f,e,n,w,i)}else if(this.backendConnector?.saveMissing){this.backendConnector.saveMissing(t,f,e,n,w,i)}this.emit("missingKey",t,f,e,c)};if(this.options.saveMissing){if(this.options.saveMissingPlurals&&u){t.forEach((t=>{const e=this.pluralResolver.getSuffixes(t,i);if(m&&i[`defaultValue${this.options.pluralSeparator}zero`]&&e.indexOf(`${this.options.pluralSeparator}zero`)<0){e.push(`${this.options.pluralSeparator}zero`)}e.forEach((e=>{s([t],o+e,i[`defaultValue${e}`]||y)}))}))}else{s(t,o,y)}}}c=this.extendTranslation(c,e,i,l,s);if(a&&c===o&&this.options.appendNamespaceToMissingKey)c=`${f}:${o}`;if((a||n)&&this.options.parseMissingKeyHandler){c=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}:${o}`:o,n?c:undefined)}}if(n){l.res=c;l.usedParams=this.getUsedParamsDetails(i);return l}return c}extendTranslation(e,i,s,n,r){var o=this;if(this.i18nFormat?.parse){e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n})}else if(!s.skipInterpolation){if(s.interpolation)this.interpolator.init({...s,...{interpolation:{...this.options.interpolation,...s.interpolation}}});const a=t(e)&&(s?.interpolation?.skipOnVariables!==undefined?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(a){const t=e.match(this.interpolator.nestingRegexp);f=t&&t.length}let h=s.replace&&!t(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables)h={...this.options.interpolation.defaultVariables,...h};e=this.interpolator.interpolate(e,h,s.lng||this.language||n.usedLng,s);if(a){const t=e.match(this.interpolator.nestingRegexp);const i=t&&t.length;if(f<i)s.nest=false}if(!s.lng&&n&&n.res)s.lng=this.language||n.usedLng;if(s.nest!==false)e=this.interpolator.nest(e,(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++){e[n]=arguments[n]}if(r?.[0]===e[0]&&!s.context){o.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${i[0]}`);return null}return o.translate(...e,i)}),s);if(s.interpolation)this.interpolator.reset()}const a=s.postProcess||this.options.postProcess;const f=t(a)?[a]:a;if(e!==undefined&&e!==null&&f?.length&&s.applyPostProcessor!==false){e=N.handle(f,e,i,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...n,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)}return e}resolve(e){let i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let s;let n;let r;let o;let a;if(t(e))e=[e];e.forEach((e=>{if(this.isValidLookup(s))return;const f=this.extractFromKey(e,i);const h=f.key;n=h;let u=f.namespaces;if(this.options.fallbackNS)u=u.concat(this.options.fallbackNS);const l=i.count!==undefined&&!t(i.count);const c=l&&!i.ordinal&&i.count===0;const d=i.context!==undefined&&(t(i.context)||typeof i.context==="number")&&i.context!=="";const p=i.lngs?i.lngs:this.languageUtils.toResolveHierarchy(i.lng||this.language,i.fallbackLng);u.forEach((t=>{if(this.isValidLookup(s))return;a=t;if(!R[`${p[0]}-${t}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(a)){R[`${p[0]}-${t}`]=true;this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}p.forEach((e=>{if(this.isValidLookup(s))return;o=e;const n=[h];if(this.i18nFormat?.addLookupKeys){this.i18nFormat.addLookupKeys(n,h,e,t,i)}else{let t;if(l)t=this.pluralResolver.getSuffix(e,i.count,i);const s=`${this.options.pluralSeparator}zero`;const r=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(l){n.push(h+t);if(i.ordinal&&t.indexOf(r)===0){n.push(h+t.replace(r,this.options.pluralSeparator))}if(c){n.push(h+s)}}if(d){const e=`${h}${this.options.contextSeparator}${i.context}`;n.push(e);if(l){n.push(e+t);if(i.ordinal&&t.indexOf(r)===0){n.push(e+t.replace(r,this.options.pluralSeparator))}if(c){n.push(e+s)}}}}let a;while(a=n.pop()){if(!this.isValidLookup(s)){r=a;s=this.getResource(e,t,a,i)}}}))}))}));return{res:s,usedKey:n,exactUsedKey:r,usedLng:o,usedNS:a}}isValidLookup(t){return t!==undefined&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,e,i){let s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};if(this.i18nFormat?.getResource)return this.i18nFormat.getResource(t,e,i,s);return this.resourceStore.getResource(t,e,i,s)}getUsedParamsDetails(){let e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};const i=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"];const s=e.replace&&!t(e.replace);let n=s?e.replace:e;if(s&&typeof e.count!=="undefined"){n.count=e.count}if(this.options.interpolation.defaultVariables){n={...this.options.interpolation.defaultVariables,...n}}if(!s){n={...n};for(const t of i){delete n[t]}}return n}static hasDefaultValue(t){const e="defaultValue";for(const i in t){if(Object.prototype.hasOwnProperty.call(t,i)&&e===i.substring(0,e.length)&&undefined!==t[i]){return true}}return false}}class P{constructor(t){this.options=t;this.supportedLngs=this.options.supportedLngs||false;this.logger=k.create("languageUtils")}getScriptPartFromCode(t){t=v(t);if(!t||t.indexOf("-")<0)return null;const e=t.split("-");if(e.length===2)return null;e.pop();if(e[e.length-1].toLowerCase()==="x")return null;return this.formatLanguageCode(e.join("-"))}getLanguagePartFromCode(t){t=v(t);if(!t||t.indexOf("-")<0)return t;const e=t.split("-");return this.formatLanguageCode(e[0])}formatLanguageCode(e){if(t(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(t){}if(t&&this.options.lowerCaseLng){t=t.toLowerCase()}if(t)return t;if(this.options.lowerCaseLng){return e.toLowerCase()}return e}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(t){if(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs){t=this.getLanguagePartFromCode(t)}return!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let e;t.forEach((t=>{if(e)return;const i=this.formatLanguageCode(t);if(!this.options.supportedLngs||this.isSupportedCode(i))e=i}));if(!e&&this.options.supportedLngs){t.forEach((t=>{if(e)return;const i=this.getLanguagePartFromCode(t);if(this.isSupportedCode(i))return e=i;e=this.options.supportedLngs.find((t=>{if(t===i)return t;if(t.indexOf("-")<0&&i.indexOf("-")<0)return;if(t.indexOf("-")>0&&i.indexOf("-")<0&&t.substring(0,t.indexOf("-"))===i)return t;if(t.indexOf(i)===0&&i.length>1)return t}))}))}if(!e)e=this.getFallbackCodes(this.options.fallbackLng)[0];return e}getFallbackCodes(e,i){if(!e)return[];if(typeof e==="function")e=e(i);if(t(e))e=[e];if(Array.isArray(e))return e;if(!i)return e.default||[];let s=e[i];if(!s)s=e[this.getScriptPartFromCode(i)];if(!s)s=e[this.formatLanguageCode(i)];if(!s)s=e[this.getLanguagePartFromCode(i)];if(!s)s=e.default;return s||[]}toResolveHierarchy(e,i){const s=this.getFallbackCodes(i||this.options.fallbackLng||[],e);const n=[];const r=t=>{if(!t)return;if(this.isSupportedCode(t)){n.push(t)}else{this.logger.warn(`rejecting language code not found in supportedLngs: ${t}`)}};if(t(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)){if(this.options.load!=="languageOnly")r(this.formatLanguageCode(e));if(this.options.load!=="languageOnly"&&this.options.load!=="currentOnly")r(this.getScriptPartFromCode(e));if(this.options.load!=="currentOnly")r(this.getLanguagePartFromCode(e))}else if(t(e)){r(this.formatLanguageCode(e))}s.forEach((t=>{if(n.indexOf(t)<0)r(this.formatLanguageCode(t))}));return n}}const A={zero:0,one:1,two:2,few:3,many:4,other:5};const C={select:t=>t===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class E{constructor(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};this.languageUtils=t;this.options=e;this.logger=k.create("pluralResolver");this.pluralRulesCache={}}addRule(t,e){this.rules[t]=e}clearCache(){this.pluralRulesCache={}}getRule(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};const i=v(t==="dev"?"en":t);const s=e.ordinal?"ordinal":"cardinal";const n=JSON.stringify({cleanedCode:i,type:s});if(n in this.pluralRulesCache){return this.pluralRulesCache[n]}let r;try{r=new Intl.PluralRules(i,{type:s})}catch(i){if(!Intl){this.logger.error("No Intl support, please use an Intl polyfill!");return C}if(!t.match(/-|_/))return C;const s=this.languageUtils.getLanguagePartFromCode(t);r=this.getRule(s,e)}this.pluralRulesCache[n]=r;return r}needsPlural(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let i=this.getRule(t,e);if(!i)i=this.getRule("dev",e);return i?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,e){let i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return this.getSuffixes(t,i).map((t=>`${e}${t}`))}getSuffixes(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};let i=this.getRule(t,e);if(!i)i=this.getRule("dev",e);if(!i)return[];return i.resolvedOptions().pluralCategories.sort(((t,e)=>A[t]-A[e])).map((t=>`${this.options.prepend}${e.ordinal?`ordinal${this.options.prepend}`:""}${t}`))}getSuffix(t,e){let i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};const s=this.getRule(t,i);if(s){return`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${s.select(e)}`}this.logger.warn(`no plural rule found for: ${t}`);return this.getSuffix("dev",e,i)}}const V=function(e,i,s){let n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:".";let r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;let o=l(e,i,s);if(!o&&r&&t(s)){o=w(e,s,n);if(o===undefined)o=w(i,s,n)}return o};const I=t=>t.replace(/\$/g,"$$$$");class z{constructor(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this.logger=k.create("interpolator");this.options=t;this.format=t?.interpolation?.format||(t=>t);this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(!t.interpolation)t.interpolation={escapeValue:true};const{escape:e,escapeValue:i,useRawValueToEscape:s,prefix:n,prefixEscaped:r,suffix:o,suffixEscaped:a,formatSeparator:f,unescapeSuffix:h,unescapePrefix:u,nestingPrefix:l,nestingPrefixEscaped:c,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:y,maxReplaces:$,alwaysFormat:b}=t.interpolation;this.escape=e!==undefined?e:g;this.escapeValue=i!==undefined?i:true;this.useRawValueToEscape=s!==undefined?s:false;this.prefix=n?d(n):r||"{{";this.suffix=o?d(o):a||"}}";this.formatSeparator=f||",";this.unescapePrefix=h?"":u||"-";this.unescapeSuffix=this.unescapePrefix?"":h||"";this.nestingPrefix=l?d(l):c||d("$t(");this.nestingSuffix=p?d(p):m||d(")");this.nestingOptionsSeparator=y||",";this.maxReplaces=$||1e3;this.alwaysFormat=b!==undefined?b:false;this.resetRegExp()}reset(){if(this.options)this.init(this.options)}resetRegExp(){const t=(t,e)=>{if(t?.source===e){t.lastIndex=0;return t}return new RegExp(e,"g")};this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`);this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,s,n,r){let o;let a;let f;const h=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};const u=t=>{if(t.indexOf(this.formatSeparator)<0){const e=V(s,h,t,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(e,undefined,n,{...r,...s,interpolationkey:t}):e}const e=t.split(this.formatSeparator);const i=e.shift().trim();const o=e.join(this.formatSeparator).trim();return this.format(V(s,h,i,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...s,interpolationkey:i})};this.resetRegExp();const l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler;const c=r?.interpolation?.skipOnVariables!==undefined?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;const d=[{regex:this.regexpUnescape,safeValue:t=>I(t)},{regex:this.regexp,safeValue:t=>this.escapeValue?I(this.escape(t)):I(t)}];d.forEach((s=>{f=0;while(o=s.regex.exec(e)){const n=o[1].trim();a=u(n);if(a===undefined){if(typeof l==="function"){const i=l(e,o,r);a=t(i)?i:""}else if(r&&Object.prototype.hasOwnProperty.call(r,n)){a=""}else if(c){a=o[0];continue}else{this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`);a=""}}else if(!t(a)&&!this.useRawValueToEscape){a=i(a)}const h=s.safeValue(a);e=e.replace(o[0],h);if(c){s.regex.lastIndex+=a.length;s.regex.lastIndex-=o[0].length}else{s.regex.lastIndex=0}f++;if(f>=this.maxReplaces){break}}}));return e}nest(e,s){let n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};let r;let o;let a;const f=(t,e)=>{const i=this.nestingOptionsSeparator;if(t.indexOf(i)<0)return t;const s=t.split(new RegExp(`${i}[ ]*{`));let n=`{${s[1]}`;t=s[0];n=this.interpolate(n,a);const r=n.match(/'/g);const o=n.match(/"/g);if((r?.length??0)%2===0&&!o||o.length%2!==0){n=n.replace(/'/g,'"')}try{a=JSON.parse(n);if(e)a={...e,...a}}catch(e){this.logger.warn(`failed parsing options string in nesting for key ${t}`,e);return`${t}${i}${n}`}if(a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1)delete a.defaultValue;return t};while(r=this.nestingRegexp.exec(e)){let h=[];a={...n};a=a.replace&&!t(a.replace)?a.replace:a;a.applyPostProcessor=false;delete a.defaultValue;let u=false;if(r[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(r[1])){const t=r[1].split(this.formatSeparator).map((t=>t.trim()));r[1]=t.shift();h=t;u=true}o=s(f.call(this,r[1].trim(),a),a);if(o&&r[0]===e&&!t(o))return o;if(!t(o))o=i(o);if(!o){this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`);o=""}if(u){o=h.reduce(((t,e)=>this.format(t,e,n.lng,{...n,interpolationkey:r[1].trim()})),o.trim())}e=e.replace(r[0],o);this.regexp.lastIndex=0}return e}}const B=t=>{let e=t.toLowerCase().trim();const i={};if(t.indexOf("(")>-1){const s=t.split("(");e=s[0].toLowerCase().trim();const n=s[1].substring(0,s[1].length-1);if(e==="currency"&&n.indexOf(":")<0){if(!i.currency)i.currency=n.trim()}else if(e==="relativetime"&&n.indexOf(":")<0){if(!i.range)i.range=n.trim()}else{const t=n.split(";");t.forEach((t=>{if(t){const[e,...s]=t.split(":");const n=s.join(":").trim().replace(/^'+|'+$/g,"");const r=e.trim();if(!i[r])i[r]=n;if(n==="false")i[r]=false;if(n==="true")i[r]=true;if(!isNaN(n))i[r]=parseInt(n,10)}}))}}return{formatName:e,formatOptions:i}};const T=t=>{const e={};return(i,s,n)=>{let r=n;if(n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]){r={...r,[n.interpolationkey]:undefined}}const o=s+JSON.stringify(r);let a=e[o];if(!a){a=t(v(s),n);e[o]=a}return a(i)}};class K{constructor(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this.logger=k.create("formatter");this.options=t;this.formats={number:T(((t,e)=>{const i=new Intl.NumberFormat(t,{...e});return t=>i.format(t)})),currency:T(((t,e)=>{const i=new Intl.NumberFormat(t,{...e,style:"currency"});return t=>i.format(t)})),datetime:T(((t,e)=>{const i=new Intl.DateTimeFormat(t,{...e});return t=>i.format(t)})),relativetime:T(((t,e)=>{const i=new Intl.RelativeTimeFormat(t,{...e});return t=>i.format(t,e.range||"day")})),list:T(((t,e)=>{const i=new Intl.ListFormat(t,{...e});return t=>i.format(t)}))};this.init(t)}init(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{interpolation:{}};this.formatSeparator=e.interpolation.formatSeparator||","}add(t,e){this.formats[t.toLowerCase().trim()]=e}addCached(t,e){this.formats[t.toLowerCase().trim()]=T(e)}format(t,e,i){let s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};const n=e.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find((t=>t.indexOf(")")>-1))){const t=n.findIndex((t=>t.indexOf(")")>-1));n[0]=[n[0],...n.splice(1,t)].join(this.formatSeparator)}const r=n.reduce(((t,e)=>{const{formatName:n,formatOptions:r}=B(e);if(this.formats[n]){let e=t;try{const o=s?.formatParams?.[s.interpolationkey]||{};const a=o.locale||o.lng||s.locale||s.lng||i;e=this.formats[n](t,a,{...r,...s,...o})}catch(t){this.logger.warn(t)}return e}else{this.logger.warn(`there was no format function for ${n}`)}return t}),t);return r}}const D=(t,e)=>{if(t.pending[e]!==undefined){delete t.pending[e];t.pendingCount--}};class M extends O{constructor(t,e,i){let s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{};super();this.backend=t;this.store=e;this.services=i;this.languageUtils=i.languageUtils;this.options=s;this.logger=k.create("backendConnector");this.waitingReads=[];this.maxParallelReads=s.maxParallelReads||10;this.readingCalls=0;this.maxRetries=s.maxRetries>=0?s.maxRetries:5;this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350;this.state={};this.queue=[];this.backend?.init?.(i,s.backend,s)}queueLoad(t,e,i,s){const n={};const r={};const o={};const a={};t.forEach((t=>{let s=true;e.forEach((e=>{const o=`${t}|${e}`;if(!i.reload&&this.store.hasResourceBundle(t,e)){this.state[o]=2}else if(this.state[o]<0);else if(this.state[o]===1){if(r[o]===undefined)r[o]=true}else{this.state[o]=1;s=false;if(r[o]===undefined)r[o]=true;if(n[o]===undefined)n[o]=true;if(a[e]===undefined)a[e]=true}}));if(!s)o[t]=true}));if(Object.keys(n).length||Object.keys(r).length){this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:s})}return{toLoad:Object.keys(n),pending:Object.keys(r),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(a)}}loaded(t,e,i){const s=t.split("|");const n=s[0];const r=s[1];if(e)this.emit("failedLoading",n,r,e);if(!e&&i){this.store.addResourceBundle(n,r,i,undefined,undefined,{skipCopy:true})}this.state[t]=e?-1:2;if(e&&i)this.state[t]=0;const o={};this.queue.forEach((i=>{h(i.loaded,[n],r);D(i,t);if(e)i.errors.push(e);if(i.pendingCount===0&&!i.done){Object.keys(i.loaded).forEach((t=>{if(!o[t])o[t]={};const e=i.loaded[t];if(e.length){e.forEach((e=>{if(o[t][e]===undefined)o[t][e]=true}))}}));i.done=true;if(i.errors.length){i.callback(i.errors)}else{i.callback()}}}));this.emit("loaded",o);this.queue=this.queue.filter((t=>!t.done))}read(t,e,i){let s=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0;let n=arguments.length>4&&arguments[4]!==undefined?arguments[4]:this.retryTimeout;let r=arguments.length>5?arguments[5]:undefined;if(!t.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:e,fcName:i,tried:s,wait:n,callback:r});return}this.readingCalls++;const o=(o,a)=>{this.readingCalls--;if(this.waitingReads.length>0){const t=this.waitingReads.shift();this.read(t.lng,t.ns,t.fcName,t.tried,t.wait,t.callback)}if(o&&a&&s<this.maxRetries){setTimeout((()=>{this.read.call(this,t,e,i,s+1,n*2,r)}),n);return}r(o,a)};const a=this.backend[i].bind(this.backend);if(a.length===2){try{const i=a(t,e);if(i&&typeof i.then==="function"){i.then((t=>o(null,t))).catch(o)}else{o(null,i)}}catch(t){o(t)}return}return a(t,e,o)}prepareLoading(e,i){let s=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};let n=arguments.length>3?arguments[3]:undefined;if(!this.backend){this.logger.warn("No backend was added via i18next.use. Will not load resources.");return n&&n()}if(t(e))e=this.languageUtils.toResolveHierarchy(e);if(t(i))i=[i];const r=this.queueLoad(e,i,s,n);if(!r.toLoad.length){if(!r.pending.length)n();return null}r.toLoad.forEach((t=>{this.loadOne(t)}))}load(t,e,i){this.prepareLoading(t,e,{},i)}reload(t,e,i){this.prepareLoading(t,e,{reload:true},i)}loadOne(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";const i=t.split("|");const s=i[0];const n=i[1];this.read(s,n,"read",undefined,undefined,((i,r)=>{if(i)this.logger.warn(`${e}loading namespace ${n} for language ${s} failed`,i);if(!i&&r)this.logger.log(`${e}loaded namespace ${n} for language ${s}`,r);this.loaded(t,i,r)}))}saveMissing(t,e,i,s,n){let r=arguments.length>5&&arguments[5]!==undefined?arguments[5]:{};let o=arguments.length>6&&arguments[6]!==undefined?arguments[6]:()=>{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(e)){this.logger.warn(`did not save key "${i}" as the namespace "${e}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(i===undefined||i===null||i==="")return;if(this.backend?.create){const a={...r,isUpdate:n};const f=this.backend.create.bind(this.backend);if(f.length<6){try{let n;if(f.length===5){n=f(t,e,i,s,a)}else{n=f(t,e,i,s)}if(n&&typeof n.then==="function"){n.then((t=>o(null,t))).catch(o)}else{o(null,n)}}catch(t){o(t)}}else{f(t,e,i,s,o,a)}}if(!t||!t[0])return;this.store.addResource(t[0],e,i,s)}}const F=()=>({debug:false,initAsync:true,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:false,supportedLngs:false,nonExplicitSupportedLngs:false,load:"all",preload:false,simplifyPluralSuffix:true,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:false,saveMissing:false,updateMissing:false,saveMissingTo:"fallback",saveMissingPlurals:true,missingKeyHandler:false,missingInterpolationHandler:false,postProcess:false,postProcessPassResolved:false,returnNull:false,returnEmptyString:true,returnObjects:false,joinArrays:false,returnedObjectHandler:false,parseMissingKeyHandler:false,appendNamespaceToMissingKey:false,appendNamespaceToCIMode:false,overloadTranslationOptionHandler:e=>{let i={};if(typeof e[1]==="object")i=e[1];if(t(e[1]))i.defaultValue=e[1];if(t(e[2]))i.tDescription=e[2];if(typeof e[2]==="object"||typeof e[3]==="object"){const t=e[3]||e[2];Object.keys(t).forEach((e=>{i[e]=t[e]}))}return i},interpolation:{escapeValue:true,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:true}});const _=e=>{if(t(e.ns))e.ns=[e.ns];if(t(e.fallbackLng))e.fallbackLng=[e.fallbackLng];if(t(e.fallbackNS))e.fallbackNS=[e.fallbackNS];if(e.supportedLngs?.indexOf?.("cimode")<0){e.supportedLngs=e.supportedLngs.concat(["cimode"])}if(typeof e.initImmediate==="boolean")e.initAsync=e.initImmediate;return e};const J=()=>{};const U=t=>{const e=Object.getOwnPropertyNames(Object.getPrototypeOf(t));e.forEach((e=>{if(typeof t[e]==="function"){t[e]=t[e].bind(t)}}))};class q extends O{constructor(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let e=arguments.length>1?arguments[1]:undefined;super();this.options=_(t);this.services={};this.logger=k;this.modules={external:[]};U(this);if(e&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync){this.init(t,e);return this}setTimeout((()=>{this.init(t,e)}),0)}}init(){var i=this;let s=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let n=arguments.length>1?arguments[1]:undefined;this.isInitializing=true;if(typeof s==="function"){n=s;s={}}if(!s.defaultNS&&s.defaultNS!==false&&s.ns){if(t(s.ns)){s.defaultNS=s.ns}else if(s.ns.indexOf("translation")<0){s.defaultNS=s.ns[0]}}const r=F();this.options={...r,...this.options,..._(s)};this.options.interpolation={...r.interpolation,...this.options.interpolation};if(s.keySeparator!==undefined){this.options.userDefinedKeySeparator=s.keySeparator}if(s.nsSeparator!==undefined){this.options.userDefinedNsSeparator=s.nsSeparator}const o=t=>{if(!t)return null;if(typeof t==="function")return new t;return t};if(!this.options.isClone){if(this.modules.logger){k.init(o(this.modules.logger),this.options)}else{k.init(null,this.options)}let t;if(this.modules.formatter){t=this.modules.formatter}else{t=K}const e=new P(this.options);this.store=new S(this.options.resources,this.options);const s=this.services;s.logger=k;s.resourceStore=this.store;s.languageUtils=e;s.pluralResolver=new E(e,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix});if(t&&(!this.options.interpolation.format||this.options.interpolation.format===r.interpolation.format)){s.formatter=o(t);s.formatter.init(s,this.options);this.options.interpolation.format=s.formatter.format.bind(s.formatter)}s.interpolator=new z(this.options);s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)};s.backendConnector=new M(o(this.modules.backend),s.resourceStore,s,this.options);s.backendConnector.on("*",(function(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++){s[n-1]=arguments[n]}i.emit(t,...s)}));if(this.modules.languageDetector){s.languageDetector=o(this.modules.languageDetector);if(s.languageDetector.init)s.languageDetector.init(s,this.options.detection,this.options)}if(this.modules.i18nFormat){s.i18nFormat=o(this.modules.i18nFormat);if(s.i18nFormat.init)s.i18nFormat.init(this)}this.translator=new L(this.services,this.options);this.translator.on("*",(function(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++){s[n-1]=arguments[n]}i.emit(t,...s)}));this.modules.external.forEach((t=>{if(t.init)t.init(this)}))}this.format=this.options.interpolation.format;if(!n)n=J;if(this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const t=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);if(t.length>0&&t[0]!=="dev")this.options.lng=t[0]}if(!this.services.languageDetector&&!this.options.lng){this.logger.warn("init: no languageDetector is used and no lng is defined")}const a=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];a.forEach((t=>{this[t]=function(){return i.store[t](...arguments)}}));const f=["addResource","addResources","addResourceBundle","removeResourceBundle"];f.forEach((t=>{this[t]=function(){i.store[t](...arguments);return i}}));const h=e();const u=()=>{const t=(t,e)=>{this.isInitializing=false;if(this.isInitialized&&!this.initializedStoreOnce)this.logger.warn("init: i18next is already initialized. You should call init just once!");this.isInitialized=true;if(!this.options.isClone)this.logger.log("initialized",this.options);this.emit("initialized",this.options);h.resolve(e);n(t,e)};if(this.languages&&!this.isInitialized)return t(null,this.t.bind(this));this.changeLanguage(this.options.lng,t)};if(this.options.resources||!this.options.initAsync){u()}else{setTimeout(u,0)}return h}loadResources(e){let i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:J;let s=i;const n=t(e)?e:this.language;if(typeof e==="function")s=e;if(!this.options.resources||this.options.partialBundledLanguages){if(n?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const t=[];const e=e=>{if(!e)return;if(e==="cimode")return;const i=this.services.languageUtils.toResolveHierarchy(e);i.forEach((e=>{if(e==="cimode")return;if(t.indexOf(e)<0)t.push(e)}))};if(!n){const t=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);t.forEach((t=>e(t)))}else{e(n)}this.options.preload?.forEach?.((t=>e(t)));this.services.backendConnector.load(t,this.options.ns,(t=>{if(!t&&!this.resolvedLanguage&&this.language)this.setResolvedLanguage(this.language);s(t)}))}else{s(null)}}reloadResources(t,i,s){const n=e();if(typeof t==="function"){s=t;t=undefined}if(typeof i==="function"){s=i;i=undefined}if(!t)t=this.languages;if(!i)i=this.options.ns;if(!s)s=J;this.services.backendConnector.reload(t,i,(t=>{n.resolve();s(t)}));return n}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");if(t.type==="backend"){this.modules.backend=t}if(t.type==="logger"||t.log&&t.warn&&t.error){this.modules.logger=t}if(t.type==="languageDetector"){this.modules.languageDetector=t}if(t.type==="i18nFormat"){this.modules.i18nFormat=t}if(t.type==="postProcessor"){N.addPostProcessor(t)}if(t.type==="formatter"){this.modules.formatter=t}if(t.type==="3rdParty"){this.modules.external.push(t)}return this}setResolvedLanguage(t){if(!t||!this.languages)return;if(["cimode","dev"].indexOf(t)>-1)return;for(let t=0;t<this.languages.length;t++){const e=this.languages[t];if(["cimode","dev"].indexOf(e)>-1)continue;if(this.store.hasLanguageSomeTranslations(e)){this.resolvedLanguage=e;break}}}changeLanguage(i,s){var n=this;this.isLanguageChangingTo=i;const r=e();this.emit("languageChanging",i);const o=t=>{this.language=t;this.languages=this.services.languageUtils.toResolveHierarchy(t);this.resolvedLanguage=undefined;this.setResolvedLanguage(t)};const a=(t,e)=>{if(e){o(e);this.translator.changeLanguage(e);this.isLanguageChangingTo=undefined;this.emit("languageChanged",e);this.logger.log("languageChanged",e)}else{this.isLanguageChangingTo=undefined}r.resolve((function(){return n.t(...arguments)}));if(s)s(t,(function(){return n.t(...arguments)}))};const f=e=>{if(!i&&!e&&this.services.languageDetector)e=[];const s=t(e)?e:this.services.languageUtils.getBestMatchFromCodes(e);if(s){if(!this.language){o(s)}if(!this.translator.language)this.translator.changeLanguage(s);this.services.languageDetector?.cacheUserLanguage?.(s)}this.loadResources(s,(t=>{a(t,s)}))};if(!i&&this.services.languageDetector&&!this.services.languageDetector.async){f(this.services.languageDetector.detect())}else if(!i&&this.services.languageDetector&&this.services.languageDetector.async){if(this.services.languageDetector.detect.length===0){this.services.languageDetector.detect().then(f)}else{this.services.languageDetector.detect(f)}}else{f(i)}return r}getFixedT(e,i,s){var n=this;const r=function(t,e){let i;if(typeof e!=="object"){for(var o=arguments.length,a=new Array(o>2?o-2:0),f=2;f<o;f++){a[f-2]=arguments[f]}i=n.options.overloadTranslationOptionHandler([t,e].concat(a))}else{i={...e}}i.lng=i.lng||r.lng;i.lngs=i.lngs||r.lngs;i.ns=i.ns||r.ns;if(i.keyPrefix!=="")i.keyPrefix=i.keyPrefix||s||r.keyPrefix;const h=n.options.keySeparator||".";let u;if(i.keyPrefix&&Array.isArray(t)){u=t.map((t=>`${i.keyPrefix}${h}${t}`))}else{u=i.keyPrefix?`${i.keyPrefix}${h}${t}`:t}return n.t(u,i)};if(t(e)){r.lng=e}else{r.lngs=e}r.ns=i;r.keyPrefix=s;return r}t(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.translator?.translate(...e)}exists(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++){e[i]=arguments[i]}return this.translator?.exists(...e)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!this.isInitialized){this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages);return false}if(!this.languages||!this.languages.length){this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages);return false}const i=e.lng||this.resolvedLanguage||this.languages[0];const s=this.options?this.options.fallbackLng:false;const n=this.languages[this.languages.length-1];if(i.toLowerCase()==="cimode")return true;const r=(t,e)=>{const i=this.services.backendConnector.state[`${t}|${e}`];return i===-1||i===0||i===2};if(e.precheck){const t=e.precheck(this,r);if(t!==undefined)return t}if(this.hasResourceBundle(i,t))return true;if(!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages)return true;if(r(i,t)&&(!s||r(n,t)))return true;return false}loadNamespaces(i,s){const n=e();if(!this.options.ns){if(s)s();return Promise.resolve()}if(t(i))i=[i];i.forEach((t=>{if(this.options.ns.indexOf(t)<0)this.options.ns.push(t)}));this.loadResources((t=>{n.resolve();if(s)s(t)}));return n}loadLanguages(i,s){const n=e();if(t(i))i=[i];const r=this.options.preload||[];const o=i.filter((t=>r.indexOf(t)<0&&this.services.languageUtils.isSupportedCode(t)));if(!o.length){if(s)s();return Promise.resolve()}this.options.preload=r.concat(o);this.loadResources((t=>{n.resolve();if(s)s(t)}));return n}dir(t){if(!t)t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language);if(!t)return"rtl";const e=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"];const i=this.services?.languageUtils||new P(F());return e.indexOf(i.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let e=arguments.length>1?arguments[1]:undefined;return new q(t,e)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};let e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:J;const i=t.forkResourceStore;if(i)delete t.forkResourceStore;const s={...this.options,...t,...{isClone:true}};const n=new q(s);if(t.debug!==undefined||t.prefix!==undefined){n.logger=n.logger.clone(t)}const r=["store","services","language"];r.forEach((t=>{n[t]=this[t]}));n.services={...this.services};n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)};if(i){n.store=new S(this.store.data,s);n.services.resourceStore=n.store}n.translator=new L(n.services,s);n.translator.on("*",(function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s<e;s++){i[s-1]=arguments[s]}n.emit(t,...i)}));n.init(s,e);n.translator.options=s;n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)};return n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const W=q.createInstance();W.createInstance=q.createInstance;W.init({lng:"pt",fallbackLng:"en",interpolation:{escapeValue:false},resources:{en:{translation:{welcome:"Welcome",description:"This is an example","pin-sutitle":"Enter the 4-digit code sent via SMS to the number"}},pt:{translation:{edit:"Editar",welcome:"Bem-vindo",description:"Este é um exemplo","pin-sutitle":"Digite o código de 4 dígitos enviado por SMS ao número",giftDescription:"Você tem até <strong>R$ {{amount}}</strong> de {{custom_name}}",noGiftback:"O seu bônus não se aplica aos produtos selecionados.",noBonus:"Não há {{giftbackname}} disponível para essa compra.",withApplyBonus:"{{giftbackname}} aplicado ao pedido: ",maxAmount:"Você atingiu o valor máximo!",labelamountPartial:"Ao utilizar um valor parcial, você perderá a quantia restante.",labelUseGiftback:"Regra de utilização: Valor mínimo de compra de {{minimumPurchase}} reais para usar 100% do Giftback, válido até {{expírationDate}}",backCart:"Retorne ao carrinho e verifique se há descontos disponíveis nessa compra"}}}});export{W as i};
2
+ //# sourceMappingURL=p-c53241bf.js.map