@astropay/payments-lib 2.0.13 → 2.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astropay-payments-lib.es.js +1 -1
- package/dist/astropay-payments-lib.umd.js +12 -10
- package/dist/{main-BVnNYhE7.js → main-BRkwwMvM.js} +529 -457
- package/dist/{profiler-C-52WBjg.js → profiler-CWivq4Uv.js} +1 -1
- package/dist/{startRecording-D_v25im6.js → startRecording-BQ4eVzwy.js} +1 -1
- package/package.json +1 -1
|
@@ -35,8 +35,9 @@ ${te}`:""}`;await copyToClipboard(ne)}};function validateValue(ee,re,te){return
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
&.is-disabled {
|
|
38
|
-
cursor:
|
|
38
|
+
cursor: not-allowed;
|
|
39
39
|
pointer-events: none;
|
|
40
|
+
opacity: 0.4;
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -78,11 +79,12 @@ ${te}`:""}`;await copyToClipboard(ne)}};function validateValue(ee,re,te){return
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
&.is-disabled {
|
|
81
|
-
cursor:
|
|
82
|
+
cursor: not-allowed;
|
|
82
83
|
pointer-events: none;
|
|
84
|
+
opacity: 0.4;
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
|
-
`;class CardTabs extends Component{constructor({tabs:te,defaultActiveTab:ne=0,hideHeader:ie=!1,variant:oe="underline"}){super({tag:"div",styles:se=>getCardTabsStyles(se)});xe(this,"tabs");xe(this,"activeIndex");xe(this,"isSingleTab");xe(this,"tabButtons",[]);xe(this,"contentWrapper");if(this.tabs=te,this.isSingleTab=te.length===1,this.activeIndex=this.isSingleTab?0:Math.min(ne,te.length-1),!ie){const se=oe==="segmented",ae=document.createElement("div");ae.classList.add(se?"card-tabs-segmented":"card-tabs-header"),this.tabButtons=te.map((ue,ce)=>{const le=document.createElement("button");return le.textContent=ue.label,le.classList.add(se?"card-tab-seg":"card-tab"),this.isSingleTab?le.classList.add("is-active","is-disabled"):(ce===this.activeIndex&&le.classList.add("is-active"),le.addEventListener("click",()=>this.handleTabClick(ce))),ae.appendChild(le),le}),this.element.appendChild(ae)}this.contentWrapper=document.createElement("div"),this.contentWrapper.classList.add("card-tabs-content"),this.element.appendChild(this.contentWrapper),this.renderContent(this.activeIndex)}handleTabClick(te){var ne,ie,oe,se,ae,ue;te!==this.activeIndex&&((ne=this.tabButtons[this.activeIndex])==null||ne.classList.remove("is-active"),(oe=(ie=this.tabs[this.activeIndex])==null?void 0:ie.onClose)==null||oe.call(ie),this.contentWrapper.innerHTML="",this.activeIndex=te,(se=this.tabButtons[this.activeIndex])==null||se.classList.add("is-active"),(ue=(ae=this.tabs[this.activeIndex]).onSelect)==null||ue.call(ae),this.renderContent(this.activeIndex))}renderContent(te){const ne=this.tabs[te].content();this.contentWrapper.appendChild(ne)}switchToTab(te){this.handleTabClick(te)}destroy(){var te,ne;(ne=(te=this.tabs[this.activeIndex])==null?void 0:te.onClose)==null||ne.call(te),super.destroy()}}const rotateAnimation=keyframes`
|
|
87
|
+
`;class CardTabs extends Component{constructor({tabs:te,defaultActiveTab:ne=0,hideHeader:ie=!1,variant:oe="underline"}){super({tag:"div",styles:se=>getCardTabsStyles(se)});xe(this,"tabs");xe(this,"activeIndex");xe(this,"isSingleTab");xe(this,"tabButtons",[]);xe(this,"contentWrapper");if(this.tabs=te,this.isSingleTab=te.length===1,this.activeIndex=this.isSingleTab?0:Math.min(ne,te.length-1),!ie){const se=oe==="segmented",ae=document.createElement("div");ae.classList.add(se?"card-tabs-segmented":"card-tabs-header"),this.tabButtons=te.map((ue,ce)=>{const le=document.createElement("button");return le.textContent=ue.label,le.classList.add(se?"card-tab-seg":"card-tab"),this.isSingleTab?le.classList.add("is-active","is-disabled"):(ce===this.activeIndex&&le.classList.add("is-active"),le.addEventListener("click",()=>this.handleTabClick(ce))),ae.appendChild(le),le}),this.element.appendChild(ae)}this.contentWrapper=document.createElement("div"),this.contentWrapper.classList.add("card-tabs-content"),this.element.appendChild(this.contentWrapper),this.renderContent(this.activeIndex)}handleTabClick(te){var ne,ie,oe,se,ae,ue;te!==this.activeIndex&&((ne=this.tabButtons[this.activeIndex])==null||ne.classList.remove("is-active"),(oe=(ie=this.tabs[this.activeIndex])==null?void 0:ie.onClose)==null||oe.call(ie),this.contentWrapper.innerHTML="",this.activeIndex=te,(se=this.tabButtons[this.activeIndex])==null||se.classList.add("is-active"),(ue=(ae=this.tabs[this.activeIndex]).onSelect)==null||ue.call(ae),this.renderContent(this.activeIndex))}renderContent(te){const ne=this.tabs[te].content();this.contentWrapper.appendChild(ne)}switchToTab(te){this.handleTabClick(te)}lock(){this.tabButtons.forEach((te,ne)=>{ne!==this.activeIndex&&te.classList.add("is-disabled")})}unlock(){this.tabButtons.forEach(te=>{te.classList.remove("is-disabled")})}destroy(){var te,ne;(ne=(te=this.tabs[this.activeIndex])==null?void 0:te.onClose)==null||ne.call(te),super.destroy()}}const rotateAnimation=keyframes`
|
|
86
88
|
100% {
|
|
87
89
|
transform: rotate(360deg);
|
|
88
90
|
}
|
|
@@ -142,12 +144,12 @@ ${te}`:""}`;await copyToClipboard(ne)}};function validateValue(ee,re,te){return
|
|
|
142
144
|
text-align: ${re.align};
|
|
143
145
|
|
|
144
146
|
text-transform: ${re.uppercase?"uppercase":"none"};
|
|
145
|
-
`};class Typography extends Component{constructor({text:re,variant:te="span",weight:ne=500,size:ie="small",lineHeight:oe,align:se="left",color:ae,uppercase:ue=!1}){const ce={size:ie,weight:ne,lineHeight:oe,align:se,color:ae,uppercase:ue};super({tag:te,styles:le=>getTypographyStyles(le,ce)}),this.element.textContent=re}}const isString$2=ee=>typeof ee=="string",defer=()=>{let ee,re;const te=new Promise((ne,ie)=>{ee=ne,re=ie});return te.resolve=ee,te.reject=re,te},makeString=ee=>ee==null?"":""+ee,copy=(ee,re,te)=>{ee.forEach(ne=>{re[ne]&&(te[ne]=re[ne])})},lastOfPathSeparatorRegExp=/###/g,cleanKey=ee=>ee&&ee.indexOf("###")>-1?ee.replace(lastOfPathSeparatorRegExp,"."):ee,canNotTraverseDeeper=ee=>!ee||isString$2(ee),getLastOfPath=(ee,re,te)=>{const ne=isString$2(re)?re.split("."):re;let ie=0;for(;ie<ne.length-1;){if(canNotTraverseDeeper(ee))return{};const oe=cleanKey(ne[ie]);!ee[oe]&&te&&(ee[oe]=new te),Object.prototype.hasOwnProperty.call(ee,oe)?ee=ee[oe]:ee={},++ie}return canNotTraverseDeeper(ee)?{}:{obj:ee,k:cleanKey(ne[ie])}},setPath=(ee,re,te)=>{const{obj:ne,k:ie}=getLastOfPath(ee,re,Object);if(ne!==void 0||re.length===1){ne[ie]=te;return}let oe=re[re.length-1],se=re.slice(0,re.length-1),ae=getLastOfPath(ee,se,Object);for(;ae.obj===void 0&&se.length;)oe=`${se[se.length-1]}.${oe}`,se=se.slice(0,se.length-1),ae=getLastOfPath(ee,se,Object),ae!=null&&ae.obj&&typeof ae.obj[`${ae.k}.${oe}`]<"u"&&(ae.obj=void 0);ae.obj[`${ae.k}.${oe}`]=te},pushPath=(ee,re,te,ne)=>{const{obj:ie,k:oe}=getLastOfPath(ee,re,Object);ie[oe]=ie[oe]||[],ie[oe].push(te)},getPath=(ee,re)=>{const{obj:te,k:ne}=getLastOfPath(ee,re);if(te&&Object.prototype.hasOwnProperty.call(te,ne))return te[ne]},getPathWithDefaults=(ee,re,te)=>{const ne=getPath(ee,te);return ne!==void 0?ne:getPath(re,te)},deepExtend=(ee,re,te)=>{for(const ne in re)ne!=="__proto__"&&ne!=="constructor"&&(ne in ee?isString$2(ee[ne])||ee[ne]instanceof String||isString$2(re[ne])||re[ne]instanceof String?te&&(ee[ne]=re[ne]):deepExtend(ee[ne],re[ne],te):ee[ne]=re[ne]);return ee},regexEscape=ee=>ee.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const escape$1=ee=>isString$2(ee)?ee.replace(/[&<>"'\/]/g,re=>_entityMap[re]):ee;class RegExpCache{constructor(re){this.capacity=re,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(re){const te=this.regExpMap.get(re);if(te!==void 0)return te;const ne=new RegExp(re);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(re,ne),this.regExpQueue.push(re),ne}}const chars=[" ",",","?","!",";"],looksLikeObjectPathRegExpCache=new RegExpCache(20),looksLikeObjectPath=(ee,re,te)=>{re=re||"",te=te||"";const ne=chars.filter(se=>re.indexOf(se)<0&&te.indexOf(se)<0);if(ne.length===0)return!0;const ie=looksLikeObjectPathRegExpCache.getRegExp(`(${ne.map(se=>se==="?"?"\\?":se).join("|")})`);let oe=!ie.test(ee);if(!oe){const se=ee.indexOf(te);se>0&&!ie.test(ee.substring(0,se))&&(oe=!0)}return oe},deepFind=function(ee,re){let te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!ee)return;if(ee[re])return Object.prototype.hasOwnProperty.call(ee,re)?ee[re]:void 0;const ne=re.split(te);let ie=ee;for(let oe=0;oe<ne.length;){if(!ie||typeof ie!="object")return;let se,ae="";for(let ue=oe;ue<ne.length;++ue)if(ue!==oe&&(ae+=te),ae+=ne[ue],se=ie[ae],se!==void 0){if(["string","number","boolean"].indexOf(typeof se)>-1&&ue<ne.length-1)continue;oe+=ue-oe+1;break}ie=se}return ie},getCleanedCode=ee=>ee==null?void 0:ee.replace("_","-"),consoleLogger={type:"logger",log(ee){this.output("log",ee)},warn(ee){this.output("warn",ee)},error(ee){this.output("error",ee)},output(ee,re){var te,ne;(ne=(te=console==null?void 0:console[ee])==null?void 0:te.apply)==null||ne.call(te,console,re)}};let Logger$1=class ho{constructor(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(re,te)}init(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=te.prefix||"i18next:",this.logger=re||consoleLogger,this.options=te,this.debug=te.debug}log(){for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return this.forward(te,"log","",!0)}warn(){for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return this.forward(te,"warn","",!0)}error(){for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return this.forward(te,"error","")}deprecate(){for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return this.forward(te,"warn","WARNING DEPRECATED: ",!0)}forward(re,te,ne,ie){return ie&&!this.debug?null:(isString$2(re[0])&&(re[0]=`${ne}${this.prefix} ${re[0]}`),this.logger[te](re))}create(re){return new ho(this.logger,{prefix:`${this.prefix}:${re}:`,...this.options})}clone(re){return re=re||this.options,re.prefix=re.prefix||this.prefix,new ho(this.logger,re)}};var baseLogger=new Logger$1;class EventEmitter{constructor(){this.observers={}}on(re,te){return re.split(" ").forEach(ne=>{this.observers[ne]||(this.observers[ne]=new Map);const ie=this.observers[ne].get(te)||0;this.observers[ne].set(te,ie+1)}),this}off(re,te){if(this.observers[re]){if(!te){delete this.observers[re];return}this.observers[re].delete(te)}}emit(re){for(var te=arguments.length,ne=new Array(te>1?te-1:0),ie=1;ie<te;ie++)ne[ie-1]=arguments[ie];this.observers[re]&&Array.from(this.observers[re].entries()).forEach(se=>{let[ae,ue]=se;for(let ce=0;ce<ue;ce++)ae(...ne)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(se=>{let[ae,ue]=se;for(let ce=0;ce<ue;ce++)ae.apply(ae,[re,...ne])})}}class ResourceStore extends EventEmitter{constructor(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=re||{},this.options=te,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(re){this.options.ns.indexOf(re)<0&&this.options.ns.push(re)}removeNamespaces(re){const te=this.options.ns.indexOf(re);te>-1&&this.options.ns.splice(te,1)}getResource(re,te,ne){var ce,le;let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const oe=ie.keySeparator!==void 0?ie.keySeparator:this.options.keySeparator,se=ie.ignoreJSONStructure!==void 0?ie.ignoreJSONStructure:this.options.ignoreJSONStructure;let ae;re.indexOf(".")>-1?ae=re.split("."):(ae=[re,te],ne&&(Array.isArray(ne)?ae.push(...ne):isString$2(ne)&&oe?ae.push(...ne.split(oe)):ae.push(ne)));const ue=getPath(this.data,ae);return!ue&&!te&&!ne&&re.indexOf(".")>-1&&(re=ae[0],te=ae[1],ne=ae.slice(2).join(".")),ue||!se||!isString$2(ne)?ue:deepFind((le=(ce=this.data)==null?void 0:ce[re])==null?void 0:le[te],ne,oe)}addResource(re,te,ne,ie){let oe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const se=oe.keySeparator!==void 0?oe.keySeparator:this.options.keySeparator;let ae=[re,te];ne&&(ae=ae.concat(se?ne.split(se):ne)),re.indexOf(".")>-1&&(ae=re.split("."),ie=te,te=ae[1]),this.addNamespaces(te),setPath(this.data,ae,ie),oe.silent||this.emit("added",re,te,ne,ie)}addResources(re,te,ne){let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const oe in ne)(isString$2(ne[oe])||Array.isArray(ne[oe]))&&this.addResource(re,te,oe,ne[oe],{silent:!0});ie.silent||this.emit("added",re,te,ne)}addResourceBundle(re,te,ne,ie,oe){let se=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},ae=[re,te];re.indexOf(".")>-1&&(ae=re.split("."),ie=ne,ne=te,te=ae[1]),this.addNamespaces(te);let ue=getPath(this.data,ae)||{};se.skipCopy||(ne=JSON.parse(JSON.stringify(ne))),ie?deepExtend(ue,ne,oe):ue={...ue,...ne},setPath(this.data,ae,ue),se.silent||this.emit("added",re,te,ne)}removeResourceBundle(re,te){this.hasResourceBundle(re,te)&&delete this.data[re][te],this.removeNamespaces(te),this.emit("removed",re,te)}hasResourceBundle(re,te){return this.getResource(re,te)!==void 0}getResourceBundle(re,te){return te||(te=this.options.defaultNS),this.getResource(re,te)}getDataByLanguage(re){return this.data[re]}hasLanguageSomeTranslations(re){const te=this.getDataByLanguage(re);return!!(te&&Object.keys(te)||[]).find(ie=>te[ie]&&Object.keys(te[ie]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(ee){this.processors[ee.name]=ee},handle(ee,re,te,ne,ie){return ee.forEach(oe=>{var se;re=((se=this.processors[oe])==null?void 0:se.process(re,te,ne,ie))??re}),re}};const checkedLoadedFor={},shouldHandleAsObject=ee=>!isString$2(ee)&&typeof ee!="boolean"&&typeof ee!="number";class Translator extends EventEmitter{constructor(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],re,this),this.options=te,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(re){re&&(this.language=re)}exists(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(re==null)return!1;const ne=this.resolve(re,te);return(ne==null?void 0:ne.res)!==void 0}extractFromKey(re,te){let ne=te.nsSeparator!==void 0?te.nsSeparator:this.options.nsSeparator;ne===void 0&&(ne=":");const ie=te.keySeparator!==void 0?te.keySeparator:this.options.keySeparator;let oe=te.ns||this.options.defaultNS||[];const se=ne&&re.indexOf(ne)>-1,ae=!this.options.userDefinedKeySeparator&&!te.keySeparator&&!this.options.userDefinedNsSeparator&&!te.nsSeparator&&!looksLikeObjectPath(re,ne,ie);if(se&&!ae){const ue=re.match(this.interpolator.nestingRegexp);if(ue&&ue.length>0)return{key:re,namespaces:isString$2(oe)?[oe]:oe};const ce=re.split(ne);(ne!==ie||ne===ie&&this.options.ns.indexOf(ce[0])>-1)&&(oe=ce.shift()),re=ce.join(ie)}return{key:re,namespaces:isString$2(oe)?[oe]:oe}}translate(re,te,ne){if(typeof te!="object"&&this.options.overloadTranslationOptionHandler&&(te=this.options.overloadTranslationOptionHandler(arguments)),typeof te=="object"&&(te={...te}),te||(te={}),re==null)return"";Array.isArray(re)||(re=[String(re)]);const ie=te.returnDetails!==void 0?te.returnDetails:this.options.returnDetails,oe=te.keySeparator!==void 0?te.keySeparator:this.options.keySeparator,{key:se,namespaces:ae}=this.extractFromKey(re[re.length-1],te),ue=ae[ae.length-1],ce=te.lng||this.language,le=te.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((ce==null?void 0:ce.toLowerCase())==="cimode"){if(le){const Re=te.nsSeparator||this.options.nsSeparator;return ie?{res:`${ue}${Re}${se}`,usedKey:se,exactUsedKey:se,usedLng:ce,usedNS:ue,usedParams:this.getUsedParamsDetails(te)}:`${ue}${Re}${se}`}return ie?{res:se,usedKey:se,exactUsedKey:se,usedLng:ce,usedNS:ue,usedParams:this.getUsedParamsDetails(te)}:se}const de=this.resolve(re,te);let fe=de==null?void 0:de.res;const he=(de==null?void 0:de.usedKey)||se,pe=(de==null?void 0:de.exactUsedKey)||se,ge=["[object Number]","[object Function]","[object RegExp]"],me=te.joinArrays!==void 0?te.joinArrays:this.options.joinArrays,ye=!this.i18nFormat||this.i18nFormat.handleAsObject,ve=te.count!==void 0&&!isString$2(te.count),be=Translator.hasDefaultValue(te),_e=ve?this.pluralResolver.getSuffix(ce,te.count,te):"",Ie=te.ordinal&&ve?this.pluralResolver.getSuffix(ce,te.count,{ordinal:!1}):"",Te=ve&&!te.ordinal&&te.count===0,Se=Te&&te[`defaultValue${this.options.pluralSeparator}zero`]||te[`defaultValue${_e}`]||te[`defaultValue${Ie}`]||te.defaultValue;let Oe=fe;ye&&!fe&&be&&(Oe=Se);const Ce=shouldHandleAsObject(Oe),we=Object.prototype.toString.apply(Oe);if(ye&&Oe&&Ce&&ge.indexOf(we)<0&&!(isString$2(me)&&Array.isArray(Oe))){if(!te.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Re=this.options.returnedObjectHandler?this.options.returnedObjectHandler(he,Oe,{...te,ns:ae}):`key '${se} (${this.language})' returned an object instead of string.`;return ie?(de.res=Re,de.usedParams=this.getUsedParamsDetails(te),de):Re}if(oe){const Re=Array.isArray(Oe),Ne=Re?[]:{},Ue=Re?pe:he;for(const Fe in Oe)if(Object.prototype.hasOwnProperty.call(Oe,Fe)){const Ve=`${Ue}${oe}${Fe}`;be&&!fe?Ne[Fe]=this.translate(Ve,{...te,defaultValue:shouldHandleAsObject(Se)?Se[Fe]:void 0,joinArrays:!1,ns:ae}):Ne[Fe]=this.translate(Ve,{...te,joinArrays:!1,ns:ae}),Ne[Fe]===Ve&&(Ne[Fe]=Oe[Fe])}fe=Ne}}else if(ye&&isString$2(me)&&Array.isArray(fe))fe=fe.join(me),fe&&(fe=this.extendTranslation(fe,re,te,ne));else{let Re=!1,Ne=!1;!this.isValidLookup(fe)&&be&&(Re=!0,fe=Se),this.isValidLookup(fe)||(Ne=!0,fe=se);const Fe=(te.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Ne?void 0:fe,Ve=be&&Se!==fe&&this.options.updateMissing;if(Ne||Re||Ve){if(this.logger.log(Ve?"updateKey":"missingKey",ce,ue,se,Ve?Se:fe),oe){const hr=this.resolve(se,{...te,keySeparator:!1});hr&&hr.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 He=[];const ur=this.languageUtils.getFallbackCodes(this.options.fallbackLng,te.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ur&&ur[0])for(let hr=0;hr<ur.length;hr++)He.push(ur[hr]);else this.options.saveMissingTo==="all"?He=this.languageUtils.toResolveHierarchy(te.lng||this.language):He.push(te.lng||this.language);const Ge=(hr,fr,dr)=>{var Bt;const Qe=be&&dr!==fe?dr:Fe;this.options.missingKeyHandler?this.options.missingKeyHandler(hr,ue,fr,Qe,Ve,te):(Bt=this.backendConnector)!=null&&Bt.saveMissing&&this.backendConnector.saveMissing(hr,ue,fr,Qe,Ve,te),this.emit("missingKey",hr,ue,fr,fe)};this.options.saveMissing&&(this.options.saveMissingPlurals&&ve?He.forEach(hr=>{const fr=this.pluralResolver.getSuffixes(hr,te);Te&&te[`defaultValue${this.options.pluralSeparator}zero`]&&fr.indexOf(`${this.options.pluralSeparator}zero`)<0&&fr.push(`${this.options.pluralSeparator}zero`),fr.forEach(dr=>{Ge([hr],se+dr,te[`defaultValue${dr}`]||Se)})}):Ge(He,se,Se))}fe=this.extendTranslation(fe,re,te,de,ne),Ne&&fe===se&&this.options.appendNamespaceToMissingKey&&(fe=`${ue}:${se}`),(Ne||Re)&&this.options.parseMissingKeyHandler&&(fe=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${ue}:${se}`:se,Re?fe:void 0))}return ie?(de.res=fe,de.usedParams=this.getUsedParamsDetails(te),de):fe}extendTranslation(re,te,ne,ie,oe){var ce,le;var se=this;if((ce=this.i18nFormat)!=null&&ce.parse)re=this.i18nFormat.parse(re,{...this.options.interpolation.defaultVariables,...ne},ne.lng||this.language||ie.usedLng,ie.usedNS,ie.usedKey,{resolved:ie});else if(!ne.skipInterpolation){ne.interpolation&&this.interpolator.init({...ne,interpolation:{...this.options.interpolation,...ne.interpolation}});const de=isString$2(re)&&(((le=ne==null?void 0:ne.interpolation)==null?void 0:le.skipOnVariables)!==void 0?ne.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let fe;if(de){const pe=re.match(this.interpolator.nestingRegexp);fe=pe&&pe.length}let he=ne.replace&&!isString$2(ne.replace)?ne.replace:ne;if(this.options.interpolation.defaultVariables&&(he={...this.options.interpolation.defaultVariables,...he}),re=this.interpolator.interpolate(re,he,ne.lng||this.language||ie.usedLng,ne),de){const pe=re.match(this.interpolator.nestingRegexp),ge=pe&&pe.length;fe<ge&&(ne.nest=!1)}!ne.lng&&ie&&ie.res&&(ne.lng=this.language||ie.usedLng),ne.nest!==!1&&(re=this.interpolator.nest(re,function(){for(var pe=arguments.length,ge=new Array(pe),me=0;me<pe;me++)ge[me]=arguments[me];return(oe==null?void 0:oe[0])===ge[0]&&!ne.context?(se.logger.warn(`It seems you are nesting recursively key: ${ge[0]} in key: ${te[0]}`),null):se.translate(...ge,te)},ne)),ne.interpolation&&this.interpolator.reset()}const ae=ne.postProcess||this.options.postProcess,ue=isString$2(ae)?[ae]:ae;return re!=null&&(ue!=null&&ue.length)&&ne.applyPostProcessor!==!1&&(re=postProcessor.handle(ue,re,te,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...ie,usedParams:this.getUsedParamsDetails(ne)},...ne}:ne,this)),re}resolve(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ne,ie,oe,se,ae;return isString$2(re)&&(re=[re]),re.forEach(ue=>{if(this.isValidLookup(ne))return;const ce=this.extractFromKey(ue,te),le=ce.key;ie=le;let de=ce.namespaces;this.options.fallbackNS&&(de=de.concat(this.options.fallbackNS));const fe=te.count!==void 0&&!isString$2(te.count),he=fe&&!te.ordinal&&te.count===0,pe=te.context!==void 0&&(isString$2(te.context)||typeof te.context=="number")&&te.context!=="",ge=te.lngs?te.lngs:this.languageUtils.toResolveHierarchy(te.lng||this.language,te.fallbackLng);de.forEach(me=>{var ye,ve;this.isValidLookup(ne)||(ae=me,!checkedLoadedFor[`${ge[0]}-${me}`]&&((ye=this.utils)!=null&&ye.hasLoadedNamespace)&&!((ve=this.utils)!=null&&ve.hasLoadedNamespace(ae))&&(checkedLoadedFor[`${ge[0]}-${me}`]=!0,this.logger.warn(`key "${ie}" for languages "${ge.join(", ")}" won't get resolved as namespace "${ae}" 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!!!")),ge.forEach(be=>{var Te;if(this.isValidLookup(ne))return;se=be;const _e=[le];if((Te=this.i18nFormat)!=null&&Te.addLookupKeys)this.i18nFormat.addLookupKeys(_e,le,be,me,te);else{let Se;fe&&(Se=this.pluralResolver.getSuffix(be,te.count,te));const Oe=`${this.options.pluralSeparator}zero`,Ce=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(fe&&(_e.push(le+Se),te.ordinal&&Se.indexOf(Ce)===0&&_e.push(le+Se.replace(Ce,this.options.pluralSeparator)),he&&_e.push(le+Oe)),pe){const we=`${le}${this.options.contextSeparator}${te.context}`;_e.push(we),fe&&(_e.push(we+Se),te.ordinal&&Se.indexOf(Ce)===0&&_e.push(we+Se.replace(Ce,this.options.pluralSeparator)),he&&_e.push(we+Oe))}}let Ie;for(;Ie=_e.pop();)this.isValidLookup(ne)||(oe=Ie,ne=this.getResource(be,me,Ie,te))}))})}),{res:ne,usedKey:ie,exactUsedKey:oe,usedLng:se,usedNS:ae}}isValidLookup(re){return re!==void 0&&!(!this.options.returnNull&&re===null)&&!(!this.options.returnEmptyString&&re==="")}getResource(re,te,ne){var oe;let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(oe=this.i18nFormat)!=null&&oe.getResource?this.i18nFormat.getResource(re,te,ne,ie):this.resourceStore.getResource(re,te,ne,ie)}getUsedParamsDetails(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const te=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],ne=re.replace&&!isString$2(re.replace);let ie=ne?re.replace:re;if(ne&&typeof re.count<"u"&&(ie.count=re.count),this.options.interpolation.defaultVariables&&(ie={...this.options.interpolation.defaultVariables,...ie}),!ne){ie={...ie};for(const oe of te)delete ie[oe]}return ie}static hasDefaultValue(re){const te="defaultValue";for(const ne in re)if(Object.prototype.hasOwnProperty.call(re,ne)&&te===ne.substring(0,te.length)&&re[ne]!==void 0)return!0;return!1}}class LanguageUtil{constructor(re){this.options=re,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(re){if(re=getCleanedCode(re),!re||re.indexOf("-")<0)return null;const te=re.split("-");return te.length===2||(te.pop(),te[te.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(te.join("-"))}getLanguagePartFromCode(re){if(re=getCleanedCode(re),!re||re.indexOf("-")<0)return re;const te=re.split("-");return this.formatLanguageCode(te[0])}formatLanguageCode(re){if(isString$2(re)&&re.indexOf("-")>-1){let te;try{te=Intl.getCanonicalLocales(re)[0]}catch{}return te&&this.options.lowerCaseLng&&(te=te.toLowerCase()),te||(this.options.lowerCaseLng?re.toLowerCase():re)}return this.options.cleanCode||this.options.lowerCaseLng?re.toLowerCase():re}isSupportedCode(re){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(re=this.getLanguagePartFromCode(re)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(re)>-1}getBestMatchFromCodes(re){if(!re)return null;let te;return re.forEach(ne=>{if(te)return;const ie=this.formatLanguageCode(ne);(!this.options.supportedLngs||this.isSupportedCode(ie))&&(te=ie)}),!te&&this.options.supportedLngs&&re.forEach(ne=>{if(te)return;const ie=this.getLanguagePartFromCode(ne);if(this.isSupportedCode(ie))return te=ie;te=this.options.supportedLngs.find(oe=>{if(oe===ie)return oe;if(!(oe.indexOf("-")<0&&ie.indexOf("-")<0)&&(oe.indexOf("-")>0&&ie.indexOf("-")<0&&oe.substring(0,oe.indexOf("-"))===ie||oe.indexOf(ie)===0&&ie.length>1))return oe})}),te||(te=this.getFallbackCodes(this.options.fallbackLng)[0]),te}getFallbackCodes(re,te){if(!re)return[];if(typeof re=="function"&&(re=re(te)),isString$2(re)&&(re=[re]),Array.isArray(re))return re;if(!te)return re.default||[];let ne=re[te];return ne||(ne=re[this.getScriptPartFromCode(te)]),ne||(ne=re[this.formatLanguageCode(te)]),ne||(ne=re[this.getLanguagePartFromCode(te)]),ne||(ne=re.default),ne||[]}toResolveHierarchy(re,te){const ne=this.getFallbackCodes(te||this.options.fallbackLng||[],re),ie=[],oe=se=>{se&&(this.isSupportedCode(se)?ie.push(se):this.logger.warn(`rejecting language code not found in supportedLngs: ${se}`))};return isString$2(re)&&(re.indexOf("-")>-1||re.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&oe(this.formatLanguageCode(re)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&oe(this.getScriptPartFromCode(re)),this.options.load!=="currentOnly"&&oe(this.getLanguagePartFromCode(re))):isString$2(re)&&oe(this.formatLanguageCode(re)),ne.forEach(se=>{ie.indexOf(se)<0&&oe(this.formatLanguageCode(se))}),ie}}const suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5},dummyRule={select:ee=>ee===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class PluralResolver{constructor(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=re,this.options=te,this.logger=baseLogger.create("pluralResolver"),this.pluralRulesCache={}}addRule(re,te){this.rules[re]=te}clearCache(){this.pluralRulesCache={}}getRule(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const ne=getCleanedCode(re==="dev"?"en":re),ie=te.ordinal?"ordinal":"cardinal",oe=JSON.stringify({cleanedCode:ne,type:ie});if(oe in this.pluralRulesCache)return this.pluralRulesCache[oe];let se;try{se=new Intl.PluralRules(ne,{type:ie})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),dummyRule;if(!re.match(/-|_/))return dummyRule;const ue=this.languageUtils.getLanguagePartFromCode(re);se=this.getRule(ue,te)}return this.pluralRulesCache[oe]=se,se}needsPlural(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ne=this.getRule(re,te);return ne||(ne=this.getRule("dev",te)),(ne==null?void 0:ne.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(re,te){let ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(re,ne).map(ie=>`${te}${ie}`)}getSuffixes(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ne=this.getRule(re,te);return ne||(ne=this.getRule("dev",te)),ne?ne.resolvedOptions().pluralCategories.sort((ie,oe)=>suffixesOrder[ie]-suffixesOrder[oe]).map(ie=>`${this.options.prepend}${te.ordinal?`ordinal${this.options.prepend}`:""}${ie}`):[]}getSuffix(re,te){let ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const ie=this.getRule(re,ne);return ie?`${this.options.prepend}${ne.ordinal?`ordinal${this.options.prepend}`:""}${ie.select(te)}`:(this.logger.warn(`no plural rule found for: ${re}`),this.getSuffix("dev",te,ne))}}const deepFindWithDefaults=function(ee,re,te){let ne=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",ie=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,oe=getPathWithDefaults(ee,re,te);return!oe&&ie&&isString$2(te)&&(oe=deepFind(ee,te,ne),oe===void 0&&(oe=deepFind(re,te,ne))),oe},regexSafe=ee=>ee.replace(/\$/g,"$$$$");class Interpolator{constructor(){var te;let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=re,this.format=((te=re==null?void 0:re.interpolation)==null?void 0:te.format)||(ne=>ne),this.init(re)}init(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};re.interpolation||(re.interpolation={escapeValue:!0});const{escape:te,escapeValue:ne,useRawValueToEscape:ie,prefix:oe,prefixEscaped:se,suffix:ae,suffixEscaped:ue,formatSeparator:ce,unescapeSuffix:le,unescapePrefix:de,nestingPrefix:fe,nestingPrefixEscaped:he,nestingSuffix:pe,nestingSuffixEscaped:ge,nestingOptionsSeparator:me,maxReplaces:ye,alwaysFormat:ve}=re.interpolation;this.escape=te!==void 0?te:escape$1,this.escapeValue=ne!==void 0?ne:!0,this.useRawValueToEscape=ie!==void 0?ie:!1,this.prefix=oe?regexEscape(oe):se||"{{",this.suffix=ae?regexEscape(ae):ue||"}}",this.formatSeparator=ce||",",this.unescapePrefix=le?"":de||"-",this.unescapeSuffix=this.unescapePrefix?"":le||"",this.nestingPrefix=fe?regexEscape(fe):he||regexEscape("$t("),this.nestingSuffix=pe?regexEscape(pe):ge||regexEscape(")"),this.nestingOptionsSeparator=me||",",this.maxReplaces=ye||1e3,this.alwaysFormat=ve!==void 0?ve:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const re=(te,ne)=>(te==null?void 0:te.source)===ne?(te.lastIndex=0,te):new RegExp(ne,"g");this.regexp=re(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=re(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=re(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(re,te,ne,ie){var he;let oe,se,ae;const ue=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},ce=pe=>{if(pe.indexOf(this.formatSeparator)<0){const ve=deepFindWithDefaults(te,ue,pe,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(ve,void 0,ne,{...ie,...te,interpolationkey:pe}):ve}const ge=pe.split(this.formatSeparator),me=ge.shift().trim(),ye=ge.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(te,ue,me,this.options.keySeparator,this.options.ignoreJSONStructure),ye,ne,{...ie,...te,interpolationkey:me})};this.resetRegExp();const le=(ie==null?void 0:ie.missingInterpolationHandler)||this.options.missingInterpolationHandler,de=((he=ie==null?void 0:ie.interpolation)==null?void 0:he.skipOnVariables)!==void 0?ie.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:pe=>regexSafe(pe)},{regex:this.regexp,safeValue:pe=>this.escapeValue?regexSafe(this.escape(pe)):regexSafe(pe)}].forEach(pe=>{for(ae=0;oe=pe.regex.exec(re);){const ge=oe[1].trim();if(se=ce(ge),se===void 0)if(typeof le=="function"){const ye=le(re,oe,ie);se=isString$2(ye)?ye:""}else if(ie&&Object.prototype.hasOwnProperty.call(ie,ge))se="";else if(de){se=oe[0];continue}else this.logger.warn(`missed to pass in variable ${ge} for interpolating ${re}`),se="";else!isString$2(se)&&!this.useRawValueToEscape&&(se=makeString(se));const me=pe.safeValue(se);if(re=re.replace(oe[0],me),de?(pe.regex.lastIndex+=se.length,pe.regex.lastIndex-=oe[0].length):pe.regex.lastIndex=0,ae++,ae>=this.maxReplaces)break}}),re}nest(re,te){let ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ie,oe,se;const ae=(ue,ce)=>{const le=this.nestingOptionsSeparator;if(ue.indexOf(le)<0)return ue;const de=ue.split(new RegExp(`${le}[ ]*{`));let fe=`{${de[1]}`;ue=de[0],fe=this.interpolate(fe,se);const he=fe.match(/'/g),pe=fe.match(/"/g);(((he==null?void 0:he.length)??0)%2===0&&!pe||pe.length%2!==0)&&(fe=fe.replace(/'/g,'"'));try{se=JSON.parse(fe),ce&&(se={...ce,...se})}catch(ge){return this.logger.warn(`failed parsing options string in nesting for key ${ue}`,ge),`${ue}${le}${fe}`}return se.defaultValue&&se.defaultValue.indexOf(this.prefix)>-1&&delete se.defaultValue,ue};for(;ie=this.nestingRegexp.exec(re);){let ue=[];se={...ne},se=se.replace&&!isString$2(se.replace)?se.replace:se,se.applyPostProcessor=!1,delete se.defaultValue;let ce=!1;if(ie[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(ie[1])){const le=ie[1].split(this.formatSeparator).map(de=>de.trim());ie[1]=le.shift(),ue=le,ce=!0}if(oe=te(ae.call(this,ie[1].trim(),se),se),oe&&ie[0]===re&&!isString$2(oe))return oe;isString$2(oe)||(oe=makeString(oe)),oe||(this.logger.warn(`missed to resolve ${ie[1]} for nesting ${re}`),oe=""),ce&&(oe=ue.reduce((le,de)=>this.format(le,de,ne.lng,{...ne,interpolationkey:ie[1].trim()}),oe.trim())),re=re.replace(ie[0],oe),this.regexp.lastIndex=0}return re}}const parseFormatStr=ee=>{let re=ee.toLowerCase().trim();const te={};if(ee.indexOf("(")>-1){const ne=ee.split("(");re=ne[0].toLowerCase().trim();const ie=ne[1].substring(0,ne[1].length-1);re==="currency"&&ie.indexOf(":")<0?te.currency||(te.currency=ie.trim()):re==="relativetime"&&ie.indexOf(":")<0?te.range||(te.range=ie.trim()):ie.split(";").forEach(se=>{if(se){const[ae,...ue]=se.split(":"),ce=ue.join(":").trim().replace(/^'+|'+$/g,""),le=ae.trim();te[le]||(te[le]=ce),ce==="false"&&(te[le]=!1),ce==="true"&&(te[le]=!0),isNaN(ce)||(te[le]=parseInt(ce,10))}})}return{formatName:re,formatOptions:te}},createCachedFormatter=ee=>{const re={};return(te,ne,ie)=>{let oe=ie;ie&&ie.interpolationkey&&ie.formatParams&&ie.formatParams[ie.interpolationkey]&&ie[ie.interpolationkey]&&(oe={...oe,[ie.interpolationkey]:void 0});const se=ne+JSON.stringify(oe);let ae=re[se];return ae||(ae=ee(getCleanedCode(ne),ie),re[se]=ae),ae(te)}};class Formatter{constructor(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=re,this.formats={number:createCachedFormatter((te,ne)=>{const ie=new Intl.NumberFormat(te,{...ne});return oe=>ie.format(oe)}),currency:createCachedFormatter((te,ne)=>{const ie=new Intl.NumberFormat(te,{...ne,style:"currency"});return oe=>ie.format(oe)}),datetime:createCachedFormatter((te,ne)=>{const ie=new Intl.DateTimeFormat(te,{...ne});return oe=>ie.format(oe)}),relativetime:createCachedFormatter((te,ne)=>{const ie=new Intl.RelativeTimeFormat(te,{...ne});return oe=>ie.format(oe,ne.range||"day")}),list:createCachedFormatter((te,ne)=>{const ie=new Intl.ListFormat(te,{...ne});return oe=>ie.format(oe)})},this.init(re)}init(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=te.interpolation.formatSeparator||","}add(re,te){this.formats[re.toLowerCase().trim()]=te}addCached(re,te){this.formats[re.toLowerCase().trim()]=createCachedFormatter(te)}format(re,te,ne){let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const oe=te.split(this.formatSeparator);if(oe.length>1&&oe[0].indexOf("(")>1&&oe[0].indexOf(")")<0&&oe.find(ae=>ae.indexOf(")")>-1)){const ae=oe.findIndex(ue=>ue.indexOf(")")>-1);oe[0]=[oe[0],...oe.splice(1,ae)].join(this.formatSeparator)}return oe.reduce((ae,ue)=>{var de;const{formatName:ce,formatOptions:le}=parseFormatStr(ue);if(this.formats[ce]){let fe=ae;try{const he=((de=ie==null?void 0:ie.formatParams)==null?void 0:de[ie.interpolationkey])||{},pe=he.locale||he.lng||ie.locale||ie.lng||ne;fe=this.formats[ce](ae,pe,{...le,...ie,...he})}catch(he){this.logger.warn(he)}return fe}else this.logger.warn(`there was no format function for ${ce}`);return ae},re)}}const removePending=(ee,re)=>{ee.pending[re]!==void 0&&(delete ee.pending[re],ee.pendingCount--)};class Connector extends EventEmitter{constructor(re,te,ne){var oe,se;let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=re,this.store=te,this.services=ne,this.languageUtils=ne.languageUtils,this.options=ie,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=ie.maxParallelReads||10,this.readingCalls=0,this.maxRetries=ie.maxRetries>=0?ie.maxRetries:5,this.retryTimeout=ie.retryTimeout>=1?ie.retryTimeout:350,this.state={},this.queue=[],(se=(oe=this.backend)==null?void 0:oe.init)==null||se.call(oe,ne,ie.backend,ie)}queueLoad(re,te,ne,ie){const oe={},se={},ae={},ue={};return re.forEach(ce=>{let le=!0;te.forEach(de=>{const fe=`${ce}|${de}`;!ne.reload&&this.store.hasResourceBundle(ce,de)?this.state[fe]=2:this.state[fe]<0||(this.state[fe]===1?se[fe]===void 0&&(se[fe]=!0):(this.state[fe]=1,le=!1,se[fe]===void 0&&(se[fe]=!0),oe[fe]===void 0&&(oe[fe]=!0),ue[de]===void 0&&(ue[de]=!0)))}),le||(ae[ce]=!0)}),(Object.keys(oe).length||Object.keys(se).length)&&this.queue.push({pending:se,pendingCount:Object.keys(se).length,loaded:{},errors:[],callback:ie}),{toLoad:Object.keys(oe),pending:Object.keys(se),toLoadLanguages:Object.keys(ae),toLoadNamespaces:Object.keys(ue)}}loaded(re,te,ne){const ie=re.split("|"),oe=ie[0],se=ie[1];te&&this.emit("failedLoading",oe,se,te),!te&&ne&&this.store.addResourceBundle(oe,se,ne,void 0,void 0,{skipCopy:!0}),this.state[re]=te?-1:2,te&&ne&&(this.state[re]=0);const ae={};this.queue.forEach(ue=>{pushPath(ue.loaded,[oe],se),removePending(ue,re),te&&ue.errors.push(te),ue.pendingCount===0&&!ue.done&&(Object.keys(ue.loaded).forEach(ce=>{ae[ce]||(ae[ce]={});const le=ue.loaded[ce];le.length&&le.forEach(de=>{ae[ce][de]===void 0&&(ae[ce][de]=!0)})}),ue.done=!0,ue.errors.length?ue.callback(ue.errors):ue.callback())}),this.emit("loaded",ae),this.queue=this.queue.filter(ue=>!ue.done)}read(re,te,ne){let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,oe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,se=arguments.length>5?arguments[5]:void 0;if(!re.length)return se(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:re,ns:te,fcName:ne,tried:ie,wait:oe,callback:se});return}this.readingCalls++;const ae=(ce,le)=>{if(this.readingCalls--,this.waitingReads.length>0){const de=this.waitingReads.shift();this.read(de.lng,de.ns,de.fcName,de.tried,de.wait,de.callback)}if(ce&&le&&ie<this.maxRetries){setTimeout(()=>{this.read.call(this,re,te,ne,ie+1,oe*2,se)},oe);return}se(ce,le)},ue=this.backend[ne].bind(this.backend);if(ue.length===2){try{const ce=ue(re,te);ce&&typeof ce.then=="function"?ce.then(le=>ae(null,le)).catch(ae):ae(null,ce)}catch(ce){ae(ce)}return}return ue(re,te,ae)}prepareLoading(re,te){let ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ie=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),ie&&ie();isString$2(re)&&(re=this.languageUtils.toResolveHierarchy(re)),isString$2(te)&&(te=[te]);const oe=this.queueLoad(re,te,ne,ie);if(!oe.toLoad.length)return oe.pending.length||ie(),null;oe.toLoad.forEach(se=>{this.loadOne(se)})}load(re,te,ne){this.prepareLoading(re,te,{},ne)}reload(re,te,ne){this.prepareLoading(re,te,{reload:!0},ne)}loadOne(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const ne=re.split("|"),ie=ne[0],oe=ne[1];this.read(ie,oe,"read",void 0,void 0,(se,ae)=>{se&&this.logger.warn(`${te}loading namespace ${oe} for language ${ie} failed`,se),!se&&ae&&this.logger.log(`${te}loaded namespace ${oe} for language ${ie}`,ae),this.loaded(re,se,ae)})}saveMissing(re,te,ne,ie,oe){var ue,ce,le,de,fe;let se=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},ae=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((ce=(ue=this.services)==null?void 0:ue.utils)!=null&&ce.hasLoadedNamespace&&!((de=(le=this.services)==null?void 0:le.utils)!=null&&de.hasLoadedNamespace(te))){this.logger.warn(`did not save key "${ne}" as the namespace "${te}" 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(!(ne==null||ne==="")){if((fe=this.backend)!=null&&fe.create){const he={...se,isUpdate:oe},pe=this.backend.create.bind(this.backend);if(pe.length<6)try{let ge;pe.length===5?ge=pe(re,te,ne,ie,he):ge=pe(re,te,ne,ie),ge&&typeof ge.then=="function"?ge.then(me=>ae(null,me)).catch(ae):ae(null,ge)}catch(ge){ae(ge)}else pe(re,te,ne,ie,ae,he)}!re||!re[0]||this.store.addResource(re[0],te,ne,ie)}}}const get=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:ee=>{let re={};if(typeof ee[1]=="object"&&(re=ee[1]),isString$2(ee[1])&&(re.defaultValue=ee[1]),isString$2(ee[2])&&(re.tDescription=ee[2]),typeof ee[2]=="object"||typeof ee[3]=="object"){const te=ee[3]||ee[2];Object.keys(te).forEach(ne=>{re[ne]=te[ne]})}return re},interpolation:{escapeValue:!0,format:ee=>ee,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),transformOptions=ee=>{var re,te;return isString$2(ee.ns)&&(ee.ns=[ee.ns]),isString$2(ee.fallbackLng)&&(ee.fallbackLng=[ee.fallbackLng]),isString$2(ee.fallbackNS)&&(ee.fallbackNS=[ee.fallbackNS]),((te=(re=ee.supportedLngs)==null?void 0:re.indexOf)==null?void 0:te.call(re,"cimode"))<0&&(ee.supportedLngs=ee.supportedLngs.concat(["cimode"])),typeof ee.initImmediate=="boolean"&&(ee.initAsync=ee.initImmediate),ee},noop$3=()=>{},bindMemberFunctions=ee=>{Object.getOwnPropertyNames(Object.getPrototypeOf(ee)).forEach(te=>{typeof ee[te]=="function"&&(ee[te]=ee[te].bind(ee))})};class I18n extends EventEmitter{constructor(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},te=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(re),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),te&&!this.isInitialized&&!re.isClone){if(!this.options.initAsync)return this.init(re,te),this;setTimeout(()=>{this.init(re,te)},0)}}init(){var re=this;let te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ne=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof te=="function"&&(ne=te,te={}),te.defaultNS==null&&te.ns&&(isString$2(te.ns)?te.defaultNS=te.ns:te.ns.indexOf("translation")<0&&(te.defaultNS=te.ns[0]));const ie=get();this.options={...ie,...this.options,...transformOptions(te)},this.options.interpolation={...ie.interpolation,...this.options.interpolation},te.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=te.keySeparator),te.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=te.nsSeparator);const oe=le=>le?typeof le=="function"?new le:le:null;if(!this.options.isClone){this.modules.logger?baseLogger.init(oe(this.modules.logger),this.options):baseLogger.init(null,this.options);let le;this.modules.formatter?le=this.modules.formatter:le=Formatter;const de=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const fe=this.services;fe.logger=baseLogger,fe.resourceStore=this.store,fe.languageUtils=de,fe.pluralResolver=new PluralResolver(de,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),le&&(!this.options.interpolation.format||this.options.interpolation.format===ie.interpolation.format)&&(fe.formatter=oe(le),fe.formatter.init(fe,this.options),this.options.interpolation.format=fe.formatter.format.bind(fe.formatter)),fe.interpolator=new Interpolator(this.options),fe.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},fe.backendConnector=new Connector(oe(this.modules.backend),fe.resourceStore,fe,this.options),fe.backendConnector.on("*",function(he){for(var pe=arguments.length,ge=new Array(pe>1?pe-1:0),me=1;me<pe;me++)ge[me-1]=arguments[me];re.emit(he,...ge)}),this.modules.languageDetector&&(fe.languageDetector=oe(this.modules.languageDetector),fe.languageDetector.init&&fe.languageDetector.init(fe,this.options.detection,this.options)),this.modules.i18nFormat&&(fe.i18nFormat=oe(this.modules.i18nFormat),fe.i18nFormat.init&&fe.i18nFormat.init(this)),this.translator=new Translator(this.services,this.options),this.translator.on("*",function(he){for(var pe=arguments.length,ge=new Array(pe>1?pe-1:0),me=1;me<pe;me++)ge[me-1]=arguments[me];re.emit(he,...ge)}),this.modules.external.forEach(he=>{he.init&&he.init(this)})}if(this.format=this.options.interpolation.format,ne||(ne=noop$3),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const le=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);le.length>0&&le[0]!=="dev"&&(this.options.lng=le[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(le=>{this[le]=function(){return re.store[le](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(le=>{this[le]=function(){return re.store[le](...arguments),re}});const ue=defer(),ce=()=>{const le=(de,fe)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),ue.resolve(fe),ne(de,fe)};if(this.languages&&!this.isInitialized)return le(null,this.t.bind(this));this.changeLanguage(this.options.lng,le)};return this.options.resources||!this.options.initAsync?ce():setTimeout(ce,0),ue}loadResources(re){var oe,se;let ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$3;const ie=isString$2(re)?re:this.language;if(typeof re=="function"&&(ne=re),!this.options.resources||this.options.partialBundledLanguages){if((ie==null?void 0:ie.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return ne();const ae=[],ue=ce=>{if(!ce||ce==="cimode")return;this.services.languageUtils.toResolveHierarchy(ce).forEach(de=>{de!=="cimode"&&ae.indexOf(de)<0&&ae.push(de)})};ie?ue(ie):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(le=>ue(le)),(se=(oe=this.options.preload)==null?void 0:oe.forEach)==null||se.call(oe,ce=>ue(ce)),this.services.backendConnector.load(ae,this.options.ns,ce=>{!ce&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),ne(ce)})}else ne(null)}reloadResources(re,te,ne){const ie=defer();return typeof re=="function"&&(ne=re,re=void 0),typeof te=="function"&&(ne=te,te=void 0),re||(re=this.languages),te||(te=this.options.ns),ne||(ne=noop$3),this.services.backendConnector.reload(re,te,oe=>{ie.resolve(),ne(oe)}),ie}use(re){if(!re)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!re.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return re.type==="backend"&&(this.modules.backend=re),(re.type==="logger"||re.log&&re.warn&&re.error)&&(this.modules.logger=re),re.type==="languageDetector"&&(this.modules.languageDetector=re),re.type==="i18nFormat"&&(this.modules.i18nFormat=re),re.type==="postProcessor"&&postProcessor.addPostProcessor(re),re.type==="formatter"&&(this.modules.formatter=re),re.type==="3rdParty"&&this.modules.external.push(re),this}setResolvedLanguage(re){if(!(!re||!this.languages)&&!(["cimode","dev"].indexOf(re)>-1))for(let te=0;te<this.languages.length;te++){const ne=this.languages[te];if(!(["cimode","dev"].indexOf(ne)>-1)&&this.store.hasLanguageSomeTranslations(ne)){this.resolvedLanguage=ne;break}}}changeLanguage(re,te){var ne=this;this.isLanguageChangingTo=re;const ie=defer();this.emit("languageChanging",re);const oe=ue=>{this.language=ue,this.languages=this.services.languageUtils.toResolveHierarchy(ue),this.resolvedLanguage=void 0,this.setResolvedLanguage(ue)},se=(ue,ce)=>{ce?(oe(ce),this.translator.changeLanguage(ce),this.isLanguageChangingTo=void 0,this.emit("languageChanged",ce),this.logger.log("languageChanged",ce)):this.isLanguageChangingTo=void 0,ie.resolve(function(){return ne.t(...arguments)}),te&&te(ue,function(){return ne.t(...arguments)})},ae=ue=>{var le,de;!re&&!ue&&this.services.languageDetector&&(ue=[]);const ce=isString$2(ue)?ue:this.services.languageUtils.getBestMatchFromCodes(ue);ce&&(this.language||oe(ce),this.translator.language||this.translator.changeLanguage(ce),(de=(le=this.services.languageDetector)==null?void 0:le.cacheUserLanguage)==null||de.call(le,ce)),this.loadResources(ce,fe=>{se(fe,ce)})};return!re&&this.services.languageDetector&&!this.services.languageDetector.async?ae(this.services.languageDetector.detect()):!re&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(ae):this.services.languageDetector.detect(ae):ae(re),ie}getFixedT(re,te,ne){var ie=this;const oe=function(se,ae){let ue;if(typeof ae!="object"){for(var ce=arguments.length,le=new Array(ce>2?ce-2:0),de=2;de<ce;de++)le[de-2]=arguments[de];ue=ie.options.overloadTranslationOptionHandler([se,ae].concat(le))}else ue={...ae};ue.lng=ue.lng||oe.lng,ue.lngs=ue.lngs||oe.lngs,ue.ns=ue.ns||oe.ns,ue.keyPrefix!==""&&(ue.keyPrefix=ue.keyPrefix||ne||oe.keyPrefix);const fe=ie.options.keySeparator||".";let he;return ue.keyPrefix&&Array.isArray(se)?he=se.map(pe=>`${ue.keyPrefix}${fe}${pe}`):he=ue.keyPrefix?`${ue.keyPrefix}${fe}${se}`:se,ie.t(he,ue)};return isString$2(re)?oe.lng=re:oe.lngs=re,oe.ns=te,oe.keyPrefix=ne,oe}t(){var ie;for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return(ie=this.translator)==null?void 0:ie.translate(...te)}exists(){var ie;for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return(ie=this.translator)==null?void 0:ie.exists(...te)}setDefaultNamespace(re){this.options.defaultNS=re}hasLoadedNamespace(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const ne=te.lng||this.resolvedLanguage||this.languages[0],ie=this.options?this.options.fallbackLng:!1,oe=this.languages[this.languages.length-1];if(ne.toLowerCase()==="cimode")return!0;const se=(ae,ue)=>{const ce=this.services.backendConnector.state[`${ae}|${ue}`];return ce===-1||ce===0||ce===2};if(te.precheck){const ae=te.precheck(this,se);if(ae!==void 0)return ae}return!!(this.hasResourceBundle(ne,re)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||se(ne,re)&&(!ie||se(oe,re)))}loadNamespaces(re,te){const ne=defer();return this.options.ns?(isString$2(re)&&(re=[re]),re.forEach(ie=>{this.options.ns.indexOf(ie)<0&&this.options.ns.push(ie)}),this.loadResources(ie=>{ne.resolve(),te&&te(ie)}),ne):(te&&te(),Promise.resolve())}loadLanguages(re,te){const ne=defer();isString$2(re)&&(re=[re]);const ie=this.options.preload||[],oe=re.filter(se=>ie.indexOf(se)<0&&this.services.languageUtils.isSupportedCode(se));return oe.length?(this.options.preload=ie.concat(oe),this.loadResources(se=>{ne.resolve(),te&&te(se)}),ne):(te&&te(),Promise.resolve())}dir(re){var ie,oe;if(re||(re=this.resolvedLanguage||(((ie=this.languages)==null?void 0:ie.length)>0?this.languages[0]:this.language)),!re)return"rtl";const te=["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"],ne=((oe=this.services)==null?void 0:oe.languageUtils)||new LanguageUtil(get());return te.indexOf(ne.getLanguagePartFromCode(re))>-1||re.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},te=arguments.length>1?arguments[1]:void 0;return new I18n(re,te)}cloneInstance(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$3;const ne=re.forkResourceStore;ne&&delete re.forkResourceStore;const ie={...this.options,...re,isClone:!0},oe=new I18n(ie);if((re.debug!==void 0||re.prefix!==void 0)&&(oe.logger=oe.logger.clone(re)),["store","services","language"].forEach(ae=>{oe[ae]=this[ae]}),oe.services={...this.services},oe.services.utils={hasLoadedNamespace:oe.hasLoadedNamespace.bind(oe)},ne){const ae=Object.keys(this.store.data).reduce((ue,ce)=>(ue[ce]={...this.store.data[ce]},Object.keys(ue[ce]).reduce((le,de)=>(le[de]={...ue[ce][de]},le),{})),{});oe.store=new ResourceStore(ae,ie),oe.services.resourceStore=oe.store}return oe.translator=new Translator(oe.services,ie),oe.translator.on("*",function(ae){for(var ue=arguments.length,ce=new Array(ue>1?ue-1:0),le=1;le<ue;le++)ce[le-1]=arguments[le];oe.emit(ae,...ce)}),oe.init(ie,te),oe.translator.options=ie,oe.translator.backendConnector.services.utils={hasLoadedNamespace:oe.hasLoadedNamespace.bind(oe)},oe}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const instance=I18n.createInstance();instance.createInstance=I18n.createInstance,instance.createInstance,instance.dir,instance.init,instance.loadResources,instance.reloadResources,instance.use,instance.changeLanguage,instance.getFixedT,instance.t,instance.exists,instance.setDefaultNamespace,instance.hasLoadedNamespace,instance.loadNamespaces,instance.loadLanguages;const translation$2={additional_information:"Additional information",almost_done:"Almost done...",already_paid:"Already paid?",astro_express_checkout:"Express checkout",check_payment_status:"Check payment status",checkout_method:"Checkout method",or:"OR",email:"E-mail",enter_country_code:"Please enter a country or code",enter_your_email:"Enter your e-mail",enter_your_document_number:"Enter your document number",enter_your_document_type:"Select a document type",enter_your_first_name:"Enter your first name",enter_your_last_name:"Enter your last name",enter_your_phone:"Enter your phone number",continue:"Continue",copied:"Copied!",copy_payment_link:"Copy payment link",document_number:"Document number",document_type:"Document type",do_not_close_window:"Please do not close this window.",didnt_receive:"Didn't receive it?",first_name:"First name",generic_error:"An error occurred. Please try again.",hold_on:"Hold on!",invalid_field:"Invalid field",last_name:"Last name",loading_wait:"Loading, please wait...",pay_amount:"Pay {{amount}}",payment_amount:"Payment amount",push_notification_sent:"We sent a push notification to your app",qr_code:"QR code",required_field:"Required Field",scan_qr_copy_link:"Scan the QR code or copy the link.",select:"Select",select_item:"Select an item",time_up:"Time's up!",try_again:"Try again",waiting_confirmation:"Waiting for confirmation...",card_holder_label:"Cardholder name",card_holder_placeholder:"Full name as on card",card_number:"Card number",card_exp_date:"Expiration date",card_tokenization_error:"We couldn't process your card. Please check your details and try again."},en$1={translation:translation$2},translation$1={additional_information:"Información adicional",almost_done:"Casi listo...",already_paid:"Ya pagaste?",astro_express_checkout:"Pago express",check_payment_status:"Ver estado del pago",checkout_method:"Método de pago",or:"O",email:"Correo electrónico",enter_country_code:"Introduce el país o código del país",enter_your_email:"Ingrese su correo electrónico",enter_your_document_number:"Ingrese su número de documento",enter_your_document_type:"Seleccione un tipo de documento",enter_your_first_name:"Ingrese su nombre",enter_your_last_name:"Ingrese su apellido",enter_your_phone:"Introduzca su número de teléfono",continue:"Continuar",copied:"Copiado!",copy_payment_link:"Copiar enlace de pago",document_number:"Número de documento",document_type:"Tipo de documento",do_not_close_window:"Por favor, no cierres esta ventana.",didnt_receive:"No lo recibiste?",first_name:"Nombre",generic_error:"Ocurrió un error. Por favor, inténtelo de nuevo.",hold_on:"¡Un instante...!",invalid_field:"Campo inválido",last_name:"Apellido",loading_wait:"Cargando, aguantá un toque...",pay_amount:"Pagar {{amount}}",payment_amount:"Monto a pagar",push_notification_sent:"Enviamos una notificación push a tu app",qr_code:"código QR",required_field:"Campo Requerido",scan_qr_copy_link:"Escaneá el código QR o copiá el enlace.",select:"Seleccionar",select_item:"Selecciona una opción",time_up:"Se acabó el tiempo!",try_again:"Inténtalo de nuevo",waiting_confirmation:"Esperando confirmación...",card_holder_label:"Nombre del titular",card_holder_placeholder:"Nombre completo en la tarjeta",card_number:"Número de tarjeta",card_exp_date:"Fecha de vencimiento",card_tokenization_error:"No pudimos procesar tu tarjeta. Verificá los datos y volvé a intentarlo."},es={translation:translation$1},translation={additional_information:"Informações adicionais",almost_done:"Finalizando...",already_paid:"Já pagou?",astro_express_checkout:"Pagamento expresso",check_payment_status:"Verificar status do pagamento",checkout_method:"Método de pagamento",or:"OU",email:"E-mail",enter_country_code:"Informe um país ou código",enter_your_email:"Digite seu e-mail",enter_your_document_number:"Digite seu número de documento",enter_your_document_type:"Selecione um tipo de documento",enter_your_first_name:"Digite seu primeiro nome",enter_your_last_name:"Digite seu sobrenome",enter_your_phone:"Digite seu número de telefone",continue:"Continuar",copied:"Copiado!",copy_payment_link:"Copiar link de pagamento",document_number:"Número do documento",document_type:"Tipo de documento",do_not_close_window:"Por favor, não feche esta janela.",didnt_receive:"Não recebeu?",first_name:"Primeiro nome",generic_error:"Ocorreu um erro. Por favor, tente novamente.",hold_on:"Só um instante!",invalid_field:"Campo inválido",last_name:"Sobrenome",loading_wait:"Carregando, por favor aguarde...",pay_amount:"Pagar {{amount}}",payment_amount:"Valor do pagamento",push_notification_sent:"Enviamos uma notificação push para seu app",qr_code:"QR code",required_field:"Campo Obrigatório",scan_qr_copy_link:"Escaneie o QR code ou copie o link.",select:"Selecione",select_item:"Selecione um item",time_up:"Tempo esgotado!",try_again:"Tente novamente",waiting_confirmation:"Aguardando confirmação...",card_holder_label:"Nome do titular",card_holder_placeholder:"Nome completo no cartão",card_number:"Número do cartão",card_exp_date:"Data de validade",card_tokenization_error:"Não foi possível processar o seu cartão. Verifique os dados e tente novamente."},pt$1={translation},LOCAL_TRANSLATIONS={en:en$1,es,pt:pt$1};class AstroPayI18n{static init(re){const te=validateValue(re==null?void 0:re.language,CONFIG_LANGUAGE_VALUES,"en");return instance.init({lng:te,fallbackLng:"en",resources:LOCAL_TRANSLATIONS,interpolation:{escapeValue:!1}})}static getCurrent(){return instance.language}static translate(re,te){return instance.t(re,te??{})}}const getLoadingSuccessStyles=()=>css`
|
|
147
|
+
`};class Typography extends Component{constructor({text:re,variant:te="span",weight:ne=500,size:ie="small",lineHeight:oe,align:se="left",color:ae,uppercase:ue=!1}){const ce={size:ie,weight:ne,lineHeight:oe,align:se,color:ae,uppercase:ue};super({tag:te,styles:le=>getTypographyStyles(le,ce)}),this.element.textContent=re}}const isString$2=ee=>typeof ee=="string",defer=()=>{let ee,re;const te=new Promise((ne,ie)=>{ee=ne,re=ie});return te.resolve=ee,te.reject=re,te},makeString=ee=>ee==null?"":""+ee,copy=(ee,re,te)=>{ee.forEach(ne=>{re[ne]&&(te[ne]=re[ne])})},lastOfPathSeparatorRegExp=/###/g,cleanKey=ee=>ee&&ee.indexOf("###")>-1?ee.replace(lastOfPathSeparatorRegExp,"."):ee,canNotTraverseDeeper=ee=>!ee||isString$2(ee),getLastOfPath=(ee,re,te)=>{const ne=isString$2(re)?re.split("."):re;let ie=0;for(;ie<ne.length-1;){if(canNotTraverseDeeper(ee))return{};const oe=cleanKey(ne[ie]);!ee[oe]&&te&&(ee[oe]=new te),Object.prototype.hasOwnProperty.call(ee,oe)?ee=ee[oe]:ee={},++ie}return canNotTraverseDeeper(ee)?{}:{obj:ee,k:cleanKey(ne[ie])}},setPath=(ee,re,te)=>{const{obj:ne,k:ie}=getLastOfPath(ee,re,Object);if(ne!==void 0||re.length===1){ne[ie]=te;return}let oe=re[re.length-1],se=re.slice(0,re.length-1),ae=getLastOfPath(ee,se,Object);for(;ae.obj===void 0&&se.length;)oe=`${se[se.length-1]}.${oe}`,se=se.slice(0,se.length-1),ae=getLastOfPath(ee,se,Object),ae!=null&&ae.obj&&typeof ae.obj[`${ae.k}.${oe}`]<"u"&&(ae.obj=void 0);ae.obj[`${ae.k}.${oe}`]=te},pushPath=(ee,re,te,ne)=>{const{obj:ie,k:oe}=getLastOfPath(ee,re,Object);ie[oe]=ie[oe]||[],ie[oe].push(te)},getPath=(ee,re)=>{const{obj:te,k:ne}=getLastOfPath(ee,re);if(te&&Object.prototype.hasOwnProperty.call(te,ne))return te[ne]},getPathWithDefaults=(ee,re,te)=>{const ne=getPath(ee,te);return ne!==void 0?ne:getPath(re,te)},deepExtend=(ee,re,te)=>{for(const ne in re)ne!=="__proto__"&&ne!=="constructor"&&(ne in ee?isString$2(ee[ne])||ee[ne]instanceof String||isString$2(re[ne])||re[ne]instanceof String?te&&(ee[ne]=re[ne]):deepExtend(ee[ne],re[ne],te):ee[ne]=re[ne]);return ee},regexEscape=ee=>ee.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var _entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const escape$1=ee=>isString$2(ee)?ee.replace(/[&<>"'\/]/g,re=>_entityMap[re]):ee;class RegExpCache{constructor(re){this.capacity=re,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(re){const te=this.regExpMap.get(re);if(te!==void 0)return te;const ne=new RegExp(re);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(re,ne),this.regExpQueue.push(re),ne}}const chars=[" ",",","?","!",";"],looksLikeObjectPathRegExpCache=new RegExpCache(20),looksLikeObjectPath=(ee,re,te)=>{re=re||"",te=te||"";const ne=chars.filter(se=>re.indexOf(se)<0&&te.indexOf(se)<0);if(ne.length===0)return!0;const ie=looksLikeObjectPathRegExpCache.getRegExp(`(${ne.map(se=>se==="?"?"\\?":se).join("|")})`);let oe=!ie.test(ee);if(!oe){const se=ee.indexOf(te);se>0&&!ie.test(ee.substring(0,se))&&(oe=!0)}return oe},deepFind=function(ee,re){let te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!ee)return;if(ee[re])return Object.prototype.hasOwnProperty.call(ee,re)?ee[re]:void 0;const ne=re.split(te);let ie=ee;for(let oe=0;oe<ne.length;){if(!ie||typeof ie!="object")return;let se,ae="";for(let ue=oe;ue<ne.length;++ue)if(ue!==oe&&(ae+=te),ae+=ne[ue],se=ie[ae],se!==void 0){if(["string","number","boolean"].indexOf(typeof se)>-1&&ue<ne.length-1)continue;oe+=ue-oe+1;break}ie=se}return ie},getCleanedCode=ee=>ee==null?void 0:ee.replace("_","-"),consoleLogger={type:"logger",log(ee){this.output("log",ee)},warn(ee){this.output("warn",ee)},error(ee){this.output("error",ee)},output(ee,re){var te,ne;(ne=(te=console==null?void 0:console[ee])==null?void 0:te.apply)==null||ne.call(te,console,re)}};let Logger$1=class ho{constructor(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(re,te)}init(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=te.prefix||"i18next:",this.logger=re||consoleLogger,this.options=te,this.debug=te.debug}log(){for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return this.forward(te,"log","",!0)}warn(){for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return this.forward(te,"warn","",!0)}error(){for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return this.forward(te,"error","")}deprecate(){for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return this.forward(te,"warn","WARNING DEPRECATED: ",!0)}forward(re,te,ne,ie){return ie&&!this.debug?null:(isString$2(re[0])&&(re[0]=`${ne}${this.prefix} ${re[0]}`),this.logger[te](re))}create(re){return new ho(this.logger,{prefix:`${this.prefix}:${re}:`,...this.options})}clone(re){return re=re||this.options,re.prefix=re.prefix||this.prefix,new ho(this.logger,re)}};var baseLogger=new Logger$1;class EventEmitter{constructor(){this.observers={}}on(re,te){return re.split(" ").forEach(ne=>{this.observers[ne]||(this.observers[ne]=new Map);const ie=this.observers[ne].get(te)||0;this.observers[ne].set(te,ie+1)}),this}off(re,te){if(this.observers[re]){if(!te){delete this.observers[re];return}this.observers[re].delete(te)}}emit(re){for(var te=arguments.length,ne=new Array(te>1?te-1:0),ie=1;ie<te;ie++)ne[ie-1]=arguments[ie];this.observers[re]&&Array.from(this.observers[re].entries()).forEach(se=>{let[ae,ue]=se;for(let ce=0;ce<ue;ce++)ae(...ne)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(se=>{let[ae,ue]=se;for(let ce=0;ce<ue;ce++)ae.apply(ae,[re,...ne])})}}class ResourceStore extends EventEmitter{constructor(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=re||{},this.options=te,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(re){this.options.ns.indexOf(re)<0&&this.options.ns.push(re)}removeNamespaces(re){const te=this.options.ns.indexOf(re);te>-1&&this.options.ns.splice(te,1)}getResource(re,te,ne){var ce,le;let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const oe=ie.keySeparator!==void 0?ie.keySeparator:this.options.keySeparator,se=ie.ignoreJSONStructure!==void 0?ie.ignoreJSONStructure:this.options.ignoreJSONStructure;let ae;re.indexOf(".")>-1?ae=re.split("."):(ae=[re,te],ne&&(Array.isArray(ne)?ae.push(...ne):isString$2(ne)&&oe?ae.push(...ne.split(oe)):ae.push(ne)));const ue=getPath(this.data,ae);return!ue&&!te&&!ne&&re.indexOf(".")>-1&&(re=ae[0],te=ae[1],ne=ae.slice(2).join(".")),ue||!se||!isString$2(ne)?ue:deepFind((le=(ce=this.data)==null?void 0:ce[re])==null?void 0:le[te],ne,oe)}addResource(re,te,ne,ie){let oe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const se=oe.keySeparator!==void 0?oe.keySeparator:this.options.keySeparator;let ae=[re,te];ne&&(ae=ae.concat(se?ne.split(se):ne)),re.indexOf(".")>-1&&(ae=re.split("."),ie=te,te=ae[1]),this.addNamespaces(te),setPath(this.data,ae,ie),oe.silent||this.emit("added",re,te,ne,ie)}addResources(re,te,ne){let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const oe in ne)(isString$2(ne[oe])||Array.isArray(ne[oe]))&&this.addResource(re,te,oe,ne[oe],{silent:!0});ie.silent||this.emit("added",re,te,ne)}addResourceBundle(re,te,ne,ie,oe){let se=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},ae=[re,te];re.indexOf(".")>-1&&(ae=re.split("."),ie=ne,ne=te,te=ae[1]),this.addNamespaces(te);let ue=getPath(this.data,ae)||{};se.skipCopy||(ne=JSON.parse(JSON.stringify(ne))),ie?deepExtend(ue,ne,oe):ue={...ue,...ne},setPath(this.data,ae,ue),se.silent||this.emit("added",re,te,ne)}removeResourceBundle(re,te){this.hasResourceBundle(re,te)&&delete this.data[re][te],this.removeNamespaces(te),this.emit("removed",re,te)}hasResourceBundle(re,te){return this.getResource(re,te)!==void 0}getResourceBundle(re,te){return te||(te=this.options.defaultNS),this.getResource(re,te)}getDataByLanguage(re){return this.data[re]}hasLanguageSomeTranslations(re){const te=this.getDataByLanguage(re);return!!(te&&Object.keys(te)||[]).find(ie=>te[ie]&&Object.keys(te[ie]).length>0)}toJSON(){return this.data}}var postProcessor={processors:{},addPostProcessor(ee){this.processors[ee.name]=ee},handle(ee,re,te,ne,ie){return ee.forEach(oe=>{var se;re=((se=this.processors[oe])==null?void 0:se.process(re,te,ne,ie))??re}),re}};const checkedLoadedFor={},shouldHandleAsObject=ee=>!isString$2(ee)&&typeof ee!="boolean"&&typeof ee!="number";class Translator extends EventEmitter{constructor(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),copy(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],re,this),this.options=te,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=baseLogger.create("translator")}changeLanguage(re){re&&(this.language=re)}exists(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(re==null)return!1;const ne=this.resolve(re,te);return(ne==null?void 0:ne.res)!==void 0}extractFromKey(re,te){let ne=te.nsSeparator!==void 0?te.nsSeparator:this.options.nsSeparator;ne===void 0&&(ne=":");const ie=te.keySeparator!==void 0?te.keySeparator:this.options.keySeparator;let oe=te.ns||this.options.defaultNS||[];const se=ne&&re.indexOf(ne)>-1,ae=!this.options.userDefinedKeySeparator&&!te.keySeparator&&!this.options.userDefinedNsSeparator&&!te.nsSeparator&&!looksLikeObjectPath(re,ne,ie);if(se&&!ae){const ue=re.match(this.interpolator.nestingRegexp);if(ue&&ue.length>0)return{key:re,namespaces:isString$2(oe)?[oe]:oe};const ce=re.split(ne);(ne!==ie||ne===ie&&this.options.ns.indexOf(ce[0])>-1)&&(oe=ce.shift()),re=ce.join(ie)}return{key:re,namespaces:isString$2(oe)?[oe]:oe}}translate(re,te,ne){if(typeof te!="object"&&this.options.overloadTranslationOptionHandler&&(te=this.options.overloadTranslationOptionHandler(arguments)),typeof te=="object"&&(te={...te}),te||(te={}),re==null)return"";Array.isArray(re)||(re=[String(re)]);const ie=te.returnDetails!==void 0?te.returnDetails:this.options.returnDetails,oe=te.keySeparator!==void 0?te.keySeparator:this.options.keySeparator,{key:se,namespaces:ae}=this.extractFromKey(re[re.length-1],te),ue=ae[ae.length-1],ce=te.lng||this.language,le=te.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if((ce==null?void 0:ce.toLowerCase())==="cimode"){if(le){const Re=te.nsSeparator||this.options.nsSeparator;return ie?{res:`${ue}${Re}${se}`,usedKey:se,exactUsedKey:se,usedLng:ce,usedNS:ue,usedParams:this.getUsedParamsDetails(te)}:`${ue}${Re}${se}`}return ie?{res:se,usedKey:se,exactUsedKey:se,usedLng:ce,usedNS:ue,usedParams:this.getUsedParamsDetails(te)}:se}const de=this.resolve(re,te);let fe=de==null?void 0:de.res;const he=(de==null?void 0:de.usedKey)||se,pe=(de==null?void 0:de.exactUsedKey)||se,ge=["[object Number]","[object Function]","[object RegExp]"],me=te.joinArrays!==void 0?te.joinArrays:this.options.joinArrays,ye=!this.i18nFormat||this.i18nFormat.handleAsObject,ve=te.count!==void 0&&!isString$2(te.count),be=Translator.hasDefaultValue(te),_e=ve?this.pluralResolver.getSuffix(ce,te.count,te):"",Ie=te.ordinal&&ve?this.pluralResolver.getSuffix(ce,te.count,{ordinal:!1}):"",Te=ve&&!te.ordinal&&te.count===0,Se=Te&&te[`defaultValue${this.options.pluralSeparator}zero`]||te[`defaultValue${_e}`]||te[`defaultValue${Ie}`]||te.defaultValue;let Oe=fe;ye&&!fe&&be&&(Oe=Se);const Ce=shouldHandleAsObject(Oe),we=Object.prototype.toString.apply(Oe);if(ye&&Oe&&Ce&&ge.indexOf(we)<0&&!(isString$2(me)&&Array.isArray(Oe))){if(!te.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const Re=this.options.returnedObjectHandler?this.options.returnedObjectHandler(he,Oe,{...te,ns:ae}):`key '${se} (${this.language})' returned an object instead of string.`;return ie?(de.res=Re,de.usedParams=this.getUsedParamsDetails(te),de):Re}if(oe){const Re=Array.isArray(Oe),Ne=Re?[]:{},Ue=Re?pe:he;for(const Fe in Oe)if(Object.prototype.hasOwnProperty.call(Oe,Fe)){const Ve=`${Ue}${oe}${Fe}`;be&&!fe?Ne[Fe]=this.translate(Ve,{...te,defaultValue:shouldHandleAsObject(Se)?Se[Fe]:void 0,joinArrays:!1,ns:ae}):Ne[Fe]=this.translate(Ve,{...te,joinArrays:!1,ns:ae}),Ne[Fe]===Ve&&(Ne[Fe]=Oe[Fe])}fe=Ne}}else if(ye&&isString$2(me)&&Array.isArray(fe))fe=fe.join(me),fe&&(fe=this.extendTranslation(fe,re,te,ne));else{let Re=!1,Ne=!1;!this.isValidLookup(fe)&&be&&(Re=!0,fe=Se),this.isValidLookup(fe)||(Ne=!0,fe=se);const Fe=(te.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&Ne?void 0:fe,Ve=be&&Se!==fe&&this.options.updateMissing;if(Ne||Re||Ve){if(this.logger.log(Ve?"updateKey":"missingKey",ce,ue,se,Ve?Se:fe),oe){const hr=this.resolve(se,{...te,keySeparator:!1});hr&&hr.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 He=[];const ur=this.languageUtils.getFallbackCodes(this.options.fallbackLng,te.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ur&&ur[0])for(let hr=0;hr<ur.length;hr++)He.push(ur[hr]);else this.options.saveMissingTo==="all"?He=this.languageUtils.toResolveHierarchy(te.lng||this.language):He.push(te.lng||this.language);const Ge=(hr,fr,dr)=>{var Bt;const Qe=be&&dr!==fe?dr:Fe;this.options.missingKeyHandler?this.options.missingKeyHandler(hr,ue,fr,Qe,Ve,te):(Bt=this.backendConnector)!=null&&Bt.saveMissing&&this.backendConnector.saveMissing(hr,ue,fr,Qe,Ve,te),this.emit("missingKey",hr,ue,fr,fe)};this.options.saveMissing&&(this.options.saveMissingPlurals&&ve?He.forEach(hr=>{const fr=this.pluralResolver.getSuffixes(hr,te);Te&&te[`defaultValue${this.options.pluralSeparator}zero`]&&fr.indexOf(`${this.options.pluralSeparator}zero`)<0&&fr.push(`${this.options.pluralSeparator}zero`),fr.forEach(dr=>{Ge([hr],se+dr,te[`defaultValue${dr}`]||Se)})}):Ge(He,se,Se))}fe=this.extendTranslation(fe,re,te,de,ne),Ne&&fe===se&&this.options.appendNamespaceToMissingKey&&(fe=`${ue}:${se}`),(Ne||Re)&&this.options.parseMissingKeyHandler&&(fe=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${ue}:${se}`:se,Re?fe:void 0))}return ie?(de.res=fe,de.usedParams=this.getUsedParamsDetails(te),de):fe}extendTranslation(re,te,ne,ie,oe){var ce,le;var se=this;if((ce=this.i18nFormat)!=null&&ce.parse)re=this.i18nFormat.parse(re,{...this.options.interpolation.defaultVariables,...ne},ne.lng||this.language||ie.usedLng,ie.usedNS,ie.usedKey,{resolved:ie});else if(!ne.skipInterpolation){ne.interpolation&&this.interpolator.init({...ne,interpolation:{...this.options.interpolation,...ne.interpolation}});const de=isString$2(re)&&(((le=ne==null?void 0:ne.interpolation)==null?void 0:le.skipOnVariables)!==void 0?ne.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let fe;if(de){const pe=re.match(this.interpolator.nestingRegexp);fe=pe&&pe.length}let he=ne.replace&&!isString$2(ne.replace)?ne.replace:ne;if(this.options.interpolation.defaultVariables&&(he={...this.options.interpolation.defaultVariables,...he}),re=this.interpolator.interpolate(re,he,ne.lng||this.language||ie.usedLng,ne),de){const pe=re.match(this.interpolator.nestingRegexp),ge=pe&&pe.length;fe<ge&&(ne.nest=!1)}!ne.lng&&ie&&ie.res&&(ne.lng=this.language||ie.usedLng),ne.nest!==!1&&(re=this.interpolator.nest(re,function(){for(var pe=arguments.length,ge=new Array(pe),me=0;me<pe;me++)ge[me]=arguments[me];return(oe==null?void 0:oe[0])===ge[0]&&!ne.context?(se.logger.warn(`It seems you are nesting recursively key: ${ge[0]} in key: ${te[0]}`),null):se.translate(...ge,te)},ne)),ne.interpolation&&this.interpolator.reset()}const ae=ne.postProcess||this.options.postProcess,ue=isString$2(ae)?[ae]:ae;return re!=null&&(ue!=null&&ue.length)&&ne.applyPostProcessor!==!1&&(re=postProcessor.handle(ue,re,te,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...ie,usedParams:this.getUsedParamsDetails(ne)},...ne}:ne,this)),re}resolve(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ne,ie,oe,se,ae;return isString$2(re)&&(re=[re]),re.forEach(ue=>{if(this.isValidLookup(ne))return;const ce=this.extractFromKey(ue,te),le=ce.key;ie=le;let de=ce.namespaces;this.options.fallbackNS&&(de=de.concat(this.options.fallbackNS));const fe=te.count!==void 0&&!isString$2(te.count),he=fe&&!te.ordinal&&te.count===0,pe=te.context!==void 0&&(isString$2(te.context)||typeof te.context=="number")&&te.context!=="",ge=te.lngs?te.lngs:this.languageUtils.toResolveHierarchy(te.lng||this.language,te.fallbackLng);de.forEach(me=>{var ye,ve;this.isValidLookup(ne)||(ae=me,!checkedLoadedFor[`${ge[0]}-${me}`]&&((ye=this.utils)!=null&&ye.hasLoadedNamespace)&&!((ve=this.utils)!=null&&ve.hasLoadedNamespace(ae))&&(checkedLoadedFor[`${ge[0]}-${me}`]=!0,this.logger.warn(`key "${ie}" for languages "${ge.join(", ")}" won't get resolved as namespace "${ae}" 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!!!")),ge.forEach(be=>{var Te;if(this.isValidLookup(ne))return;se=be;const _e=[le];if((Te=this.i18nFormat)!=null&&Te.addLookupKeys)this.i18nFormat.addLookupKeys(_e,le,be,me,te);else{let Se;fe&&(Se=this.pluralResolver.getSuffix(be,te.count,te));const Oe=`${this.options.pluralSeparator}zero`,Ce=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(fe&&(_e.push(le+Se),te.ordinal&&Se.indexOf(Ce)===0&&_e.push(le+Se.replace(Ce,this.options.pluralSeparator)),he&&_e.push(le+Oe)),pe){const we=`${le}${this.options.contextSeparator}${te.context}`;_e.push(we),fe&&(_e.push(we+Se),te.ordinal&&Se.indexOf(Ce)===0&&_e.push(we+Se.replace(Ce,this.options.pluralSeparator)),he&&_e.push(we+Oe))}}let Ie;for(;Ie=_e.pop();)this.isValidLookup(ne)||(oe=Ie,ne=this.getResource(be,me,Ie,te))}))})}),{res:ne,usedKey:ie,exactUsedKey:oe,usedLng:se,usedNS:ae}}isValidLookup(re){return re!==void 0&&!(!this.options.returnNull&&re===null)&&!(!this.options.returnEmptyString&&re==="")}getResource(re,te,ne){var oe;let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return(oe=this.i18nFormat)!=null&&oe.getResource?this.i18nFormat.getResource(re,te,ne,ie):this.resourceStore.getResource(re,te,ne,ie)}getUsedParamsDetails(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const te=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],ne=re.replace&&!isString$2(re.replace);let ie=ne?re.replace:re;if(ne&&typeof re.count<"u"&&(ie.count=re.count),this.options.interpolation.defaultVariables&&(ie={...this.options.interpolation.defaultVariables,...ie}),!ne){ie={...ie};for(const oe of te)delete ie[oe]}return ie}static hasDefaultValue(re){const te="defaultValue";for(const ne in re)if(Object.prototype.hasOwnProperty.call(re,ne)&&te===ne.substring(0,te.length)&&re[ne]!==void 0)return!0;return!1}}class LanguageUtil{constructor(re){this.options=re,this.supportedLngs=this.options.supportedLngs||!1,this.logger=baseLogger.create("languageUtils")}getScriptPartFromCode(re){if(re=getCleanedCode(re),!re||re.indexOf("-")<0)return null;const te=re.split("-");return te.length===2||(te.pop(),te[te.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(te.join("-"))}getLanguagePartFromCode(re){if(re=getCleanedCode(re),!re||re.indexOf("-")<0)return re;const te=re.split("-");return this.formatLanguageCode(te[0])}formatLanguageCode(re){if(isString$2(re)&&re.indexOf("-")>-1){let te;try{te=Intl.getCanonicalLocales(re)[0]}catch{}return te&&this.options.lowerCaseLng&&(te=te.toLowerCase()),te||(this.options.lowerCaseLng?re.toLowerCase():re)}return this.options.cleanCode||this.options.lowerCaseLng?re.toLowerCase():re}isSupportedCode(re){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(re=this.getLanguagePartFromCode(re)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(re)>-1}getBestMatchFromCodes(re){if(!re)return null;let te;return re.forEach(ne=>{if(te)return;const ie=this.formatLanguageCode(ne);(!this.options.supportedLngs||this.isSupportedCode(ie))&&(te=ie)}),!te&&this.options.supportedLngs&&re.forEach(ne=>{if(te)return;const ie=this.getLanguagePartFromCode(ne);if(this.isSupportedCode(ie))return te=ie;te=this.options.supportedLngs.find(oe=>{if(oe===ie)return oe;if(!(oe.indexOf("-")<0&&ie.indexOf("-")<0)&&(oe.indexOf("-")>0&&ie.indexOf("-")<0&&oe.substring(0,oe.indexOf("-"))===ie||oe.indexOf(ie)===0&&ie.length>1))return oe})}),te||(te=this.getFallbackCodes(this.options.fallbackLng)[0]),te}getFallbackCodes(re,te){if(!re)return[];if(typeof re=="function"&&(re=re(te)),isString$2(re)&&(re=[re]),Array.isArray(re))return re;if(!te)return re.default||[];let ne=re[te];return ne||(ne=re[this.getScriptPartFromCode(te)]),ne||(ne=re[this.formatLanguageCode(te)]),ne||(ne=re[this.getLanguagePartFromCode(te)]),ne||(ne=re.default),ne||[]}toResolveHierarchy(re,te){const ne=this.getFallbackCodes(te||this.options.fallbackLng||[],re),ie=[],oe=se=>{se&&(this.isSupportedCode(se)?ie.push(se):this.logger.warn(`rejecting language code not found in supportedLngs: ${se}`))};return isString$2(re)&&(re.indexOf("-")>-1||re.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&oe(this.formatLanguageCode(re)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&oe(this.getScriptPartFromCode(re)),this.options.load!=="currentOnly"&&oe(this.getLanguagePartFromCode(re))):isString$2(re)&&oe(this.formatLanguageCode(re)),ne.forEach(se=>{ie.indexOf(se)<0&&oe(this.formatLanguageCode(se))}),ie}}const suffixesOrder={zero:0,one:1,two:2,few:3,many:4,other:5},dummyRule={select:ee=>ee===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class PluralResolver{constructor(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=re,this.options=te,this.logger=baseLogger.create("pluralResolver"),this.pluralRulesCache={}}addRule(re,te){this.rules[re]=te}clearCache(){this.pluralRulesCache={}}getRule(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const ne=getCleanedCode(re==="dev"?"en":re),ie=te.ordinal?"ordinal":"cardinal",oe=JSON.stringify({cleanedCode:ne,type:ie});if(oe in this.pluralRulesCache)return this.pluralRulesCache[oe];let se;try{se=new Intl.PluralRules(ne,{type:ie})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),dummyRule;if(!re.match(/-|_/))return dummyRule;const ue=this.languageUtils.getLanguagePartFromCode(re);se=this.getRule(ue,te)}return this.pluralRulesCache[oe]=se,se}needsPlural(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ne=this.getRule(re,te);return ne||(ne=this.getRule("dev",te)),(ne==null?void 0:ne.resolvedOptions().pluralCategories.length)>1}getPluralFormsOfKey(re,te){let ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(re,ne).map(ie=>`${te}${ie}`)}getSuffixes(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ne=this.getRule(re,te);return ne||(ne=this.getRule("dev",te)),ne?ne.resolvedOptions().pluralCategories.sort((ie,oe)=>suffixesOrder[ie]-suffixesOrder[oe]).map(ie=>`${this.options.prepend}${te.ordinal?`ordinal${this.options.prepend}`:""}${ie}`):[]}getSuffix(re,te){let ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const ie=this.getRule(re,ne);return ie?`${this.options.prepend}${ne.ordinal?`ordinal${this.options.prepend}`:""}${ie.select(te)}`:(this.logger.warn(`no plural rule found for: ${re}`),this.getSuffix("dev",te,ne))}}const deepFindWithDefaults=function(ee,re,te){let ne=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",ie=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,oe=getPathWithDefaults(ee,re,te);return!oe&&ie&&isString$2(te)&&(oe=deepFind(ee,te,ne),oe===void 0&&(oe=deepFind(re,te,ne))),oe},regexSafe=ee=>ee.replace(/\$/g,"$$$$");class Interpolator{constructor(){var te;let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("interpolator"),this.options=re,this.format=((te=re==null?void 0:re.interpolation)==null?void 0:te.format)||(ne=>ne),this.init(re)}init(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};re.interpolation||(re.interpolation={escapeValue:!0});const{escape:te,escapeValue:ne,useRawValueToEscape:ie,prefix:oe,prefixEscaped:se,suffix:ae,suffixEscaped:ue,formatSeparator:ce,unescapeSuffix:le,unescapePrefix:de,nestingPrefix:fe,nestingPrefixEscaped:he,nestingSuffix:pe,nestingSuffixEscaped:ge,nestingOptionsSeparator:me,maxReplaces:ye,alwaysFormat:ve}=re.interpolation;this.escape=te!==void 0?te:escape$1,this.escapeValue=ne!==void 0?ne:!0,this.useRawValueToEscape=ie!==void 0?ie:!1,this.prefix=oe?regexEscape(oe):se||"{{",this.suffix=ae?regexEscape(ae):ue||"}}",this.formatSeparator=ce||",",this.unescapePrefix=le?"":de||"-",this.unescapeSuffix=this.unescapePrefix?"":le||"",this.nestingPrefix=fe?regexEscape(fe):he||regexEscape("$t("),this.nestingSuffix=pe?regexEscape(pe):ge||regexEscape(")"),this.nestingOptionsSeparator=me||",",this.maxReplaces=ye||1e3,this.alwaysFormat=ve!==void 0?ve:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const re=(te,ne)=>(te==null?void 0:te.source)===ne?(te.lastIndex=0,te):new RegExp(ne,"g");this.regexp=re(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=re(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=re(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(re,te,ne,ie){var he;let oe,se,ae;const ue=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},ce=pe=>{if(pe.indexOf(this.formatSeparator)<0){const ve=deepFindWithDefaults(te,ue,pe,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(ve,void 0,ne,{...ie,...te,interpolationkey:pe}):ve}const ge=pe.split(this.formatSeparator),me=ge.shift().trim(),ye=ge.join(this.formatSeparator).trim();return this.format(deepFindWithDefaults(te,ue,me,this.options.keySeparator,this.options.ignoreJSONStructure),ye,ne,{...ie,...te,interpolationkey:me})};this.resetRegExp();const le=(ie==null?void 0:ie.missingInterpolationHandler)||this.options.missingInterpolationHandler,de=((he=ie==null?void 0:ie.interpolation)==null?void 0:he.skipOnVariables)!==void 0?ie.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:pe=>regexSafe(pe)},{regex:this.regexp,safeValue:pe=>this.escapeValue?regexSafe(this.escape(pe)):regexSafe(pe)}].forEach(pe=>{for(ae=0;oe=pe.regex.exec(re);){const ge=oe[1].trim();if(se=ce(ge),se===void 0)if(typeof le=="function"){const ye=le(re,oe,ie);se=isString$2(ye)?ye:""}else if(ie&&Object.prototype.hasOwnProperty.call(ie,ge))se="";else if(de){se=oe[0];continue}else this.logger.warn(`missed to pass in variable ${ge} for interpolating ${re}`),se="";else!isString$2(se)&&!this.useRawValueToEscape&&(se=makeString(se));const me=pe.safeValue(se);if(re=re.replace(oe[0],me),de?(pe.regex.lastIndex+=se.length,pe.regex.lastIndex-=oe[0].length):pe.regex.lastIndex=0,ae++,ae>=this.maxReplaces)break}}),re}nest(re,te){let ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ie,oe,se;const ae=(ue,ce)=>{const le=this.nestingOptionsSeparator;if(ue.indexOf(le)<0)return ue;const de=ue.split(new RegExp(`${le}[ ]*{`));let fe=`{${de[1]}`;ue=de[0],fe=this.interpolate(fe,se);const he=fe.match(/'/g),pe=fe.match(/"/g);(((he==null?void 0:he.length)??0)%2===0&&!pe||pe.length%2!==0)&&(fe=fe.replace(/'/g,'"'));try{se=JSON.parse(fe),ce&&(se={...ce,...se})}catch(ge){return this.logger.warn(`failed parsing options string in nesting for key ${ue}`,ge),`${ue}${le}${fe}`}return se.defaultValue&&se.defaultValue.indexOf(this.prefix)>-1&&delete se.defaultValue,ue};for(;ie=this.nestingRegexp.exec(re);){let ue=[];se={...ne},se=se.replace&&!isString$2(se.replace)?se.replace:se,se.applyPostProcessor=!1,delete se.defaultValue;let ce=!1;if(ie[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(ie[1])){const le=ie[1].split(this.formatSeparator).map(de=>de.trim());ie[1]=le.shift(),ue=le,ce=!0}if(oe=te(ae.call(this,ie[1].trim(),se),se),oe&&ie[0]===re&&!isString$2(oe))return oe;isString$2(oe)||(oe=makeString(oe)),oe||(this.logger.warn(`missed to resolve ${ie[1]} for nesting ${re}`),oe=""),ce&&(oe=ue.reduce((le,de)=>this.format(le,de,ne.lng,{...ne,interpolationkey:ie[1].trim()}),oe.trim())),re=re.replace(ie[0],oe),this.regexp.lastIndex=0}return re}}const parseFormatStr=ee=>{let re=ee.toLowerCase().trim();const te={};if(ee.indexOf("(")>-1){const ne=ee.split("(");re=ne[0].toLowerCase().trim();const ie=ne[1].substring(0,ne[1].length-1);re==="currency"&&ie.indexOf(":")<0?te.currency||(te.currency=ie.trim()):re==="relativetime"&&ie.indexOf(":")<0?te.range||(te.range=ie.trim()):ie.split(";").forEach(se=>{if(se){const[ae,...ue]=se.split(":"),ce=ue.join(":").trim().replace(/^'+|'+$/g,""),le=ae.trim();te[le]||(te[le]=ce),ce==="false"&&(te[le]=!1),ce==="true"&&(te[le]=!0),isNaN(ce)||(te[le]=parseInt(ce,10))}})}return{formatName:re,formatOptions:te}},createCachedFormatter=ee=>{const re={};return(te,ne,ie)=>{let oe=ie;ie&&ie.interpolationkey&&ie.formatParams&&ie.formatParams[ie.interpolationkey]&&ie[ie.interpolationkey]&&(oe={...oe,[ie.interpolationkey]:void 0});const se=ne+JSON.stringify(oe);let ae=re[se];return ae||(ae=ee(getCleanedCode(ne),ie),re[se]=ae),ae(te)}};class Formatter{constructor(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=baseLogger.create("formatter"),this.options=re,this.formats={number:createCachedFormatter((te,ne)=>{const ie=new Intl.NumberFormat(te,{...ne});return oe=>ie.format(oe)}),currency:createCachedFormatter((te,ne)=>{const ie=new Intl.NumberFormat(te,{...ne,style:"currency"});return oe=>ie.format(oe)}),datetime:createCachedFormatter((te,ne)=>{const ie=new Intl.DateTimeFormat(te,{...ne});return oe=>ie.format(oe)}),relativetime:createCachedFormatter((te,ne)=>{const ie=new Intl.RelativeTimeFormat(te,{...ne});return oe=>ie.format(oe,ne.range||"day")}),list:createCachedFormatter((te,ne)=>{const ie=new Intl.ListFormat(te,{...ne});return oe=>ie.format(oe)})},this.init(re)}init(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=te.interpolation.formatSeparator||","}add(re,te){this.formats[re.toLowerCase().trim()]=te}addCached(re,te){this.formats[re.toLowerCase().trim()]=createCachedFormatter(te)}format(re,te,ne){let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const oe=te.split(this.formatSeparator);if(oe.length>1&&oe[0].indexOf("(")>1&&oe[0].indexOf(")")<0&&oe.find(ae=>ae.indexOf(")")>-1)){const ae=oe.findIndex(ue=>ue.indexOf(")")>-1);oe[0]=[oe[0],...oe.splice(1,ae)].join(this.formatSeparator)}return oe.reduce((ae,ue)=>{var de;const{formatName:ce,formatOptions:le}=parseFormatStr(ue);if(this.formats[ce]){let fe=ae;try{const he=((de=ie==null?void 0:ie.formatParams)==null?void 0:de[ie.interpolationkey])||{},pe=he.locale||he.lng||ie.locale||ie.lng||ne;fe=this.formats[ce](ae,pe,{...le,...ie,...he})}catch(he){this.logger.warn(he)}return fe}else this.logger.warn(`there was no format function for ${ce}`);return ae},re)}}const removePending=(ee,re)=>{ee.pending[re]!==void 0&&(delete ee.pending[re],ee.pendingCount--)};class Connector extends EventEmitter{constructor(re,te,ne){var oe,se;let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=re,this.store=te,this.services=ne,this.languageUtils=ne.languageUtils,this.options=ie,this.logger=baseLogger.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=ie.maxParallelReads||10,this.readingCalls=0,this.maxRetries=ie.maxRetries>=0?ie.maxRetries:5,this.retryTimeout=ie.retryTimeout>=1?ie.retryTimeout:350,this.state={},this.queue=[],(se=(oe=this.backend)==null?void 0:oe.init)==null||se.call(oe,ne,ie.backend,ie)}queueLoad(re,te,ne,ie){const oe={},se={},ae={},ue={};return re.forEach(ce=>{let le=!0;te.forEach(de=>{const fe=`${ce}|${de}`;!ne.reload&&this.store.hasResourceBundle(ce,de)?this.state[fe]=2:this.state[fe]<0||(this.state[fe]===1?se[fe]===void 0&&(se[fe]=!0):(this.state[fe]=1,le=!1,se[fe]===void 0&&(se[fe]=!0),oe[fe]===void 0&&(oe[fe]=!0),ue[de]===void 0&&(ue[de]=!0)))}),le||(ae[ce]=!0)}),(Object.keys(oe).length||Object.keys(se).length)&&this.queue.push({pending:se,pendingCount:Object.keys(se).length,loaded:{},errors:[],callback:ie}),{toLoad:Object.keys(oe),pending:Object.keys(se),toLoadLanguages:Object.keys(ae),toLoadNamespaces:Object.keys(ue)}}loaded(re,te,ne){const ie=re.split("|"),oe=ie[0],se=ie[1];te&&this.emit("failedLoading",oe,se,te),!te&&ne&&this.store.addResourceBundle(oe,se,ne,void 0,void 0,{skipCopy:!0}),this.state[re]=te?-1:2,te&&ne&&(this.state[re]=0);const ae={};this.queue.forEach(ue=>{pushPath(ue.loaded,[oe],se),removePending(ue,re),te&&ue.errors.push(te),ue.pendingCount===0&&!ue.done&&(Object.keys(ue.loaded).forEach(ce=>{ae[ce]||(ae[ce]={});const le=ue.loaded[ce];le.length&&le.forEach(de=>{ae[ce][de]===void 0&&(ae[ce][de]=!0)})}),ue.done=!0,ue.errors.length?ue.callback(ue.errors):ue.callback())}),this.emit("loaded",ae),this.queue=this.queue.filter(ue=>!ue.done)}read(re,te,ne){let ie=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,oe=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,se=arguments.length>5?arguments[5]:void 0;if(!re.length)return se(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:re,ns:te,fcName:ne,tried:ie,wait:oe,callback:se});return}this.readingCalls++;const ae=(ce,le)=>{if(this.readingCalls--,this.waitingReads.length>0){const de=this.waitingReads.shift();this.read(de.lng,de.ns,de.fcName,de.tried,de.wait,de.callback)}if(ce&&le&&ie<this.maxRetries){setTimeout(()=>{this.read.call(this,re,te,ne,ie+1,oe*2,se)},oe);return}se(ce,le)},ue=this.backend[ne].bind(this.backend);if(ue.length===2){try{const ce=ue(re,te);ce&&typeof ce.then=="function"?ce.then(le=>ae(null,le)).catch(ae):ae(null,ce)}catch(ce){ae(ce)}return}return ue(re,te,ae)}prepareLoading(re,te){let ne=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},ie=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),ie&&ie();isString$2(re)&&(re=this.languageUtils.toResolveHierarchy(re)),isString$2(te)&&(te=[te]);const oe=this.queueLoad(re,te,ne,ie);if(!oe.toLoad.length)return oe.pending.length||ie(),null;oe.toLoad.forEach(se=>{this.loadOne(se)})}load(re,te,ne){this.prepareLoading(re,te,{},ne)}reload(re,te,ne){this.prepareLoading(re,te,{reload:!0},ne)}loadOne(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const ne=re.split("|"),ie=ne[0],oe=ne[1];this.read(ie,oe,"read",void 0,void 0,(se,ae)=>{se&&this.logger.warn(`${te}loading namespace ${oe} for language ${ie} failed`,se),!se&&ae&&this.logger.log(`${te}loaded namespace ${oe} for language ${ie}`,ae),this.loaded(re,se,ae)})}saveMissing(re,te,ne,ie,oe){var ue,ce,le,de,fe;let se=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},ae=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if((ce=(ue=this.services)==null?void 0:ue.utils)!=null&&ce.hasLoadedNamespace&&!((de=(le=this.services)==null?void 0:le.utils)!=null&&de.hasLoadedNamespace(te))){this.logger.warn(`did not save key "${ne}" as the namespace "${te}" 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(!(ne==null||ne==="")){if((fe=this.backend)!=null&&fe.create){const he={...se,isUpdate:oe},pe=this.backend.create.bind(this.backend);if(pe.length<6)try{let ge;pe.length===5?ge=pe(re,te,ne,ie,he):ge=pe(re,te,ne,ie),ge&&typeof ge.then=="function"?ge.then(me=>ae(null,me)).catch(ae):ae(null,ge)}catch(ge){ae(ge)}else pe(re,te,ne,ie,ae,he)}!re||!re[0]||this.store.addResource(re[0],te,ne,ie)}}}const get=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:ee=>{let re={};if(typeof ee[1]=="object"&&(re=ee[1]),isString$2(ee[1])&&(re.defaultValue=ee[1]),isString$2(ee[2])&&(re.tDescription=ee[2]),typeof ee[2]=="object"||typeof ee[3]=="object"){const te=ee[3]||ee[2];Object.keys(te).forEach(ne=>{re[ne]=te[ne]})}return re},interpolation:{escapeValue:!0,format:ee=>ee,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),transformOptions=ee=>{var re,te;return isString$2(ee.ns)&&(ee.ns=[ee.ns]),isString$2(ee.fallbackLng)&&(ee.fallbackLng=[ee.fallbackLng]),isString$2(ee.fallbackNS)&&(ee.fallbackNS=[ee.fallbackNS]),((te=(re=ee.supportedLngs)==null?void 0:re.indexOf)==null?void 0:te.call(re,"cimode"))<0&&(ee.supportedLngs=ee.supportedLngs.concat(["cimode"])),typeof ee.initImmediate=="boolean"&&(ee.initAsync=ee.initImmediate),ee},noop$3=()=>{},bindMemberFunctions=ee=>{Object.getOwnPropertyNames(Object.getPrototypeOf(ee)).forEach(te=>{typeof ee[te]=="function"&&(ee[te]=ee[te].bind(ee))})};class I18n extends EventEmitter{constructor(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},te=arguments.length>1?arguments[1]:void 0;if(super(),this.options=transformOptions(re),this.services={},this.logger=baseLogger,this.modules={external:[]},bindMemberFunctions(this),te&&!this.isInitialized&&!re.isClone){if(!this.options.initAsync)return this.init(re,te),this;setTimeout(()=>{this.init(re,te)},0)}}init(){var re=this;let te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ne=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof te=="function"&&(ne=te,te={}),te.defaultNS==null&&te.ns&&(isString$2(te.ns)?te.defaultNS=te.ns:te.ns.indexOf("translation")<0&&(te.defaultNS=te.ns[0]));const ie=get();this.options={...ie,...this.options,...transformOptions(te)},this.options.interpolation={...ie.interpolation,...this.options.interpolation},te.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=te.keySeparator),te.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=te.nsSeparator);const oe=le=>le?typeof le=="function"?new le:le:null;if(!this.options.isClone){this.modules.logger?baseLogger.init(oe(this.modules.logger),this.options):baseLogger.init(null,this.options);let le;this.modules.formatter?le=this.modules.formatter:le=Formatter;const de=new LanguageUtil(this.options);this.store=new ResourceStore(this.options.resources,this.options);const fe=this.services;fe.logger=baseLogger,fe.resourceStore=this.store,fe.languageUtils=de,fe.pluralResolver=new PluralResolver(de,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),le&&(!this.options.interpolation.format||this.options.interpolation.format===ie.interpolation.format)&&(fe.formatter=oe(le),fe.formatter.init(fe,this.options),this.options.interpolation.format=fe.formatter.format.bind(fe.formatter)),fe.interpolator=new Interpolator(this.options),fe.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},fe.backendConnector=new Connector(oe(this.modules.backend),fe.resourceStore,fe,this.options),fe.backendConnector.on("*",function(he){for(var pe=arguments.length,ge=new Array(pe>1?pe-1:0),me=1;me<pe;me++)ge[me-1]=arguments[me];re.emit(he,...ge)}),this.modules.languageDetector&&(fe.languageDetector=oe(this.modules.languageDetector),fe.languageDetector.init&&fe.languageDetector.init(fe,this.options.detection,this.options)),this.modules.i18nFormat&&(fe.i18nFormat=oe(this.modules.i18nFormat),fe.i18nFormat.init&&fe.i18nFormat.init(this)),this.translator=new Translator(this.services,this.options),this.translator.on("*",function(he){for(var pe=arguments.length,ge=new Array(pe>1?pe-1:0),me=1;me<pe;me++)ge[me-1]=arguments[me];re.emit(he,...ge)}),this.modules.external.forEach(he=>{he.init&&he.init(this)})}if(this.format=this.options.interpolation.format,ne||(ne=noop$3),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const le=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);le.length>0&&le[0]!=="dev"&&(this.options.lng=le[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(le=>{this[le]=function(){return re.store[le](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(le=>{this[le]=function(){return re.store[le](...arguments),re}});const ue=defer(),ce=()=>{const le=(de,fe)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),ue.resolve(fe),ne(de,fe)};if(this.languages&&!this.isInitialized)return le(null,this.t.bind(this));this.changeLanguage(this.options.lng,le)};return this.options.resources||!this.options.initAsync?ce():setTimeout(ce,0),ue}loadResources(re){var oe,se;let ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$3;const ie=isString$2(re)?re:this.language;if(typeof re=="function"&&(ne=re),!this.options.resources||this.options.partialBundledLanguages){if((ie==null?void 0:ie.toLowerCase())==="cimode"&&(!this.options.preload||this.options.preload.length===0))return ne();const ae=[],ue=ce=>{if(!ce||ce==="cimode")return;this.services.languageUtils.toResolveHierarchy(ce).forEach(de=>{de!=="cimode"&&ae.indexOf(de)<0&&ae.push(de)})};ie?ue(ie):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(le=>ue(le)),(se=(oe=this.options.preload)==null?void 0:oe.forEach)==null||se.call(oe,ce=>ue(ce)),this.services.backendConnector.load(ae,this.options.ns,ce=>{!ce&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),ne(ce)})}else ne(null)}reloadResources(re,te,ne){const ie=defer();return typeof re=="function"&&(ne=re,re=void 0),typeof te=="function"&&(ne=te,te=void 0),re||(re=this.languages),te||(te=this.options.ns),ne||(ne=noop$3),this.services.backendConnector.reload(re,te,oe=>{ie.resolve(),ne(oe)}),ie}use(re){if(!re)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!re.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return re.type==="backend"&&(this.modules.backend=re),(re.type==="logger"||re.log&&re.warn&&re.error)&&(this.modules.logger=re),re.type==="languageDetector"&&(this.modules.languageDetector=re),re.type==="i18nFormat"&&(this.modules.i18nFormat=re),re.type==="postProcessor"&&postProcessor.addPostProcessor(re),re.type==="formatter"&&(this.modules.formatter=re),re.type==="3rdParty"&&this.modules.external.push(re),this}setResolvedLanguage(re){if(!(!re||!this.languages)&&!(["cimode","dev"].indexOf(re)>-1))for(let te=0;te<this.languages.length;te++){const ne=this.languages[te];if(!(["cimode","dev"].indexOf(ne)>-1)&&this.store.hasLanguageSomeTranslations(ne)){this.resolvedLanguage=ne;break}}}changeLanguage(re,te){var ne=this;this.isLanguageChangingTo=re;const ie=defer();this.emit("languageChanging",re);const oe=ue=>{this.language=ue,this.languages=this.services.languageUtils.toResolveHierarchy(ue),this.resolvedLanguage=void 0,this.setResolvedLanguage(ue)},se=(ue,ce)=>{ce?(oe(ce),this.translator.changeLanguage(ce),this.isLanguageChangingTo=void 0,this.emit("languageChanged",ce),this.logger.log("languageChanged",ce)):this.isLanguageChangingTo=void 0,ie.resolve(function(){return ne.t(...arguments)}),te&&te(ue,function(){return ne.t(...arguments)})},ae=ue=>{var le,de;!re&&!ue&&this.services.languageDetector&&(ue=[]);const ce=isString$2(ue)?ue:this.services.languageUtils.getBestMatchFromCodes(ue);ce&&(this.language||oe(ce),this.translator.language||this.translator.changeLanguage(ce),(de=(le=this.services.languageDetector)==null?void 0:le.cacheUserLanguage)==null||de.call(le,ce)),this.loadResources(ce,fe=>{se(fe,ce)})};return!re&&this.services.languageDetector&&!this.services.languageDetector.async?ae(this.services.languageDetector.detect()):!re&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(ae):this.services.languageDetector.detect(ae):ae(re),ie}getFixedT(re,te,ne){var ie=this;const oe=function(se,ae){let ue;if(typeof ae!="object"){for(var ce=arguments.length,le=new Array(ce>2?ce-2:0),de=2;de<ce;de++)le[de-2]=arguments[de];ue=ie.options.overloadTranslationOptionHandler([se,ae].concat(le))}else ue={...ae};ue.lng=ue.lng||oe.lng,ue.lngs=ue.lngs||oe.lngs,ue.ns=ue.ns||oe.ns,ue.keyPrefix!==""&&(ue.keyPrefix=ue.keyPrefix||ne||oe.keyPrefix);const fe=ie.options.keySeparator||".";let he;return ue.keyPrefix&&Array.isArray(se)?he=se.map(pe=>`${ue.keyPrefix}${fe}${pe}`):he=ue.keyPrefix?`${ue.keyPrefix}${fe}${se}`:se,ie.t(he,ue)};return isString$2(re)?oe.lng=re:oe.lngs=re,oe.ns=te,oe.keyPrefix=ne,oe}t(){var ie;for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return(ie=this.translator)==null?void 0:ie.translate(...te)}exists(){var ie;for(var re=arguments.length,te=new Array(re),ne=0;ne<re;ne++)te[ne]=arguments[ne];return(ie=this.translator)==null?void 0:ie.exists(...te)}setDefaultNamespace(re){this.options.defaultNS=re}hasLoadedNamespace(re){let te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const ne=te.lng||this.resolvedLanguage||this.languages[0],ie=this.options?this.options.fallbackLng:!1,oe=this.languages[this.languages.length-1];if(ne.toLowerCase()==="cimode")return!0;const se=(ae,ue)=>{const ce=this.services.backendConnector.state[`${ae}|${ue}`];return ce===-1||ce===0||ce===2};if(te.precheck){const ae=te.precheck(this,se);if(ae!==void 0)return ae}return!!(this.hasResourceBundle(ne,re)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||se(ne,re)&&(!ie||se(oe,re)))}loadNamespaces(re,te){const ne=defer();return this.options.ns?(isString$2(re)&&(re=[re]),re.forEach(ie=>{this.options.ns.indexOf(ie)<0&&this.options.ns.push(ie)}),this.loadResources(ie=>{ne.resolve(),te&&te(ie)}),ne):(te&&te(),Promise.resolve())}loadLanguages(re,te){const ne=defer();isString$2(re)&&(re=[re]);const ie=this.options.preload||[],oe=re.filter(se=>ie.indexOf(se)<0&&this.services.languageUtils.isSupportedCode(se));return oe.length?(this.options.preload=ie.concat(oe),this.loadResources(se=>{ne.resolve(),te&&te(se)}),ne):(te&&te(),Promise.resolve())}dir(re){var ie,oe;if(re||(re=this.resolvedLanguage||(((ie=this.languages)==null?void 0:ie.length)>0?this.languages[0]:this.language)),!re)return"rtl";const te=["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"],ne=((oe=this.services)==null?void 0:oe.languageUtils)||new LanguageUtil(get());return te.indexOf(ne.getLanguagePartFromCode(re))>-1||re.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},te=arguments.length>1?arguments[1]:void 0;return new I18n(re,te)}cloneInstance(){let re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},te=arguments.length>1&&arguments[1]!==void 0?arguments[1]:noop$3;const ne=re.forkResourceStore;ne&&delete re.forkResourceStore;const ie={...this.options,...re,isClone:!0},oe=new I18n(ie);if((re.debug!==void 0||re.prefix!==void 0)&&(oe.logger=oe.logger.clone(re)),["store","services","language"].forEach(ae=>{oe[ae]=this[ae]}),oe.services={...this.services},oe.services.utils={hasLoadedNamespace:oe.hasLoadedNamespace.bind(oe)},ne){const ae=Object.keys(this.store.data).reduce((ue,ce)=>(ue[ce]={...this.store.data[ce]},Object.keys(ue[ce]).reduce((le,de)=>(le[de]={...ue[ce][de]},le),{})),{});oe.store=new ResourceStore(ae,ie),oe.services.resourceStore=oe.store}return oe.translator=new Translator(oe.services,ie),oe.translator.on("*",function(ae){for(var ue=arguments.length,ce=new Array(ue>1?ue-1:0),le=1;le<ue;le++)ce[le-1]=arguments[le];oe.emit(ae,...ce)}),oe.init(ie,te),oe.translator.options=ie,oe.translator.backendConnector.services.utils={hasLoadedNamespace:oe.hasLoadedNamespace.bind(oe)},oe}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const instance=I18n.createInstance();instance.createInstance=I18n.createInstance,instance.createInstance,instance.dir,instance.init,instance.loadResources,instance.reloadResources,instance.use,instance.changeLanguage,instance.getFixedT,instance.t,instance.exists,instance.setDefaultNamespace,instance.hasLoadedNamespace,instance.loadNamespaces,instance.loadLanguages;const translation$2={additional_information:"Additional information",almost_done:"Almost done...",already_paid:"Already paid?",astro_express_checkout:"Express checkout",check_payment_status:"Check payment status",checkout_method:"Checkout method",or:"OR",email:"E-mail",enter_country_code:"Please enter a country or code",enter_your_email:"Enter your e-mail",enter_your_document_number:"Enter your document number",enter_your_document_type:"Select a document type",enter_your_first_name:"Enter your first name",enter_your_last_name:"Enter your last name",enter_your_phone:"Enter your phone number",continue:"Continue",copied:"Copied!",copy_payment_link:"Copy payment link",document_number:"Document number",document_type:"Document type",do_not_close_window:"Please do not close this window.",didnt_receive:"Didn't receive it?",first_name:"First name",generic_error:"An error occurred. Please try again.",hold_on:"Hold on!",invalid_field:"Invalid field",last_name:"Last name",loading_wait:"Loading, please wait...",pay_amount:"Pay {{amount}}",payment_amount:"Payment amount",push_notification_sent:"We sent a push notification to your app",qr_code:"QR code",required_field:"Required Field",scan_qr_copy_link:"Scan the QR code or copy the link.",select:"Select",select_item:"Select an item",time_up:"Time's up!",try_again:"Try again",waiting_confirmation:"Waiting for confirmation...",card_holder_label:"Cardholder name",card_holder_placeholder:"Full name as on card",card_number:"Card number",card_exp_date:"Expiration date",card_tokenization_error:"We couldn't process your card payment. Please check your details and try again.",payment_processing:"Processing your payment...",payment_still_processing:"This is taking a bit longer than usual, please hold on..."},en$1={translation:translation$2},translation$1={additional_information:"Información adicional",almost_done:"Casi listo...",already_paid:"Ya pagaste?",astro_express_checkout:"Pago express",check_payment_status:"Ver estado del pago",checkout_method:"Método de pago",or:"O",email:"Correo electrónico",enter_country_code:"Introduce el país o código del país",enter_your_email:"Ingrese su correo electrónico",enter_your_document_number:"Ingrese su número de documento",enter_your_document_type:"Seleccione un tipo de documento",enter_your_first_name:"Ingrese su nombre",enter_your_last_name:"Ingrese su apellido",enter_your_phone:"Introduzca su número de teléfono",continue:"Continuar",copied:"Copiado!",copy_payment_link:"Copiar enlace de pago",document_number:"Número de documento",document_type:"Tipo de documento",do_not_close_window:"Por favor, no cierres esta ventana.",didnt_receive:"No lo recibiste?",first_name:"Nombre",generic_error:"Ocurrió un error. Por favor, inténtelo de nuevo.",hold_on:"¡Un instante...!",invalid_field:"Campo inválido",last_name:"Apellido",loading_wait:"Cargando, aguantá un toque...",pay_amount:"Pagar {{amount}}",payment_amount:"Monto a pagar",push_notification_sent:"Enviamos una notificación push a tu app",qr_code:"código QR",required_field:"Campo Requerido",scan_qr_copy_link:"Escaneá el código QR o copiá el enlace.",select:"Seleccionar",select_item:"Selecciona una opción",time_up:"Se acabó el tiempo!",try_again:"Inténtalo de nuevo",waiting_confirmation:"Esperando confirmación...",card_holder_label:"Nombre del titular",card_holder_placeholder:"Nombre completo en la tarjeta",card_number:"Número de tarjeta",card_exp_date:"Fecha de vencimiento",card_tokenization_error:"No pudimos procesar tu pago con tarjeta. Verificá los datos y volvé a intentarlo.",payment_processing:"Procesando tu pago...",payment_still_processing:"Está tardando un poco más de lo habitual, estamos verificando su estado."},es={translation:translation$1},translation={additional_information:"Informações adicionais",almost_done:"Finalizando...",already_paid:"Já pagou?",astro_express_checkout:"Pagamento expresso",check_payment_status:"Verificar status do pagamento",checkout_method:"Método de pagamento",or:"OU",email:"E-mail",enter_country_code:"Informe um país ou código",enter_your_email:"Digite seu e-mail",enter_your_document_number:"Digite seu número de documento",enter_your_document_type:"Selecione um tipo de documento",enter_your_first_name:"Digite seu primeiro nome",enter_your_last_name:"Digite seu sobrenome",enter_your_phone:"Digite seu número de telefone",continue:"Continuar",copied:"Copiado!",copy_payment_link:"Copiar link de pagamento",document_number:"Número do documento",document_type:"Tipo de documento",do_not_close_window:"Por favor, não feche esta janela.",didnt_receive:"Não recebeu?",first_name:"Primeiro nome",generic_error:"Ocorreu um erro. Por favor, tente novamente.",hold_on:"Só um instante!",invalid_field:"Campo inválido",last_name:"Sobrenome",loading_wait:"Carregando, por favor aguarde...",pay_amount:"Pagar {{amount}}",payment_amount:"Valor do pagamento",push_notification_sent:"Enviamos uma notificação push para seu app",qr_code:"QR code",required_field:"Campo Obrigatório",scan_qr_copy_link:"Escaneie o QR code ou copie o link.",select:"Selecione",select_item:"Selecione um item",time_up:"Tempo esgotado!",try_again:"Tente novamente",waiting_confirmation:"Aguardando confirmação...",card_holder_label:"Nome do titular",card_holder_placeholder:"Nome completo no cartão",card_number:"Número do cartão",card_exp_date:"Data de validade",card_tokenization_error:"Não foi possível processar seu pagamento com o cartão. Verifique os dados e tente novamente.",payment_processing:"Processando seu pagamento...",payment_still_processing:"Está demorando um pouco mais que o usual, por favor aguarde..."},pt$1={translation},LOCAL_TRANSLATIONS={en:en$1,es,pt:pt$1};class AstroPayI18n{static init(re){const te=validateValue(re==null?void 0:re.language,CONFIG_LANGUAGE_VALUES,"en");return instance.init({lng:te,fallbackLng:"en",resources:LOCAL_TRANSLATIONS,interpolation:{escapeValue:!1}})}static getCurrent(){return instance.language}static translate(re,te){return instance.t(re,te??{})}}const getLoadingSuccessStyles=()=>css`
|
|
146
148
|
display: flex;
|
|
147
149
|
align-items: center;
|
|
148
150
|
justify-content: center;
|
|
149
151
|
gap: 8px;
|
|
150
|
-
`;class LoadingSuccess extends Component{constructor({text:re,delay:te,onSuccess:ne}){super({tag:"div",styles:()=>getLoadingSuccessStyles()});const ie=new Loading({size:12,color:ThemeManager.getStyles().textPrimaryColor}).element,oe=new Typography({text:re??AstroPayI18n.translate("almost_done"),size:"xSmall"}).element;this.element.append(ie,oe),setTimeout(()=>{ne(),this.element.remove()},te??5e3)}}const RUNTIME_CONFIG={test:{NAME:"@astropay/payments-lib",VERSION:"2.0.13",MODE:"test",API_BASE_URL:"https://partners-api-tst.astropay.com/api",RESOURCES_BUCKET:"https://rs-tst.astropay.com",CHECKOUT_URL:"https://checkout-tst.astropay.com",SINGULAR_LINK_URL:"https://astropay-tst.sng.link/Eftaj/ovlnu?_smtype=3",SINGULAR_LINK_PREFIX:"apcmobiletst://"},sandbox:{NAME:"@astropay/payments-lib",VERSION:"2.0.13",MODE:"staging",API_BASE_URL:"https://partners-api-sandbox.astropay.com/api",RESOURCES_BUCKET:"https://rs-tst.astropay.com",CHECKOUT_URL:"https://checkout-sandbox.astropay.com",SINGULAR_LINK_URL:"https://astropay-stg.sng.link/Ezzoz/nfnj?_smtype=3",SINGULAR_LINK_PREFIX:"apcmobilestaging://"},production:{NAME:"@astropay/payments-lib",VERSION:"2.0.13",MODE:"production",API_BASE_URL:"https://partners-api.astropay.com/api",RESOURCES_BUCKET:"https://rs.astropay.com",CHECKOUT_URL:"https://checkout.astropay.com",SINGULAR_LINK_URL:"https://astropay.sng.link/E2h2a/jqze?_smtype=3",SINGULAR_LINK_PREFIX:"apcmobile://"}};var EStorageKey=(ee=>(ee.SESSION_ID="session_id",ee))(EStorageKey||{});const Jr=class Jr{static init(re){const te=validateValue(re==null?void 0:re.environment,[...CONFIG_ENVIRONMENT_VALUES,"test"],"production"),ne=validateValue(re==null?void 0:re.currencyMode,CONFIG_CURRENCY_MODE_VALUES,"iso");Jr.environment=te,Jr.currencyMode=ne}static getRuntimeConfig(){const re=Jr.environment||"production";return RUNTIME_CONFIG[re]}static getEnvironment(){return Jr.environment}static getCurrencyMode(){return Jr.currencyMode}};xe(Jr,"environment"),xe(Jr,"currencyMode");let AstroPayConfig=Jr;const ConsoleApiName={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},globalConsole=console,originalConsoleMethods={};Object.keys(ConsoleApiName).forEach(ee=>{originalConsoleMethods[ee]=globalConsole[ee]});const PREFIX$1="Datadog Browser SDK:",display={debug:originalConsoleMethods.debug.bind(globalConsole,PREFIX$1),log:originalConsoleMethods.log.bind(globalConsole,PREFIX$1),info:originalConsoleMethods.info.bind(globalConsole,PREFIX$1),warn:originalConsoleMethods.warn.bind(globalConsole,PREFIX$1),error:originalConsoleMethods.error.bind(globalConsole,PREFIX$1)},DOCS_ORIGIN="https://docs.datadoghq.com",DOCS_TROUBLESHOOTING=`${DOCS_ORIGIN}/real_user_monitoring/browser/troubleshooting`,MORE_DETAILS="More details:";function catchUserErrors(ee,re){return(...te)=>{try{return ee(...te)}catch(ne){display.error(re,ne)}}}function performDraw(ee){return ee!==0&&Math.random()*100<=ee}function round(ee,re){return+ee.toFixed(re)}function isPercentage(ee){return isNumber$1(ee)&&ee>=0&&ee<=100}function isNumber$1(ee){return typeof ee=="number"}const ONE_SECOND=1e3,ONE_MINUTE=60*ONE_SECOND,ONE_HOUR=60*ONE_MINUTE,ONE_DAY=24*ONE_HOUR,ONE_YEAR=365*ONE_DAY;function relativeToClocks(ee){return{relative:ee,timeStamp:getCorrectedTimeStamp(ee)}}function timeStampToClocks(ee){return{relative:getRelativeTime(ee),timeStamp:ee}}function getCorrectedTimeStamp(ee){const re=dateNow()-performance.now();return re>getNavigationStart()?Math.round(addDuration(re,ee)):getTimeStamp(ee)}function currentDrift(){return Math.round(dateNow()-addDuration(getNavigationStart(),performance.now()))}function toServerDuration(ee){return isNumber$1(ee)?round(ee*1e6,0):ee}function dateNow(){return new Date().getTime()}function timeStampNow(){return dateNow()}function relativeNow(){return performance.now()}function clocksNow(){return{relative:relativeNow(),timeStamp:timeStampNow()}}function clocksOrigin(){return{relative:0,timeStamp:getNavigationStart()}}function elapsed(ee,re){return re-ee}function addDuration(ee,re){return ee+re}function getRelativeTime(ee){return ee-getNavigationStart()}function getTimeStamp(ee){return Math.round(addDuration(getNavigationStart(),ee))}function looksLikeRelativeTime(ee){return ee<ONE_YEAR}let navigationStart;function getNavigationStart(){return navigationStart===void 0&&(navigationStart=performance.timing.navigationStart),navigationStart}const ONE_KIBI_BYTE=1024,ONE_MEBI_BYTE=1024*ONE_KIBI_BYTE,HAS_MULTI_BYTES_CHARACTERS=/[^\u0000-\u007F]/;function computeBytesCount(ee){return HAS_MULTI_BYTES_CHARACTERS.test(ee)?window.TextEncoder!==void 0?new TextEncoder().encode(ee).length:new Blob([ee]).size:ee.length}function concatBuffers(ee){const re=ee.reduce((ie,oe)=>ie+oe.length,0),te=new Uint8Array(re);let ne=0;for(const ie of ee)te.set(ie,ne),ne+=ie.length;return te}function shallowClone(ee){return{...ee}}function objectHasValue(ee,re){return Object.keys(ee).some(te=>ee[te]===re)}function isEmptyObject$1(ee){return Object.keys(ee).length===0}function mapValues(ee,re){const te={};for(const ne of Object.keys(ee))te[ne]=re(ee[ne]);return te}function getGlobalObject(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let ee=_dd_temp_;return delete Object.prototype._dd_temp_,typeof ee!="object"&&(typeof self=="object"?ee=self:typeof window=="object"?ee=window:ee={}),ee}function getZoneJsOriginalValue(ee,re){const te=getGlobalObject();let ne;return te.Zone&&typeof te.Zone.__symbol__=="function"&&(ne=ee[te.Zone.__symbol__(re)]),ne||(ne=ee[re]),ne}let onMonitorErrorCollected,debugMode=!1;function startMonitorErrorCollection(ee){onMonitorErrorCollected=ee}function setDebugMode(ee){debugMode=ee}function monitor(ee){return function(){return callMonitored(ee,this,arguments)}}function callMonitored(ee,re,te){try{return ee.apply(re,te)}catch(ne){monitorError(ne)}}function monitorError(ee){if(displayIfDebugEnabled(ee),onMonitorErrorCollected)try{onMonitorErrorCollected(ee)}catch(re){displayIfDebugEnabled(re)}}function displayIfDebugEnabled(...ee){debugMode&&display.error("[MONITOR]",...ee)}function setTimeout$1(ee,re){return getZoneJsOriginalValue(getGlobalObject(),"setTimeout")(monitor(ee),re)}function clearTimeout$1(ee){getZoneJsOriginalValue(getGlobalObject(),"clearTimeout")(ee)}function setInterval$1(ee,re){return getZoneJsOriginalValue(getGlobalObject(),"setInterval")(monitor(ee),re)}function clearInterval$1(ee){getZoneJsOriginalValue(getGlobalObject(),"clearInterval")(ee)}let Observable$1=class{constructor(re){this.onFirstSubscribe=re,this.observers=[]}subscribe(re){return this.observers.push(re),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(te=>re!==te),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(re){this.observers.forEach(te=>te(re))}};function mergeObservables(...ee){return new Observable$1(re=>{const te=ee.map(ne=>ne.subscribe(ie=>re.notify(ie)));return()=>te.forEach(ne=>ne.unsubscribe())})}function throttle$2(ee,re,te){const ne=te&&te.leading!==void 0?te.leading:!0,ie=te&&te.trailing!==void 0?te.trailing:!0;let oe=!1,se,ae;return{throttled:(...ue)=>{if(oe){se=ue;return}ne?ee(...ue):se=ue,oe=!0,ae=setTimeout$1(()=>{ie&&se&&ee(...se),oe=!1,se=void 0},re)},cancel:()=>{clearTimeout$1(ae),oe=!1,se=void 0}}}function noop$2(){}function generateUUID(ee){return ee?(parseInt(ee,10)^Math.random()*16>>parseInt(ee,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,generateUUID)}const COMMA_SEPARATED_KEY_VALUE=/([\w-]+)\s*=\s*([^;]+)/g;function findCommaSeparatedValue(ee,re){for(COMMA_SEPARATED_KEY_VALUE.lastIndex=0;;){const te=COMMA_SEPARATED_KEY_VALUE.exec(ee);if(te){if(te[1]===re)return te[2]}else break}}function findCommaSeparatedValues(ee){const re=new Map;for(COMMA_SEPARATED_KEY_VALUE.lastIndex=0;;){const te=COMMA_SEPARATED_KEY_VALUE.exec(ee);if(te)re.set(te[1],te[2]);else break}return re}function safeTruncate(ee,re,te=""){const ne=ee.charCodeAt(re-1),oe=ne>=55296&&ne<=56319?re+1:re;return ee.length<=oe?ee:`${ee.slice(0,oe)}${te}`}function isChromium(){return detectBrowserCached()===0}function isSafari(){return detectBrowserCached()===1}let browserCache;function detectBrowserCached(){return browserCache??(browserCache=detectBrowser())}function detectBrowser(ee=window){var re;const te=ee.navigator.userAgent;return ee.chrome||/HeadlessChrome/.test(te)?0:((re=ee.navigator.vendor)===null||re===void 0?void 0:re.indexOf("Apple"))===0||/safari/i.test(te)&&!/chrome|android/i.test(te)?1:2}function setCookie(ee,re,te=0,ne){const ie=new Date;ie.setTime(ie.getTime()+te);const oe=`expires=${ie.toUTCString()}`,se=ne&&ne.crossSite?"none":"strict",ae=ne&&ne.domain?`;domain=${ne.domain}`:"",ue=ne&&ne.secure?";secure":"",ce=ne&&ne.partitioned?";partitioned":"";document.cookie=`${ee}=${re};${oe};path=/;samesite=${se}${ae}${ue}${ce}`}function getCookie(ee){return findCommaSeparatedValue(document.cookie,ee)}let initCookieParsed;function getInitCookie(ee){return initCookieParsed||(initCookieParsed=findCommaSeparatedValues(document.cookie)),initCookieParsed.get(ee)}function deleteCookie(ee,re){setCookie(ee,"",0,re)}function areCookiesAuthorized(ee){if(document.cookie===void 0||document.cookie===null)return!1;try{const re=`dd_cookie_test_${generateUUID()}`,te="test";setCookie(re,te,ONE_MINUTE,ee);const ne=getCookie(re)===te;return deleteCookie(re,ee),ne}catch(re){return display.error(re),!1}}let getCurrentSiteCache;function getCurrentSite(){if(getCurrentSiteCache===void 0){const ee=`dd_site_test_${generateUUID()}`,re="test",te=window.location.hostname.split(".");let ne=te.pop();for(;te.length&&!getCookie(ee);)ne=`${te.pop()}.${ne}`,setCookie(ee,re,ONE_SECOND,{domain:ne});deleteCookie(ee,{domain:ne}),getCurrentSiteCache=ne}return getCurrentSiteCache}const SESSION_STORE_KEY="_dd_s";function findLast(ee,re){for(let te=ee.length-1;te>=0;te-=1){const ne=ee[te];if(re(ne,te,ee))return ne}}function objectValues(ee){return Object.values(ee)}function objectEntries(ee){return Object.entries(ee)}const SESSION_TIME_OUT_DELAY=4*ONE_HOUR,SESSION_EXPIRATION_DELAY=15*ONE_MINUTE,SESSION_COOKIE_EXPIRATION_DELAY=ONE_YEAR,SessionPersistence={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},SESSION_ENTRY_REGEXP=/^([a-zA-Z]+)=([a-z0-9-]+)$/,SESSION_ENTRY_SEPARATOR="&";function isValidSessionString(ee){return!!ee&&(ee.indexOf(SESSION_ENTRY_SEPARATOR)!==-1||SESSION_ENTRY_REGEXP.test(ee))}const EXPIRED="1";function getExpiredSessionState(ee,re){const te={isExpired:EXPIRED};return re.trackAnonymousUser&&(ee!=null&&ee.anonymousId?te.anonymousId=ee==null?void 0:ee.anonymousId:te.anonymousId=generateUUID()),te}function isSessionInNotStartedState(ee){return isEmptyObject$1(ee)}function isSessionStarted(ee){return!isSessionInNotStartedState(ee)}function isSessionInExpiredState(ee){return ee.isExpired!==void 0||!isActiveSession(ee)}function isActiveSession(ee){return(ee.created===void 0||dateNow()-Number(ee.created)<SESSION_TIME_OUT_DELAY)&&(ee.expire===void 0||dateNow()<Number(ee.expire))}function expandSessionState(ee){ee.expire=String(dateNow()+SESSION_EXPIRATION_DELAY)}function toSessionString(ee){return objectEntries(ee).map(([re,te])=>re==="anonymousId"?`aid=${te}`:`${re}=${te}`).join(SESSION_ENTRY_SEPARATOR)}function toSessionState(ee){const re={};return isValidSessionString(ee)&&ee.split(SESSION_ENTRY_SEPARATOR).forEach(te=>{const ne=SESSION_ENTRY_REGEXP.exec(te);if(ne!==null){const[,ie,oe]=ne;ie==="aid"?re.anonymousId=oe:re[ie]=oe}}),re}const OLD_SESSION_COOKIE_NAME="_dd",OLD_RUM_COOKIE_NAME="_dd_r",OLD_LOGS_COOKIE_NAME="_dd_l",RUM_SESSION_KEY$1="rum",LOGS_SESSION_KEY="logs";function tryOldCookiesMigration(ee){if(!getInitCookie(SESSION_STORE_KEY)){const te=getInitCookie(OLD_SESSION_COOKIE_NAME),ne=getInitCookie(OLD_RUM_COOKIE_NAME),ie=getInitCookie(OLD_LOGS_COOKIE_NAME),oe={};te&&(oe.id=te),ie&&/^[01]$/.test(ie)&&(oe[LOGS_SESSION_KEY]=ie),ne&&/^[012]$/.test(ne)&&(oe[RUM_SESSION_KEY$1]=ne),isSessionStarted(oe)&&(expandSessionState(oe),ee.persistSession(oe))}}function selectCookieStrategy(ee){const re=buildCookieOptions(ee);return areCookiesAuthorized(re)?{type:SessionPersistence.COOKIE,cookieOptions:re}:void 0}function initCookieStrategy(ee,re){const te={isLockEnabled:isChromium(),persistSession:persistSessionCookie(re),retrieveSession:retrieveSessionCookie,expireSession:ne=>expireSessionCookie(re,ne,ee)};return tryOldCookiesMigration(te),te}function persistSessionCookie(ee){return re=>{setCookie(SESSION_STORE_KEY,toSessionString(re),SESSION_EXPIRATION_DELAY,ee)}}function expireSessionCookie(ee,re,te){const ne=getExpiredSessionState(re,te);setCookie(SESSION_STORE_KEY,toSessionString(ne),te.trackAnonymousUser?SESSION_COOKIE_EXPIRATION_DELAY:SESSION_TIME_OUT_DELAY,ee)}function retrieveSessionCookie(){const ee=getCookie(SESSION_STORE_KEY);return toSessionState(ee)}function buildCookieOptions(ee){const re={};return re.secure=!!ee.useSecureSessionCookie||!!ee.usePartitionedCrossSiteSessionCookie,re.crossSite=!!ee.usePartitionedCrossSiteSessionCookie,re.partitioned=!!ee.usePartitionedCrossSiteSessionCookie,ee.trackSessionAcrossSubdomains&&(re.domain=getCurrentSite()),re}const LOCAL_STORAGE_TEST_KEY="_dd_test_";function selectLocalStorageStrategy(){try{const ee=generateUUID(),re=`${LOCAL_STORAGE_TEST_KEY}${ee}`;localStorage.setItem(re,ee);const te=localStorage.getItem(re);return localStorage.removeItem(re),ee===te?{type:SessionPersistence.LOCAL_STORAGE}:void 0}catch{return}}function initLocalStorageStrategy(ee){return{isLockEnabled:!1,persistSession:persistInLocalStorage,retrieveSession:retrieveSessionFromLocalStorage,expireSession:re=>expireSessionFromLocalStorage(re,ee)}}function persistInLocalStorage(ee){localStorage.setItem(SESSION_STORE_KEY,toSessionString(ee))}function retrieveSessionFromLocalStorage(){const ee=localStorage.getItem(SESSION_STORE_KEY);return toSessionState(ee)}function expireSessionFromLocalStorage(ee,re){persistInLocalStorage(getExpiredSessionState(ee,re))}const LOCK_RETRY_DELAY=10,LOCK_MAX_TRIES=100,bufferedOperations=[];let ongoingOperations;function processSessionStoreOperations(ee,re,te=0){var ne;const{isLockEnabled:ie,persistSession:oe,expireSession:se}=re,ae=fe=>oe({...fe,lock:ce}),ue=()=>{const fe=re.retrieveSession(),he=fe.lock;return fe.lock&&delete fe.lock,{session:fe,lock:he}};if(ongoingOperations||(ongoingOperations=ee),ee!==ongoingOperations){bufferedOperations.push(ee);return}if(ie&&te>=LOCK_MAX_TRIES){next(re);return}let ce,le=ue();if(ie){if(le.lock){retryLater(ee,re,te);return}if(ce=generateUUID(),ae(le.session),le=ue(),le.lock!==ce){retryLater(ee,re,te);return}}let de=ee.process(le.session);if(ie&&(le=ue(),le.lock!==ce)){retryLater(ee,re,te);return}if(de&&(isSessionInExpiredState(de)?se(de):(expandSessionState(de),ie?ae(de):oe(de))),ie&&!(de&&isSessionInExpiredState(de))){if(le=ue(),le.lock!==ce){retryLater(ee,re,te);return}oe(le.session),de=le.session}(ne=ee.after)===null||ne===void 0||ne.call(ee,de||le.session),next(re)}function retryLater(ee,re,te){setTimeout$1(()=>{processSessionStoreOperations(ee,re,te+1)},LOCK_RETRY_DELAY)}function next(ee){ongoingOperations=void 0;const re=bufferedOperations.shift();re&&processSessionStoreOperations(re,ee)}const STORAGE_POLL_DELAY=ONE_SECOND;function selectSessionStoreStrategyType(ee){switch(ee.sessionPersistence){case SessionPersistence.COOKIE:return selectCookieStrategy(ee);case SessionPersistence.LOCAL_STORAGE:return selectLocalStorageStrategy();case void 0:{let re=selectCookieStrategy(ee);return!re&&ee.allowFallbackToLocalStorage&&(re=selectLocalStorageStrategy()),re}default:display.error(`Invalid session persistence '${String(ee.sessionPersistence)}'`)}}function startSessionStore(ee,re,te,ne){const ie=new Observable$1,oe=new Observable$1,se=new Observable$1,ae=ee.type===SessionPersistence.COOKIE?initCookieStrategy(re,ee.cookieOptions):initLocalStorageStrategy(re),{expireSession:ue}=ae,ce=setInterval$1(pe,STORAGE_POLL_DELAY);let le;me();const{throttled:de,cancel:fe}=throttle$2(()=>{processSessionStoreOperations({process:Se=>{if(isSessionInNotStartedState(Se))return;const Oe=ge(Se);return ye(Oe),Oe},after:Se=>{isSessionStarted(Se)&&!ve()&&Ie(Se),le=Se}},ae)},STORAGE_POLL_DELAY);function he(){processSessionStoreOperations({process:Se=>ve()?ge(Se):void 0},ae)}function pe(){processSessionStoreOperations({process:Se=>isSessionInExpiredState(Se)?getExpiredSessionState(Se,re):void 0,after:ge},ae)}function ge(Se){return isSessionInExpiredState(Se)&&(Se=getExpiredSessionState(Se,re)),ve()&&(be(Se)?_e():(se.notify({previousState:le,newState:Se}),le=Se)),Se}function me(){processSessionStoreOperations({process:Se=>{if(isSessionInNotStartedState(Se))return getExpiredSessionState(Se,re)},after:Se=>{le=Se}},ae)}function ye(Se){if(isSessionInNotStartedState(Se))return!1;const{trackingType:Oe,isTracked:Ce}=ne(Se[te]);Se[te]=Oe,delete Se.isExpired,Ce&&!Se.id&&(Se.id=generateUUID(),Se.created=String(dateNow()))}function ve(){return le[te]!==void 0}function be(Se){return le.id!==Se.id||le[te]!==Se[te]}function _e(){le=getExpiredSessionState(le,re),oe.notify()}function Ie(Se){le=Se,ie.notify()}function Te(Se){processSessionStoreOperations({process:Oe=>({...Oe,...Se}),after:ge},ae)}return{expandOrRenewSession:de,expandSession:he,getSession:()=>le,renewObservable:ie,expireObservable:oe,sessionStateUpdateObservable:se,restartSession:me,expire:()=>{fe(),ue(le),ge(getExpiredSessionState(le,re))},stop:()=>{clearInterval$1(ce)},updateSessionState:Te}}const TrackingConsent={GRANTED:"granted",NOT_GRANTED:"not-granted"};function createTrackingConsentState(ee){const re=new Observable$1;return{tryToInit(te){ee||(ee=te)},update(te){ee=te,re.notify()},isGranted(){return ee===TrackingConsent.GRANTED},observable:re}}function jsonStringify(ee,re,te){if(typeof ee!="object"||ee===null)return JSON.stringify(ee);const ne=detachToJsonMethod(Object.prototype),ie=detachToJsonMethod(Array.prototype),oe=detachToJsonMethod(Object.getPrototypeOf(ee)),se=detachToJsonMethod(ee);try{return JSON.stringify(ee,re,te)}catch{return"<error: unable to serialize object>"}finally{ne(),ie(),oe(),se()}}function detachToJsonMethod(ee){const re=ee,te=re.toJSON;return te?(delete re.toJSON,()=>{re.toJSON=te}):noop$2}function normalizeUrl(ee){return buildUrl(ee,location.href).href}function isValidUrl(ee){try{return!!buildUrl(ee)}catch{return!1}}function getPathName(ee){const re=buildUrl(ee).pathname;return re[0]==="/"?re:`/${re}`}function buildUrl(ee,re){const te=getSupportedUrl();if(te)try{return re!==void 0?new te(ee,re):new te(ee)}catch(oe){throw new Error(`Failed to construct URL: ${String(oe)} ${jsonStringify({url:ee,base:re})}`)}if(re===void 0&&!/:/.test(ee))throw new Error(`Invalid URL: '${ee}'`);let ne=document;const ie=ne.createElement("a");if(re!==void 0){ne=document.implementation.createHTMLDocument("");const oe=ne.createElement("base");oe.href=re,ne.head.appendChild(oe),ne.body.appendChild(ie)}return ie.href=ee,ie}const originalURL=URL;let isURLSupported;function getSupportedUrl(){if(isURLSupported===void 0)try{isURLSupported=new originalURL("http://test/path").href==="http://test/path"}catch{isURLSupported=!1}return isURLSupported?originalURL:void 0}const INTAKE_SITE_STAGING="datad0g.com",INTAKE_SITE_FED_STAGING="dd0g-gov.com",INTAKE_SITE_US1="datadoghq.com",INTAKE_SITE_EU1="datadoghq.eu",INTAKE_SITE_US1_FED="ddog-gov.com",PCI_INTAKE_HOST_US1="pci.browser-intake-datadoghq.com",INTAKE_URL_PARAMETERS=["ddsource","ddtags"];function createEndpointBuilder(ee,re,te){const ne=createEndpointUrlWithParametersBuilder(ee,re);return{build(ie,oe){const se=buildEndpointParameters(ee,re,te,ie,oe);return ne(se)},tags:te,urlPrefix:ne(""),trackType:re}}function createEndpointUrlWithParametersBuilder(ee,re){const te=`/api/v2/${re}`,ne=ee.proxy;if(typeof ne=="string"){const oe=normalizeUrl(ne);return se=>`${oe}?ddforward=${encodeURIComponent(`${te}?${se}`)}`}if(typeof ne=="function")return oe=>ne({path:te,parameters:oe});const ie=buildEndpointHost(re,ee);return oe=>`https://${ie}${te}?${oe}`}function buildEndpointHost(ee,re){const{site:te=INTAKE_SITE_US1,internalAnalyticsSubdomain:ne}=re;if(ee==="logs"&&re.usePciIntake&&te===INTAKE_SITE_US1)return PCI_INTAKE_HOST_US1;if(ne&&te===INTAKE_SITE_US1)return`${ne}.${INTAKE_SITE_US1}`;if(te===INTAKE_SITE_FED_STAGING)return`http-intake.logs.${te}`;const ie=te.split("."),oe=ie.pop();return`browser-intake-${ie.join("-")}.${oe}`}function buildEndpointParameters({clientToken:ee,internalAnalyticsSubdomain:re},te,ne,ie,{retry:oe,encoding:se}){const ae=["sdk_version:6.6.3",`api:${ie}`].concat(ne);oe&&ae.push(`retry_count:${oe.count}`,`retry_after:${oe.lastFailureStatus}`);const ue=["ddsource=browser",`ddtags=${encodeURIComponent(ae.join(","))}`,`dd-api-key=${ee}`,`dd-evp-origin-version=${encodeURIComponent("6.6.3")}`,"dd-evp-origin=browser",`dd-request-id=${generateUUID()}`];return se&&ue.push(`dd-evp-encoding=${se}`),te==="rum"&&ue.push(`batch_time=${timeStampNow()}`),re&&ue.reverse(),ue.join("&")}const TAG_SIZE_LIMIT=200;function buildTags(ee){const{env:re,service:te,version:ne,datacenter:ie}=ee,oe=[];return re&&oe.push(buildTag("env",re)),te&&oe.push(buildTag("service",te)),ne&&oe.push(buildTag("version",ne)),ie&&oe.push(buildTag("datacenter",ie)),oe}function buildTag(ee,re){const te=TAG_SIZE_LIMIT-ee.length-1;(re.length>te||hasForbiddenCharacters(re))&&display.warn(`${ee} value doesn't meet tag requirements and will be sanitized. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/tagging/#defining-tags`);const ne=re.replace(/,/g,"_");return`${ee}:${ne}`}function hasForbiddenCharacters(ee){return supportUnicodePropertyEscapes()?new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]","u").test(ee):!1}function supportUnicodePropertyEscapes(){try{return new RegExp("[\\p{Ll}]","u"),!0}catch{return!1}}function computeTransportConfiguration(ee){const re=ee.site||INTAKE_SITE_US1,te=buildTags(ee),ne=computeEndpointBuilders(ee,te);return{replica:computeReplicaConfiguration(ee,te),site:re,...ne}}function computeEndpointBuilders(ee,re){return{logsEndpointBuilder:createEndpointBuilder(ee,"logs",re),rumEndpointBuilder:createEndpointBuilder(ee,"rum",re),profilingEndpointBuilder:createEndpointBuilder(ee,"profile",re),sessionReplayEndpointBuilder:createEndpointBuilder(ee,"replay",re)}}function computeReplicaConfiguration(ee,re){if(!ee.replica)return;const te={...ee,site:INTAKE_SITE_US1,clientToken:ee.replica.clientToken},ne={logsEndpointBuilder:createEndpointBuilder(te,"logs",re),rumEndpointBuilder:createEndpointBuilder(te,"rum",re)};return{applicationId:ee.replica.applicationId,...ne}}function isIntakeUrl(ee){return INTAKE_URL_PARAMETERS.every(re=>ee.includes(re))}const DefaultPrivacyLevel={ALLOW:"allow",MASK:"mask",MASK_USER_INPUT:"mask-user-input"},TraceContextInjection={ALL:"all",SAMPLED:"sampled"};function isString$1(ee,re){return ee!=null&&typeof ee!="string"?(display.error(`${re} must be defined as a string`),!1):!0}function isDatadogSite(ee){return ee&&typeof ee=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(ee)?(display.error(`Site should be a valid Datadog site. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/site/.`),!1):!0}function isSampleRate(ee,re){return ee!==void 0&&!isPercentage(ee)?(display.error(`${re} Sample Rate should be a number between 0 and 100`),!1):!0}function validateAndBuildConfiguration(ee){var re,te,ne,ie,oe,se;if(!ee||!ee.clientToken){display.error("Client Token is not configured, we will not send any data.");return}if(!(!isDatadogSite(ee.site)||!isSampleRate(ee.sessionSampleRate,"Session")||!isSampleRate(ee.telemetrySampleRate,"Telemetry")||!isSampleRate(ee.telemetryConfigurationSampleRate,"Telemetry Configuration")||!isSampleRate(ee.telemetryUsageSampleRate,"Telemetry Usage")||!isString$1(ee.version,"Version")||!isString$1(ee.env,"Env")||!isString$1(ee.service,"Service"))){if(ee.trackingConsent!==void 0&&!objectHasValue(TrackingConsent,ee.trackingConsent)){display.error('Tracking Consent should be either "granted" or "not-granted"');return}return{beforeSend:ee.beforeSend&&catchUserErrors(ee.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:selectSessionStoreStrategyType(ee),sessionSampleRate:(re=ee.sessionSampleRate)!==null&&re!==void 0?re:100,telemetrySampleRate:(te=ee.telemetrySampleRate)!==null&&te!==void 0?te:20,telemetryConfigurationSampleRate:(ne=ee.telemetryConfigurationSampleRate)!==null&&ne!==void 0?ne:5,telemetryUsageSampleRate:(ie=ee.telemetryUsageSampleRate)!==null&&ie!==void 0?ie:5,service:ee.service||void 0,silentMultipleInit:!!ee.silentMultipleInit,allowUntrustedEvents:!!ee.allowUntrustedEvents,trackingConsent:(oe=ee.trackingConsent)!==null&&oe!==void 0?oe:TrackingConsent.GRANTED,trackAnonymousUser:(se=ee.trackAnonymousUser)!==null&&se!==void 0?se:!0,storeContextsAcrossPages:!!ee.storeContextsAcrossPages,batchBytesLimit:16*ONE_KIBI_BYTE,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*ONE_SECOND,batchMessagesLimit:50,messageBytesLimit:256*ONE_KIBI_BYTE,...computeTransportConfiguration(ee)}}}function serializeConfiguration(ee){return{session_sample_rate:ee.sessionSampleRate,telemetry_sample_rate:ee.telemetrySampleRate,telemetry_configuration_sample_rate:ee.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:ee.telemetryUsageSampleRate,use_before_send:!!ee.beforeSend,use_partitioned_cross_site_session_cookie:ee.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:ee.useSecureSessionCookie,use_proxy:!!ee.proxy,silent_multiple_init:ee.silentMultipleInit,track_session_across_subdomains:ee.trackSessionAcrossSubdomains,track_anonymous_user:ee.trackAnonymousUser,session_persistence:ee.sessionPersistence,allow_fallback_to_local_storage:!!ee.allowFallbackToLocalStorage,store_contexts_across_pages:!!ee.storeContextsAcrossPages,allow_untrusted_events:!!ee.allowUntrustedEvents,tracking_consent:ee.trackingConsent}}var ExperimentalFeature;(function(ee){ee.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",ee.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry",ee.USER_ACCOUNT_TRACE_HEADER="user_account_trace_header",ee.PROFILING="profiling"})(ExperimentalFeature||(ExperimentalFeature={}));const enabledExperimentalFeatures=new Set;function initFeatureFlags(ee){Array.isArray(ee)&&addExperimentalFeatures(ee.filter(re=>objectHasValue(ExperimentalFeature,re)))}function addExperimentalFeatures(ee){ee.forEach(re=>{enabledExperimentalFeatures.add(re)})}function isExperimentalFeatureEnabled(ee){return enabledExperimentalFeatures.has(ee)}function getExperimentalFeatures(){return enabledExperimentalFeatures}const UNKNOWN_FUNCTION="?";function computeStackTrace(ee){const re=[];let te=tryToGetString(ee,"stack");const ne=String(ee);return te&&te.startsWith(ne)&&(te=te.slice(ne.length)),te&&te.split(`
|
|
152
|
+
`;class LoadingSuccess extends Component{constructor({text:re,delay:te,onSuccess:ne}){super({tag:"div",styles:()=>getLoadingSuccessStyles()});const ie=new Loading({size:12,color:ThemeManager.getStyles().textPrimaryColor}).element,oe=new Typography({text:re??AstroPayI18n.translate("almost_done"),size:"xSmall"}).element;this.element.append(ie,oe),setTimeout(()=>{ne(),this.element.remove()},te??5e3)}}const RUNTIME_CONFIG={test:{NAME:"@astropay/payments-lib",VERSION:"2.0.14",MODE:"test",API_BASE_URL:"https://partners-api-tst.astropay.com/api",RESOURCES_BUCKET:"https://rs-tst.astropay.com",CHECKOUT_URL:"https://checkout-tst.astropay.com",SINGULAR_LINK_URL:"https://astropay-tst.sng.link/Eftaj/ovlnu?_smtype=3",SINGULAR_LINK_PREFIX:"apcmobiletst://"},sandbox:{NAME:"@astropay/payments-lib",VERSION:"2.0.14",MODE:"staging",API_BASE_URL:"https://partners-api-sandbox.astropay.com/api",RESOURCES_BUCKET:"https://rs-tst.astropay.com",CHECKOUT_URL:"https://checkout-sandbox.astropay.com",SINGULAR_LINK_URL:"https://astropay-stg.sng.link/Ezzoz/nfnj?_smtype=3",SINGULAR_LINK_PREFIX:"apcmobilestaging://"},production:{NAME:"@astropay/payments-lib",VERSION:"2.0.14",MODE:"production",API_BASE_URL:"https://partners-api.astropay.com/api",RESOURCES_BUCKET:"https://rs.astropay.com",CHECKOUT_URL:"https://checkout.astropay.com",SINGULAR_LINK_URL:"https://astropay.sng.link/E2h2a/jqze?_smtype=3",SINGULAR_LINK_PREFIX:"apcmobile://"}};var EStorageKey=(ee=>(ee.SESSION_ID="session_id",ee))(EStorageKey||{});const Jr=class Jr{static init(re){const te=validateValue(re==null?void 0:re.environment,[...CONFIG_ENVIRONMENT_VALUES,"test"],"production"),ne=validateValue(re==null?void 0:re.currencyMode,CONFIG_CURRENCY_MODE_VALUES,"iso");Jr.environment=te,Jr.currencyMode=ne}static getRuntimeConfig(){const re=Jr.environment||"production";return RUNTIME_CONFIG[re]}static getEnvironment(){return Jr.environment}static getCurrencyMode(){return Jr.currencyMode}};xe(Jr,"environment"),xe(Jr,"currencyMode");let AstroPayConfig=Jr;const ConsoleApiName={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},globalConsole=console,originalConsoleMethods={};Object.keys(ConsoleApiName).forEach(ee=>{originalConsoleMethods[ee]=globalConsole[ee]});const PREFIX$1="Datadog Browser SDK:",display={debug:originalConsoleMethods.debug.bind(globalConsole,PREFIX$1),log:originalConsoleMethods.log.bind(globalConsole,PREFIX$1),info:originalConsoleMethods.info.bind(globalConsole,PREFIX$1),warn:originalConsoleMethods.warn.bind(globalConsole,PREFIX$1),error:originalConsoleMethods.error.bind(globalConsole,PREFIX$1)},DOCS_ORIGIN="https://docs.datadoghq.com",DOCS_TROUBLESHOOTING=`${DOCS_ORIGIN}/real_user_monitoring/browser/troubleshooting`,MORE_DETAILS="More details:";function catchUserErrors(ee,re){return(...te)=>{try{return ee(...te)}catch(ne){display.error(re,ne)}}}function performDraw(ee){return ee!==0&&Math.random()*100<=ee}function round(ee,re){return+ee.toFixed(re)}function isPercentage(ee){return isNumber$1(ee)&&ee>=0&&ee<=100}function isNumber$1(ee){return typeof ee=="number"}const ONE_SECOND=1e3,ONE_MINUTE=60*ONE_SECOND,ONE_HOUR=60*ONE_MINUTE,ONE_DAY=24*ONE_HOUR,ONE_YEAR=365*ONE_DAY;function relativeToClocks(ee){return{relative:ee,timeStamp:getCorrectedTimeStamp(ee)}}function timeStampToClocks(ee){return{relative:getRelativeTime(ee),timeStamp:ee}}function getCorrectedTimeStamp(ee){const re=dateNow()-performance.now();return re>getNavigationStart()?Math.round(addDuration(re,ee)):getTimeStamp(ee)}function currentDrift(){return Math.round(dateNow()-addDuration(getNavigationStart(),performance.now()))}function toServerDuration(ee){return isNumber$1(ee)?round(ee*1e6,0):ee}function dateNow(){return new Date().getTime()}function timeStampNow(){return dateNow()}function relativeNow(){return performance.now()}function clocksNow(){return{relative:relativeNow(),timeStamp:timeStampNow()}}function clocksOrigin(){return{relative:0,timeStamp:getNavigationStart()}}function elapsed(ee,re){return re-ee}function addDuration(ee,re){return ee+re}function getRelativeTime(ee){return ee-getNavigationStart()}function getTimeStamp(ee){return Math.round(addDuration(getNavigationStart(),ee))}function looksLikeRelativeTime(ee){return ee<ONE_YEAR}let navigationStart;function getNavigationStart(){return navigationStart===void 0&&(navigationStart=performance.timing.navigationStart),navigationStart}const ONE_KIBI_BYTE=1024,ONE_MEBI_BYTE=1024*ONE_KIBI_BYTE,HAS_MULTI_BYTES_CHARACTERS=/[^\u0000-\u007F]/;function computeBytesCount(ee){return HAS_MULTI_BYTES_CHARACTERS.test(ee)?window.TextEncoder!==void 0?new TextEncoder().encode(ee).length:new Blob([ee]).size:ee.length}function concatBuffers(ee){const re=ee.reduce((ie,oe)=>ie+oe.length,0),te=new Uint8Array(re);let ne=0;for(const ie of ee)te.set(ie,ne),ne+=ie.length;return te}function shallowClone(ee){return{...ee}}function objectHasValue(ee,re){return Object.keys(ee).some(te=>ee[te]===re)}function isEmptyObject$1(ee){return Object.keys(ee).length===0}function mapValues(ee,re){const te={};for(const ne of Object.keys(ee))te[ne]=re(ee[ne]);return te}function getGlobalObject(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let ee=_dd_temp_;return delete Object.prototype._dd_temp_,typeof ee!="object"&&(typeof self=="object"?ee=self:typeof window=="object"?ee=window:ee={}),ee}function getZoneJsOriginalValue(ee,re){const te=getGlobalObject();let ne;return te.Zone&&typeof te.Zone.__symbol__=="function"&&(ne=ee[te.Zone.__symbol__(re)]),ne||(ne=ee[re]),ne}let onMonitorErrorCollected,debugMode=!1;function startMonitorErrorCollection(ee){onMonitorErrorCollected=ee}function setDebugMode(ee){debugMode=ee}function monitor(ee){return function(){return callMonitored(ee,this,arguments)}}function callMonitored(ee,re,te){try{return ee.apply(re,te)}catch(ne){monitorError(ne)}}function monitorError(ee){if(displayIfDebugEnabled(ee),onMonitorErrorCollected)try{onMonitorErrorCollected(ee)}catch(re){displayIfDebugEnabled(re)}}function displayIfDebugEnabled(...ee){debugMode&&display.error("[MONITOR]",...ee)}function setTimeout$1(ee,re){return getZoneJsOriginalValue(getGlobalObject(),"setTimeout")(monitor(ee),re)}function clearTimeout$1(ee){getZoneJsOriginalValue(getGlobalObject(),"clearTimeout")(ee)}function setInterval$1(ee,re){return getZoneJsOriginalValue(getGlobalObject(),"setInterval")(monitor(ee),re)}function clearInterval$1(ee){getZoneJsOriginalValue(getGlobalObject(),"clearInterval")(ee)}let Observable$1=class{constructor(re){this.onFirstSubscribe=re,this.observers=[]}subscribe(re){return this.observers.push(re),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0),{unsubscribe:()=>{this.observers=this.observers.filter(te=>re!==te),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}}notify(re){this.observers.forEach(te=>te(re))}};function mergeObservables(...ee){return new Observable$1(re=>{const te=ee.map(ne=>ne.subscribe(ie=>re.notify(ie)));return()=>te.forEach(ne=>ne.unsubscribe())})}function throttle$2(ee,re,te){const ne=te&&te.leading!==void 0?te.leading:!0,ie=te&&te.trailing!==void 0?te.trailing:!0;let oe=!1,se,ae;return{throttled:(...ue)=>{if(oe){se=ue;return}ne?ee(...ue):se=ue,oe=!0,ae=setTimeout$1(()=>{ie&&se&&ee(...se),oe=!1,se=void 0},re)},cancel:()=>{clearTimeout$1(ae),oe=!1,se=void 0}}}function noop$2(){}function generateUUID(ee){return ee?(parseInt(ee,10)^Math.random()*16>>parseInt(ee,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,generateUUID)}const COMMA_SEPARATED_KEY_VALUE=/([\w-]+)\s*=\s*([^;]+)/g;function findCommaSeparatedValue(ee,re){for(COMMA_SEPARATED_KEY_VALUE.lastIndex=0;;){const te=COMMA_SEPARATED_KEY_VALUE.exec(ee);if(te){if(te[1]===re)return te[2]}else break}}function findCommaSeparatedValues(ee){const re=new Map;for(COMMA_SEPARATED_KEY_VALUE.lastIndex=0;;){const te=COMMA_SEPARATED_KEY_VALUE.exec(ee);if(te)re.set(te[1],te[2]);else break}return re}function safeTruncate(ee,re,te=""){const ne=ee.charCodeAt(re-1),oe=ne>=55296&&ne<=56319?re+1:re;return ee.length<=oe?ee:`${ee.slice(0,oe)}${te}`}function isChromium(){return detectBrowserCached()===0}function isSafari(){return detectBrowserCached()===1}let browserCache;function detectBrowserCached(){return browserCache??(browserCache=detectBrowser())}function detectBrowser(ee=window){var re;const te=ee.navigator.userAgent;return ee.chrome||/HeadlessChrome/.test(te)?0:((re=ee.navigator.vendor)===null||re===void 0?void 0:re.indexOf("Apple"))===0||/safari/i.test(te)&&!/chrome|android/i.test(te)?1:2}function setCookie(ee,re,te=0,ne){const ie=new Date;ie.setTime(ie.getTime()+te);const oe=`expires=${ie.toUTCString()}`,se=ne&&ne.crossSite?"none":"strict",ae=ne&&ne.domain?`;domain=${ne.domain}`:"",ue=ne&&ne.secure?";secure":"",ce=ne&&ne.partitioned?";partitioned":"";document.cookie=`${ee}=${re};${oe};path=/;samesite=${se}${ae}${ue}${ce}`}function getCookie(ee){return findCommaSeparatedValue(document.cookie,ee)}let initCookieParsed;function getInitCookie(ee){return initCookieParsed||(initCookieParsed=findCommaSeparatedValues(document.cookie)),initCookieParsed.get(ee)}function deleteCookie(ee,re){setCookie(ee,"",0,re)}function areCookiesAuthorized(ee){if(document.cookie===void 0||document.cookie===null)return!1;try{const re=`dd_cookie_test_${generateUUID()}`,te="test";setCookie(re,te,ONE_MINUTE,ee);const ne=getCookie(re)===te;return deleteCookie(re,ee),ne}catch(re){return display.error(re),!1}}let getCurrentSiteCache;function getCurrentSite(){if(getCurrentSiteCache===void 0){const ee=`dd_site_test_${generateUUID()}`,re="test",te=window.location.hostname.split(".");let ne=te.pop();for(;te.length&&!getCookie(ee);)ne=`${te.pop()}.${ne}`,setCookie(ee,re,ONE_SECOND,{domain:ne});deleteCookie(ee,{domain:ne}),getCurrentSiteCache=ne}return getCurrentSiteCache}const SESSION_STORE_KEY="_dd_s";function findLast(ee,re){for(let te=ee.length-1;te>=0;te-=1){const ne=ee[te];if(re(ne,te,ee))return ne}}function objectValues(ee){return Object.values(ee)}function objectEntries(ee){return Object.entries(ee)}const SESSION_TIME_OUT_DELAY=4*ONE_HOUR,SESSION_EXPIRATION_DELAY=15*ONE_MINUTE,SESSION_COOKIE_EXPIRATION_DELAY=ONE_YEAR,SessionPersistence={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},SESSION_ENTRY_REGEXP=/^([a-zA-Z]+)=([a-z0-9-]+)$/,SESSION_ENTRY_SEPARATOR="&";function isValidSessionString(ee){return!!ee&&(ee.indexOf(SESSION_ENTRY_SEPARATOR)!==-1||SESSION_ENTRY_REGEXP.test(ee))}const EXPIRED="1";function getExpiredSessionState(ee,re){const te={isExpired:EXPIRED};return re.trackAnonymousUser&&(ee!=null&&ee.anonymousId?te.anonymousId=ee==null?void 0:ee.anonymousId:te.anonymousId=generateUUID()),te}function isSessionInNotStartedState(ee){return isEmptyObject$1(ee)}function isSessionStarted(ee){return!isSessionInNotStartedState(ee)}function isSessionInExpiredState(ee){return ee.isExpired!==void 0||!isActiveSession(ee)}function isActiveSession(ee){return(ee.created===void 0||dateNow()-Number(ee.created)<SESSION_TIME_OUT_DELAY)&&(ee.expire===void 0||dateNow()<Number(ee.expire))}function expandSessionState(ee){ee.expire=String(dateNow()+SESSION_EXPIRATION_DELAY)}function toSessionString(ee){return objectEntries(ee).map(([re,te])=>re==="anonymousId"?`aid=${te}`:`${re}=${te}`).join(SESSION_ENTRY_SEPARATOR)}function toSessionState(ee){const re={};return isValidSessionString(ee)&&ee.split(SESSION_ENTRY_SEPARATOR).forEach(te=>{const ne=SESSION_ENTRY_REGEXP.exec(te);if(ne!==null){const[,ie,oe]=ne;ie==="aid"?re.anonymousId=oe:re[ie]=oe}}),re}const OLD_SESSION_COOKIE_NAME="_dd",OLD_RUM_COOKIE_NAME="_dd_r",OLD_LOGS_COOKIE_NAME="_dd_l",RUM_SESSION_KEY$1="rum",LOGS_SESSION_KEY="logs";function tryOldCookiesMigration(ee){if(!getInitCookie(SESSION_STORE_KEY)){const te=getInitCookie(OLD_SESSION_COOKIE_NAME),ne=getInitCookie(OLD_RUM_COOKIE_NAME),ie=getInitCookie(OLD_LOGS_COOKIE_NAME),oe={};te&&(oe.id=te),ie&&/^[01]$/.test(ie)&&(oe[LOGS_SESSION_KEY]=ie),ne&&/^[012]$/.test(ne)&&(oe[RUM_SESSION_KEY$1]=ne),isSessionStarted(oe)&&(expandSessionState(oe),ee.persistSession(oe))}}function selectCookieStrategy(ee){const re=buildCookieOptions(ee);return areCookiesAuthorized(re)?{type:SessionPersistence.COOKIE,cookieOptions:re}:void 0}function initCookieStrategy(ee,re){const te={isLockEnabled:isChromium(),persistSession:persistSessionCookie(re),retrieveSession:retrieveSessionCookie,expireSession:ne=>expireSessionCookie(re,ne,ee)};return tryOldCookiesMigration(te),te}function persistSessionCookie(ee){return re=>{setCookie(SESSION_STORE_KEY,toSessionString(re),SESSION_EXPIRATION_DELAY,ee)}}function expireSessionCookie(ee,re,te){const ne=getExpiredSessionState(re,te);setCookie(SESSION_STORE_KEY,toSessionString(ne),te.trackAnonymousUser?SESSION_COOKIE_EXPIRATION_DELAY:SESSION_TIME_OUT_DELAY,ee)}function retrieveSessionCookie(){const ee=getCookie(SESSION_STORE_KEY);return toSessionState(ee)}function buildCookieOptions(ee){const re={};return re.secure=!!ee.useSecureSessionCookie||!!ee.usePartitionedCrossSiteSessionCookie,re.crossSite=!!ee.usePartitionedCrossSiteSessionCookie,re.partitioned=!!ee.usePartitionedCrossSiteSessionCookie,ee.trackSessionAcrossSubdomains&&(re.domain=getCurrentSite()),re}const LOCAL_STORAGE_TEST_KEY="_dd_test_";function selectLocalStorageStrategy(){try{const ee=generateUUID(),re=`${LOCAL_STORAGE_TEST_KEY}${ee}`;localStorage.setItem(re,ee);const te=localStorage.getItem(re);return localStorage.removeItem(re),ee===te?{type:SessionPersistence.LOCAL_STORAGE}:void 0}catch{return}}function initLocalStorageStrategy(ee){return{isLockEnabled:!1,persistSession:persistInLocalStorage,retrieveSession:retrieveSessionFromLocalStorage,expireSession:re=>expireSessionFromLocalStorage(re,ee)}}function persistInLocalStorage(ee){localStorage.setItem(SESSION_STORE_KEY,toSessionString(ee))}function retrieveSessionFromLocalStorage(){const ee=localStorage.getItem(SESSION_STORE_KEY);return toSessionState(ee)}function expireSessionFromLocalStorage(ee,re){persistInLocalStorage(getExpiredSessionState(ee,re))}const LOCK_RETRY_DELAY=10,LOCK_MAX_TRIES=100,bufferedOperations=[];let ongoingOperations;function processSessionStoreOperations(ee,re,te=0){var ne;const{isLockEnabled:ie,persistSession:oe,expireSession:se}=re,ae=fe=>oe({...fe,lock:ce}),ue=()=>{const fe=re.retrieveSession(),he=fe.lock;return fe.lock&&delete fe.lock,{session:fe,lock:he}};if(ongoingOperations||(ongoingOperations=ee),ee!==ongoingOperations){bufferedOperations.push(ee);return}if(ie&&te>=LOCK_MAX_TRIES){next(re);return}let ce,le=ue();if(ie){if(le.lock){retryLater(ee,re,te);return}if(ce=generateUUID(),ae(le.session),le=ue(),le.lock!==ce){retryLater(ee,re,te);return}}let de=ee.process(le.session);if(ie&&(le=ue(),le.lock!==ce)){retryLater(ee,re,te);return}if(de&&(isSessionInExpiredState(de)?se(de):(expandSessionState(de),ie?ae(de):oe(de))),ie&&!(de&&isSessionInExpiredState(de))){if(le=ue(),le.lock!==ce){retryLater(ee,re,te);return}oe(le.session),de=le.session}(ne=ee.after)===null||ne===void 0||ne.call(ee,de||le.session),next(re)}function retryLater(ee,re,te){setTimeout$1(()=>{processSessionStoreOperations(ee,re,te+1)},LOCK_RETRY_DELAY)}function next(ee){ongoingOperations=void 0;const re=bufferedOperations.shift();re&&processSessionStoreOperations(re,ee)}const STORAGE_POLL_DELAY=ONE_SECOND;function selectSessionStoreStrategyType(ee){switch(ee.sessionPersistence){case SessionPersistence.COOKIE:return selectCookieStrategy(ee);case SessionPersistence.LOCAL_STORAGE:return selectLocalStorageStrategy();case void 0:{let re=selectCookieStrategy(ee);return!re&&ee.allowFallbackToLocalStorage&&(re=selectLocalStorageStrategy()),re}default:display.error(`Invalid session persistence '${String(ee.sessionPersistence)}'`)}}function startSessionStore(ee,re,te,ne){const ie=new Observable$1,oe=new Observable$1,se=new Observable$1,ae=ee.type===SessionPersistence.COOKIE?initCookieStrategy(re,ee.cookieOptions):initLocalStorageStrategy(re),{expireSession:ue}=ae,ce=setInterval$1(pe,STORAGE_POLL_DELAY);let le;me();const{throttled:de,cancel:fe}=throttle$2(()=>{processSessionStoreOperations({process:Se=>{if(isSessionInNotStartedState(Se))return;const Oe=ge(Se);return ye(Oe),Oe},after:Se=>{isSessionStarted(Se)&&!ve()&&Ie(Se),le=Se}},ae)},STORAGE_POLL_DELAY);function he(){processSessionStoreOperations({process:Se=>ve()?ge(Se):void 0},ae)}function pe(){processSessionStoreOperations({process:Se=>isSessionInExpiredState(Se)?getExpiredSessionState(Se,re):void 0,after:ge},ae)}function ge(Se){return isSessionInExpiredState(Se)&&(Se=getExpiredSessionState(Se,re)),ve()&&(be(Se)?_e():(se.notify({previousState:le,newState:Se}),le=Se)),Se}function me(){processSessionStoreOperations({process:Se=>{if(isSessionInNotStartedState(Se))return getExpiredSessionState(Se,re)},after:Se=>{le=Se}},ae)}function ye(Se){if(isSessionInNotStartedState(Se))return!1;const{trackingType:Oe,isTracked:Ce}=ne(Se[te]);Se[te]=Oe,delete Se.isExpired,Ce&&!Se.id&&(Se.id=generateUUID(),Se.created=String(dateNow()))}function ve(){return le[te]!==void 0}function be(Se){return le.id!==Se.id||le[te]!==Se[te]}function _e(){le=getExpiredSessionState(le,re),oe.notify()}function Ie(Se){le=Se,ie.notify()}function Te(Se){processSessionStoreOperations({process:Oe=>({...Oe,...Se}),after:ge},ae)}return{expandOrRenewSession:de,expandSession:he,getSession:()=>le,renewObservable:ie,expireObservable:oe,sessionStateUpdateObservable:se,restartSession:me,expire:()=>{fe(),ue(le),ge(getExpiredSessionState(le,re))},stop:()=>{clearInterval$1(ce)},updateSessionState:Te}}const TrackingConsent={GRANTED:"granted",NOT_GRANTED:"not-granted"};function createTrackingConsentState(ee){const re=new Observable$1;return{tryToInit(te){ee||(ee=te)},update(te){ee=te,re.notify()},isGranted(){return ee===TrackingConsent.GRANTED},observable:re}}function jsonStringify(ee,re,te){if(typeof ee!="object"||ee===null)return JSON.stringify(ee);const ne=detachToJsonMethod(Object.prototype),ie=detachToJsonMethod(Array.prototype),oe=detachToJsonMethod(Object.getPrototypeOf(ee)),se=detachToJsonMethod(ee);try{return JSON.stringify(ee,re,te)}catch{return"<error: unable to serialize object>"}finally{ne(),ie(),oe(),se()}}function detachToJsonMethod(ee){const re=ee,te=re.toJSON;return te?(delete re.toJSON,()=>{re.toJSON=te}):noop$2}function normalizeUrl(ee){return buildUrl(ee,location.href).href}function isValidUrl(ee){try{return!!buildUrl(ee)}catch{return!1}}function getPathName(ee){const re=buildUrl(ee).pathname;return re[0]==="/"?re:`/${re}`}function buildUrl(ee,re){const te=getSupportedUrl();if(te)try{return re!==void 0?new te(ee,re):new te(ee)}catch(oe){throw new Error(`Failed to construct URL: ${String(oe)} ${jsonStringify({url:ee,base:re})}`)}if(re===void 0&&!/:/.test(ee))throw new Error(`Invalid URL: '${ee}'`);let ne=document;const ie=ne.createElement("a");if(re!==void 0){ne=document.implementation.createHTMLDocument("");const oe=ne.createElement("base");oe.href=re,ne.head.appendChild(oe),ne.body.appendChild(ie)}return ie.href=ee,ie}const originalURL=URL;let isURLSupported;function getSupportedUrl(){if(isURLSupported===void 0)try{isURLSupported=new originalURL("http://test/path").href==="http://test/path"}catch{isURLSupported=!1}return isURLSupported?originalURL:void 0}const INTAKE_SITE_STAGING="datad0g.com",INTAKE_SITE_FED_STAGING="dd0g-gov.com",INTAKE_SITE_US1="datadoghq.com",INTAKE_SITE_EU1="datadoghq.eu",INTAKE_SITE_US1_FED="ddog-gov.com",PCI_INTAKE_HOST_US1="pci.browser-intake-datadoghq.com",INTAKE_URL_PARAMETERS=["ddsource","ddtags"];function createEndpointBuilder(ee,re,te){const ne=createEndpointUrlWithParametersBuilder(ee,re);return{build(ie,oe){const se=buildEndpointParameters(ee,re,te,ie,oe);return ne(se)},tags:te,urlPrefix:ne(""),trackType:re}}function createEndpointUrlWithParametersBuilder(ee,re){const te=`/api/v2/${re}`,ne=ee.proxy;if(typeof ne=="string"){const oe=normalizeUrl(ne);return se=>`${oe}?ddforward=${encodeURIComponent(`${te}?${se}`)}`}if(typeof ne=="function")return oe=>ne({path:te,parameters:oe});const ie=buildEndpointHost(re,ee);return oe=>`https://${ie}${te}?${oe}`}function buildEndpointHost(ee,re){const{site:te=INTAKE_SITE_US1,internalAnalyticsSubdomain:ne}=re;if(ee==="logs"&&re.usePciIntake&&te===INTAKE_SITE_US1)return PCI_INTAKE_HOST_US1;if(ne&&te===INTAKE_SITE_US1)return`${ne}.${INTAKE_SITE_US1}`;if(te===INTAKE_SITE_FED_STAGING)return`http-intake.logs.${te}`;const ie=te.split("."),oe=ie.pop();return`browser-intake-${ie.join("-")}.${oe}`}function buildEndpointParameters({clientToken:ee,internalAnalyticsSubdomain:re},te,ne,ie,{retry:oe,encoding:se}){const ae=["sdk_version:6.6.3",`api:${ie}`].concat(ne);oe&&ae.push(`retry_count:${oe.count}`,`retry_after:${oe.lastFailureStatus}`);const ue=["ddsource=browser",`ddtags=${encodeURIComponent(ae.join(","))}`,`dd-api-key=${ee}`,`dd-evp-origin-version=${encodeURIComponent("6.6.3")}`,"dd-evp-origin=browser",`dd-request-id=${generateUUID()}`];return se&&ue.push(`dd-evp-encoding=${se}`),te==="rum"&&ue.push(`batch_time=${timeStampNow()}`),re&&ue.reverse(),ue.join("&")}const TAG_SIZE_LIMIT=200;function buildTags(ee){const{env:re,service:te,version:ne,datacenter:ie}=ee,oe=[];return re&&oe.push(buildTag("env",re)),te&&oe.push(buildTag("service",te)),ne&&oe.push(buildTag("version",ne)),ie&&oe.push(buildTag("datacenter",ie)),oe}function buildTag(ee,re){const te=TAG_SIZE_LIMIT-ee.length-1;(re.length>te||hasForbiddenCharacters(re))&&display.warn(`${ee} value doesn't meet tag requirements and will be sanitized. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/tagging/#defining-tags`);const ne=re.replace(/,/g,"_");return`${ee}:${ne}`}function hasForbiddenCharacters(ee){return supportUnicodePropertyEscapes()?new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]","u").test(ee):!1}function supportUnicodePropertyEscapes(){try{return new RegExp("[\\p{Ll}]","u"),!0}catch{return!1}}function computeTransportConfiguration(ee){const re=ee.site||INTAKE_SITE_US1,te=buildTags(ee),ne=computeEndpointBuilders(ee,te);return{replica:computeReplicaConfiguration(ee,te),site:re,...ne}}function computeEndpointBuilders(ee,re){return{logsEndpointBuilder:createEndpointBuilder(ee,"logs",re),rumEndpointBuilder:createEndpointBuilder(ee,"rum",re),profilingEndpointBuilder:createEndpointBuilder(ee,"profile",re),sessionReplayEndpointBuilder:createEndpointBuilder(ee,"replay",re)}}function computeReplicaConfiguration(ee,re){if(!ee.replica)return;const te={...ee,site:INTAKE_SITE_US1,clientToken:ee.replica.clientToken},ne={logsEndpointBuilder:createEndpointBuilder(te,"logs",re),rumEndpointBuilder:createEndpointBuilder(te,"rum",re)};return{applicationId:ee.replica.applicationId,...ne}}function isIntakeUrl(ee){return INTAKE_URL_PARAMETERS.every(re=>ee.includes(re))}const DefaultPrivacyLevel={ALLOW:"allow",MASK:"mask",MASK_USER_INPUT:"mask-user-input"},TraceContextInjection={ALL:"all",SAMPLED:"sampled"};function isString$1(ee,re){return ee!=null&&typeof ee!="string"?(display.error(`${re} must be defined as a string`),!1):!0}function isDatadogSite(ee){return ee&&typeof ee=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(ee)?(display.error(`Site should be a valid Datadog site. ${MORE_DETAILS} ${DOCS_ORIGIN}/getting_started/site/.`),!1):!0}function isSampleRate(ee,re){return ee!==void 0&&!isPercentage(ee)?(display.error(`${re} Sample Rate should be a number between 0 and 100`),!1):!0}function validateAndBuildConfiguration(ee){var re,te,ne,ie,oe,se;if(!ee||!ee.clientToken){display.error("Client Token is not configured, we will not send any data.");return}if(!(!isDatadogSite(ee.site)||!isSampleRate(ee.sessionSampleRate,"Session")||!isSampleRate(ee.telemetrySampleRate,"Telemetry")||!isSampleRate(ee.telemetryConfigurationSampleRate,"Telemetry Configuration")||!isSampleRate(ee.telemetryUsageSampleRate,"Telemetry Usage")||!isString$1(ee.version,"Version")||!isString$1(ee.env,"Env")||!isString$1(ee.service,"Service"))){if(ee.trackingConsent!==void 0&&!objectHasValue(TrackingConsent,ee.trackingConsent)){display.error('Tracking Consent should be either "granted" or "not-granted"');return}return{beforeSend:ee.beforeSend&&catchUserErrors(ee.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:selectSessionStoreStrategyType(ee),sessionSampleRate:(re=ee.sessionSampleRate)!==null&&re!==void 0?re:100,telemetrySampleRate:(te=ee.telemetrySampleRate)!==null&&te!==void 0?te:20,telemetryConfigurationSampleRate:(ne=ee.telemetryConfigurationSampleRate)!==null&&ne!==void 0?ne:5,telemetryUsageSampleRate:(ie=ee.telemetryUsageSampleRate)!==null&&ie!==void 0?ie:5,service:ee.service||void 0,silentMultipleInit:!!ee.silentMultipleInit,allowUntrustedEvents:!!ee.allowUntrustedEvents,trackingConsent:(oe=ee.trackingConsent)!==null&&oe!==void 0?oe:TrackingConsent.GRANTED,trackAnonymousUser:(se=ee.trackAnonymousUser)!==null&&se!==void 0?se:!0,storeContextsAcrossPages:!!ee.storeContextsAcrossPages,batchBytesLimit:16*ONE_KIBI_BYTE,eventRateLimiterThreshold:3e3,maxTelemetryEventsPerPage:15,flushTimeout:30*ONE_SECOND,batchMessagesLimit:50,messageBytesLimit:256*ONE_KIBI_BYTE,...computeTransportConfiguration(ee)}}}function serializeConfiguration(ee){return{session_sample_rate:ee.sessionSampleRate,telemetry_sample_rate:ee.telemetrySampleRate,telemetry_configuration_sample_rate:ee.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:ee.telemetryUsageSampleRate,use_before_send:!!ee.beforeSend,use_partitioned_cross_site_session_cookie:ee.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:ee.useSecureSessionCookie,use_proxy:!!ee.proxy,silent_multiple_init:ee.silentMultipleInit,track_session_across_subdomains:ee.trackSessionAcrossSubdomains,track_anonymous_user:ee.trackAnonymousUser,session_persistence:ee.sessionPersistence,allow_fallback_to_local_storage:!!ee.allowFallbackToLocalStorage,store_contexts_across_pages:!!ee.storeContextsAcrossPages,allow_untrusted_events:!!ee.allowUntrustedEvents,tracking_consent:ee.trackingConsent}}var ExperimentalFeature;(function(ee){ee.WRITABLE_RESOURCE_GRAPHQL="writable_resource_graphql",ee.MISSING_URL_CONTEXT_TELEMETRY="missing_url_context_telemetry",ee.USER_ACCOUNT_TRACE_HEADER="user_account_trace_header",ee.PROFILING="profiling"})(ExperimentalFeature||(ExperimentalFeature={}));const enabledExperimentalFeatures=new Set;function initFeatureFlags(ee){Array.isArray(ee)&&addExperimentalFeatures(ee.filter(re=>objectHasValue(ExperimentalFeature,re)))}function addExperimentalFeatures(ee){ee.forEach(re=>{enabledExperimentalFeatures.add(re)})}function isExperimentalFeatureEnabled(ee){return enabledExperimentalFeatures.has(ee)}function getExperimentalFeatures(){return enabledExperimentalFeatures}const UNKNOWN_FUNCTION="?";function computeStackTrace(ee){const re=[];let te=tryToGetString(ee,"stack");const ne=String(ee);return te&&te.startsWith(ne)&&(te=te.slice(ne.length)),te&&te.split(`
|
|
151
153
|
`).forEach(ie=>{const oe=parseChromeLine(ie)||parseChromeAnonymousLine(ie)||parseWinLine(ie)||parseGeckoLine(ie);oe&&(!oe.func&&oe.line&&(oe.func=UNKNOWN_FUNCTION),re.push(oe))}),{message:tryToGetString(ee,"message"),name:tryToGetString(ee,"name"),stack:re}}const fileUrl="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",filePosition="(?::(\\d+))",CHROME_LINE_RE=new RegExp(`^\\s*at (.*?) ?\\(${fileUrl}${filePosition}?${filePosition}?\\)?\\s*$`,"i"),CHROME_EVAL_RE=new RegExp(`\\((\\S*)${filePosition}${filePosition}\\)`);function parseChromeLine(ee){const re=CHROME_LINE_RE.exec(ee);if(!re)return;const te=re[2]&&re[2].indexOf("native")===0,ne=re[2]&&re[2].indexOf("eval")===0,ie=CHROME_EVAL_RE.exec(re[2]);return ne&&ie&&(re[2]=ie[1],re[3]=ie[2],re[4]=ie[3]),{args:te?[re[2]]:[],column:re[4]?+re[4]:void 0,func:re[1]||UNKNOWN_FUNCTION,line:re[3]?+re[3]:void 0,url:te?void 0:re[2]}}const CHROME_ANONYMOUS_FUNCTION_RE=new RegExp(`^\\s*at ?${fileUrl}${filePosition}?${filePosition}??\\s*$`,"i");function parseChromeAnonymousLine(ee){const re=CHROME_ANONYMOUS_FUNCTION_RE.exec(ee);if(re)return{args:[],column:re[3]?+re[3]:void 0,func:UNKNOWN_FUNCTION,line:re[2]?+re[2]:void 0,url:re[1]}}const WINJS_LINE_RE=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function parseWinLine(ee){const re=WINJS_LINE_RE.exec(ee);if(re)return{args:[],column:re[4]?+re[4]:void 0,func:re[1]||UNKNOWN_FUNCTION,line:+re[3],url:re[2]}}const GECKO_LINE_RE=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,GECKO_EVAL_RE=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function parseGeckoLine(ee){const re=GECKO_LINE_RE.exec(ee);if(!re)return;const te=re[3]&&re[3].indexOf(" > eval")>-1,ne=GECKO_EVAL_RE.exec(re[3]);return te&&ne&&(re[3]=ne[1],re[4]=ne[2],re[5]=void 0),{args:re[2]?re[2].split(","):[],column:re[5]?+re[5]:void 0,func:re[1]||UNKNOWN_FUNCTION,line:re[4]?+re[4]:void 0,url:re[3]}}function tryToGetString(ee,re){if(typeof ee!="object"||!ee||!(re in ee))return;const te=ee[re];return typeof te=="string"?te:void 0}function computeStackTraceFromOnErrorMessage(ee,re,te,ne){const ie=[{url:re,column:ne,line:te}],{name:oe,message:se}=tryToParseMessage(ee);return{name:oe,message:se,stack:ie}}const ERROR_TYPES_RE=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function tryToParseMessage(ee){let re,te;return{}.toString.call(ee)==="[object String]"&&([,re,te]=ERROR_TYPES_RE.exec(ee)),{name:re,message:te}}function createHandlingStack(ee){const te=new Error(ee);te.name="HandlingStack";let ne;return callMonitored(()=>{const ie=computeStackTrace(te);ie.stack=ie.stack.slice(2),ne=toStackTraceString(ie)}),ne}function toStackTraceString(ee){let re=formatErrorMessage(ee);return ee.stack.forEach(te=>{const ne=te.func==="?"?"<anonymous>":te.func,ie=te.args&&te.args.length>0?`(${te.args.join(", ")})`:"",oe=te.line?`:${te.line}`:"",se=te.line&&te.column?`:${te.column}`:"";re+=`
|
|
152
154
|
at ${ne}${ie} @ ${te.url}${oe}${se}`}),re}function formatErrorMessage(ee){return`${ee.name||"Error"}: ${ee.message}`}function instrumentMethod(ee,re,te,{computeHandlingStack:ne}={}){let ie=ee[re];if(typeof ie!="function")if(re in ee&&re.startsWith("on"))ie=noop$2;else return{stop:noop$2};let oe=!1;const se=function(){if(oe)return ie.apply(this,arguments);const ae=Array.from(arguments);let ue;callMonitored(te,null,[{target:this,parameters:ae,onPostCall:le=>{ue=le},handlingStack:ne?createHandlingStack("instrumented method"):void 0}]);const ce=ie.apply(this,ae);return ue&&callMonitored(ue,null,[ce]),ce};return ee[re]=se,{stop:()=>{oe=!0,ee[re]===se&&(ee[re]=ie)}}}function instrumentSetter(ee,re,te){const ne=Object.getOwnPropertyDescriptor(ee,re);if(!ne||!ne.set||!ne.configurable)return{stop:noop$2};const ie=noop$2;let oe=(ae,ue)=>{setTimeout$1(()=>{oe!==ie&&te(ae,ue)},0)};const se=function(ae){ne.set.call(this,ae),oe(this,ae)};return Object.defineProperty(ee,re,{set:se}),{stop:()=>{var ae;((ae=Object.getOwnPropertyDescriptor(ee,re))===null||ae===void 0?void 0:ae.set)===se&&Object.defineProperty(ee,re,ne),oe=ie}}}const SANITIZE_DEFAULT_MAX_CHARACTER_COUNT=220*ONE_KIBI_BYTE,JSON_PATH_ROOT_ELEMENT="$",KEY_DECORATION_LENGTH=3;function sanitize(ee,re=SANITIZE_DEFAULT_MAX_CHARACTER_COUNT){const te=detachToJsonMethod(Object.prototype),ne=detachToJsonMethod(Array.prototype),ie=[],oe=new WeakMap,se=sanitizeProcessor(ee,JSON_PATH_ROOT_ELEMENT,void 0,ie,oe),ae=JSON.stringify(se);let ue=ae?ae.length:0;if(ue>re){warnOverCharacterLimit(re,"discarded",ee);return}for(;ie.length>0&&ue<re;){const ce=ie.shift();let le=0;if(Array.isArray(ce.source))for(let de=0;de<ce.source.length;de++){const fe=sanitizeProcessor(ce.source[de],ce.path,de,ie,oe);if(fe!==void 0?ue+=JSON.stringify(fe).length:ue+=4,ue+=le,le=1,ue>re){warnOverCharacterLimit(re,"truncated",ee);break}ce.target[de]=fe}else for(const de in ce.source)if(Object.prototype.hasOwnProperty.call(ce.source,de)){const fe=sanitizeProcessor(ce.source[de],ce.path,de,ie,oe);if(fe!==void 0&&(ue+=JSON.stringify(fe).length+le+de.length+KEY_DECORATION_LENGTH,le=1),ue>re){warnOverCharacterLimit(re,"truncated",ee);break}ce.target[de]=fe}}return te(),ne(),se}function sanitizeProcessor(ee,re,te,ne,ie){const oe=tryToApplyToJSON(ee);if(!oe||typeof oe!="object")return sanitizePrimitivesAndFunctions(oe);const se=sanitizeObjects(oe);if(se!=="[Object]"&&se!=="[Array]"&&se!=="[Error]")return se;const ae=ee;if(ie.has(ae))return`[Reference seen at ${ie.get(ae)}]`;const ue=te!==void 0?`${re}.${te}`:re,ce=Array.isArray(oe)?[]:{};return ie.set(ae,ue),ne.push({source:oe,target:ce,path:ue}),ce}function sanitizePrimitivesAndFunctions(ee){return typeof ee=="bigint"?`[BigInt] ${ee.toString()}`:typeof ee=="function"?`[Function] ${ee.name||"unknown"}`:typeof ee=="symbol"?`[Symbol] ${ee.description||ee.toString()}`:ee}function sanitizeObjects(ee){try{if(ee instanceof Event)return sanitizeEvent(ee);if(ee instanceof RegExp)return`[RegExp] ${ee.toString()}`;const te=Object.prototype.toString.call(ee).match(/\[object (.*)\]/);if(te&&te[1])return`[${te[1]}]`}catch{}return"[Unserializable]"}function sanitizeEvent(ee){return{type:ee.type,isTrusted:ee.isTrusted,currentTarget:ee.currentTarget?sanitizeObjects(ee.currentTarget):null,target:ee.target?sanitizeObjects(ee.target):null}}function tryToApplyToJSON(ee){const re=ee;if(re&&typeof re.toJSON=="function")try{return re.toJSON()}catch{}return ee}function warnOverCharacterLimit(ee,re,te){display.warn(`The data provided has been ${re} as it is over the limit of ${ee} characters:`,te)}const NO_ERROR_STACK_PRESENT_MESSAGE="No stack, consider using an instance of Error";function computeRawError({stackTrace:ee,originalError:re,handlingStack:te,componentStack:ne,startClocks:ie,nonErrorPrefix:oe,source:se,handling:ae}){const ue=isError(re),ce=computeMessage(ee,ue,oe,re),le=hasUsableStack(ue,ee)?toStackTraceString(ee):NO_ERROR_STACK_PRESENT_MESSAGE,de=ue?flattenErrorCauses(re,se):void 0,fe=ee?ee.name:void 0,he=tryToGetFingerprint(re),pe=tryToGetErrorContext(re);return{startClocks:ie,source:se,handling:ae,handlingStack:te,componentStack:ne,originalError:re,type:fe,message:ce,stack:le,causes:de,fingerprint:he,context:pe}}function computeMessage(ee,re,te,ne){return ee!=null&&ee.message&&(ee!=null&&ee.name)?ee.message:re?"Empty message":`${te} ${jsonStringify(sanitize(ne))}`}function hasUsableStack(ee,re){return re===void 0?!1:ee?!0:re.stack.length>0&&(re.stack.length>1||re.stack[0].url!==void 0)}function tryToGetFingerprint(ee){return isError(ee)&&"dd_fingerprint"in ee?String(ee.dd_fingerprint):void 0}function tryToGetErrorContext(ee){if(ee!==null&&typeof ee=="object"&&"dd_context"in ee)return ee.dd_context}function isError(ee){return ee instanceof Error||Object.prototype.toString.call(ee)==="[object Error]"}function flattenErrorCauses(ee,re){let te=ee;const ne=[];for(;isError(te==null?void 0:te.cause)&&ne.length<10;){const ie=computeStackTrace(te.cause);ne.push({message:te.cause.message,source:re,type:ie==null?void 0:ie.name,stack:ie&&toStackTraceString(ie)}),te=te.cause}return ne.length?ne:void 0}const ErrorSource={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function trackRuntimeError(ee){const re=(ie,oe)=>{const se=computeRawError({stackTrace:ie,originalError:oe,startClocks:clocksNow(),nonErrorPrefix:"Uncaught",source:ErrorSource.SOURCE,handling:"unhandled"});ee.notify(se)},{stop:te}=instrumentOnError(re),{stop:ne}=instrumentUnhandledRejection(re);return{stop:()=>{te(),ne()}}}function instrumentOnError(ee){return instrumentMethod(window,"onerror",({parameters:[re,te,ne,ie,oe]})=>{let se;isError(oe)?se=computeStackTrace(oe):se=computeStackTraceFromOnErrorMessage(re,te,ne,ie),ee(se,oe??re)})}function instrumentUnhandledRejection(ee){return instrumentMethod(window,"onunhandledrejection",({parameters:[re]})=>{const te=re.reason||"Empty reason",ne=computeStackTrace(te);ee(ne,te)})}function makePublicApi(ee){const re={version:"6.6.3",onReady(te){te()},...ee};return Object.defineProperty(re,"_setDebug",{get(){return setDebugMode},enumerable:!1}),re}function defineGlobal(ee,re,te){const ne=ee[re];ne&&!ne.q&&ne.version&&display.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),ee[re]=te,ne&&ne.q&&ne.q.forEach(ie=>catchUserErrors(ie,"onReady callback threw an error:")())}function displayAlreadyInitializedError(ee,re){re.silentMultipleInit||display.error(`${ee} is already initialized.`)}function addEventListener$1(ee,re,te,ne,ie){return addEventListeners(ee,re,[te],ne,ie)}function addEventListeners(ee,re,te,ne,{once:ie,capture:oe,passive:se}={}){const ae=monitor(fe=>{!fe.isTrusted&&!fe.__ddIsTrusted&&!ee.allowUntrustedEvents||(ie&&de(),ne(fe))}),ue=se?{capture:oe,passive:se}:oe,ce=window.EventTarget&&re instanceof EventTarget?window.EventTarget.prototype:re,le=getZoneJsOriginalValue(ce,"addEventListener");te.forEach(fe=>le.call(re,fe,ae,ue));function de(){const fe=getZoneJsOriginalValue(ce,"removeEventListener");te.forEach(he=>fe.call(re,he,ae,ue))}return{stop:de}}const RawReportType={intervention:"intervention",cspViolation:"csp_violation"};function initReportObservable(ee,re){const te=[];re.includes(RawReportType.cspViolation)&&te.push(createCspViolationReportObservable(ee));const ne=re.filter(ie=>ie!==RawReportType.cspViolation);return ne.length&&te.push(createReportObservable(ne)),mergeObservables(...te)}function createReportObservable(ee){return new Observable$1(re=>{if(!window.ReportingObserver)return;const te=monitor((ie,oe)=>ie.forEach(se=>re.notify(buildRawReportErrorFromReport(se)))),ne=new window.ReportingObserver(te,{types:ee,buffered:!0});return ne.observe(),()=>{ne.disconnect()}})}function createCspViolationReportObservable(ee){return new Observable$1(re=>{const{stop:te}=addEventListener$1(ee,document,"securitypolicyviolation",ne=>{re.notify(buildRawReportErrorFromCspViolation(ne))});return te})}function buildRawReportErrorFromReport(ee){const{type:re,body:te}=ee;return buildRawReportError({type:te.id,message:`${re}: ${te.message}`,originalError:ee,stack:buildStack(te.id,te.message,te.sourceFile,te.lineNumber,te.columnNumber)})}function buildRawReportErrorFromCspViolation(ee){const re=`'${ee.blockedURI}' blocked by '${ee.effectiveDirective}' directive`;return buildRawReportError({type:ee.effectiveDirective,message:`${RawReportType.cspViolation}: ${re}`,originalError:ee,csp:{disposition:ee.disposition},stack:buildStack(ee.effectiveDirective,ee.originalPolicy?`${re} of the policy "${safeTruncate(ee.originalPolicy,100,"...")}"`:"no policy",ee.sourceFile,ee.lineNumber,ee.columnNumber)})}function buildRawReportError(ee){return{startClocks:clocksNow(),source:ErrorSource.REPORT,handling:"unhandled",...ee}}function buildStack(ee,re,te,ne,ie){return te?toStackTraceString({name:ee,message:re,stack:[{func:"?",url:te,line:ne??void 0,column:ie??void 0}]}):void 0}function sendToExtension(ee,re){const te=window.__ddBrowserSdkExtensionCallback;te&&te({type:ee,payload:re})}function getType(ee){return ee===null?"null":Array.isArray(ee)?"array":typeof ee}function mergeInto(ee,re,te=createCircularReferenceChecker()){if(re===void 0)return ee;if(typeof re!="object"||re===null)return re;if(re instanceof Date)return new Date(re.getTime());if(re instanceof RegExp){const ie=re.flags||[re.global?"g":"",re.ignoreCase?"i":"",re.multiline?"m":"",re.sticky?"y":"",re.unicode?"u":""].join("");return new RegExp(re.source,ie)}if(te.hasAlreadyBeenSeen(re))return;if(Array.isArray(re)){const ie=Array.isArray(ee)?ee:[];for(let oe=0;oe<re.length;++oe)ie[oe]=mergeInto(ie[oe],re[oe],te);return ie}const ne=getType(ee)==="object"?ee:{};for(const ie in re)Object.prototype.hasOwnProperty.call(re,ie)&&(ne[ie]=mergeInto(ne[ie],re[ie],te));return ne}function deepClone(ee){return mergeInto(void 0,ee)}function combine(...ee){let re;for(const te of ee)te!=null&&(re=mergeInto(re,te));return re}function createCircularReferenceChecker(){if(typeof WeakSet<"u"){const re=new WeakSet;return{hasAlreadyBeenSeen(te){const ne=re.has(te);return ne||re.add(te),ne}}}const ee=[];return{hasAlreadyBeenSeen(re){const te=ee.indexOf(re)>=0;return te||ee.push(re),te}}}function getConnectivity(){var ee;const re=window.navigator;return{status:re.onLine?"connected":"not_connected",interfaces:re.connection&&re.connection.type?[re.connection.type]:void 0,effective_type:(ee=re.connection)===null||ee===void 0?void 0:ee.effectiveType}}function removeItem(ee,re){const te=ee.indexOf(re);te>=0&&ee.splice(te,1)}const BUFFER_LIMIT=500;function createBoundedBuffer(){const ee=[];return{add:ie=>{ee.push(ie)>BUFFER_LIMIT&&ee.splice(0,1)},remove:ie=>{removeItem(ee,ie)},drain:ie=>{ee.forEach(oe=>oe(ie)),ee.length=0}}}const TelemetryType={log:"log",configuration:"configuration",usage:"usage"},ALLOWED_FRAME_URLS=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],TELEMETRY_EXCLUDED_SITES=[INTAKE_SITE_US1_FED];let preStartTelemetryBuffer=createBoundedBuffer(),onRawTelemetryEventCollected=ee=>{preStartTelemetryBuffer.add(()=>onRawTelemetryEventCollected(ee))};function startTelemetry(ee,re){let te;const ne=new Observable$1,ie=new Set,oe=!TELEMETRY_EXCLUDED_SITES.includes(re.site)&&performDraw(re.telemetrySampleRate),se={[TelemetryType.log]:oe,[TelemetryType.configuration]:oe&&performDraw(re.telemetryConfigurationSampleRate),[TelemetryType.usage]:oe&&performDraw(re.telemetryUsageSampleRate)},ae=getRuntimeEnvInfo();onRawTelemetryEventCollected=ce=>{const le=jsonStringify(ce);if(se[ce.type]&&ie.size<re.maxTelemetryEventsPerPage&&!ie.has(le)){const de=ue(ee,ce,ae);ne.notify(de),sendToExtension("telemetry",de),ie.add(le)}},startMonitorErrorCollection(addTelemetryError);function ue(ce,le,de){return combine({type:"telemetry",date:timeStampNow(),service:ce,version:"6.6.3",source:"browser",_dd:{format_version:2},telemetry:combine(le,{runtime_env:de,connectivity:getConnectivity(),sdk_setup:"npm"}),experimental_features:Array.from(getExperimentalFeatures())},te!==void 0?te():{})}return{setContextProvider:ce=>{te=ce},observable:ne,enabled:oe}}function getRuntimeEnvInfo(){return{is_local_file:window.location.protocol==="file:",is_worker:"WorkerGlobalScope"in self}}function drainPreStartTelemetry(){preStartTelemetryBuffer.drain()}function isTelemetryReplicationAllowed(ee){return ee.site===INTAKE_SITE_STAGING}function addTelemetryDebug(ee,re){displayIfDebugEnabled(ConsoleApiName.debug,ee,re),onRawTelemetryEventCollected({type:TelemetryType.log,message:ee,status:"debug",...re})}function addTelemetryError(ee,re){onRawTelemetryEventCollected({type:TelemetryType.log,status:"error",...formatError(ee),...re})}function addTelemetryConfiguration(ee){onRawTelemetryEventCollected({type:TelemetryType.configuration,configuration:ee})}function addTelemetryUsage(ee){onRawTelemetryEventCollected({type:TelemetryType.usage,usage:ee})}function formatError(ee){if(isError(ee)){const re=computeStackTrace(ee);return{error:{kind:re.name,stack:toStackTraceString(scrubCustomerFrames(re))},message:re.message}}return{error:{stack:NO_ERROR_STACK_PRESENT_MESSAGE},message:`Uncaught ${jsonStringify(ee)}`}}function scrubCustomerFrames(ee){return ee.stack=ee.stack.filter(re=>!re.url||ALLOWED_FRAME_URLS.some(te=>re.url.startsWith(te))),ee}const END_OF_TIMES=1/0,CLEAR_OLD_VALUES_INTERVAL=ONE_MINUTE;let cleanupHistoriesInterval=null;const cleanupTasks=new Set;function cleanupHistories(){cleanupTasks.forEach(ee=>ee())}function createValueHistory({expireDelay:ee,maxEntries:re}){let te=[];const ne=[];cleanupHistoriesInterval||(cleanupHistoriesInterval=setInterval$1(()=>cleanupHistories(),CLEAR_OLD_VALUES_INTERVAL));const ie=()=>{const he=relativeNow()-ee;for(;te.length>0&&te[te.length-1].endTime<he;){const pe=te.pop();pe&&ne.push(pe.startTime)}};cleanupTasks.add(ie);function oe(he,pe){const ge={value:he,startTime:pe,endTime:END_OF_TIMES,remove:()=>{removeItem(te,ge)},close:me=>{ge.endTime=me}};return re&&te.length>=re&&te.pop(),te.unshift(ge),ge}function se(he=END_OF_TIMES,pe={returnInactive:!1}){for(const ge of te)if(ge.startTime<=he){if(pe.returnInactive||he<=ge.endTime)return ge.value;break}}function ae(he){const pe=te[0];pe&&pe.endTime===END_OF_TIMES&&pe.close(he)}function ue(he=END_OF_TIMES,pe=0){const ge=addDuration(he,pe);return te.filter(me=>me.startTime<=ge&&he<=me.endTime).map(me=>me.value)}function ce(){return te.map(({startTime:he,endTime:pe,value:ge})=>({startTime:he,endTime:pe===END_OF_TIMES?"Infinity":pe,value:ge}))}function le(){return ne}function de(){te=[]}function fe(){cleanupTasks.delete(ie),cleanupTasks.size===0&&cleanupHistoriesInterval&&(clearInterval$1(cleanupHistoriesInterval),cleanupHistoriesInterval=null)}return{add:oe,find:se,closeActive:ae,findAll:ue,reset:de,stop:fe,getAllEntries:ce,getDeletedEntries:le}}const VISIBILITY_CHECK_DELAY=ONE_MINUTE,SESSION_CONTEXT_TIMEOUT_DELAY=SESSION_TIME_OUT_DELAY;function startSessionManager(ee,re,te,ne){const ie=new Observable$1,oe=new Observable$1,se=startSessionStore(ee.sessionStoreStrategyType,ee,re,te),ae=createValueHistory({expireDelay:SESSION_CONTEXT_TIMEOUT_DELAY});se.renewObservable.subscribe(()=>{ae.add(ue(),relativeNow()),ie.notify()}),se.expireObservable.subscribe(()=>{oe.notify(),ae.closeActive(relativeNow())}),se.expandOrRenewSession(),ae.add(ue(),clocksOrigin().relative),ne.observable.subscribe(()=>{ne.isGranted()?se.expandOrRenewSession():se.expire()}),trackActivity(ee,()=>{ne.isGranted()&&se.expandOrRenewSession()}),trackVisibility(ee,()=>se.expandSession()),trackResume(ee,()=>se.restartSession());function ue(){return{id:se.getSession().id,trackingType:se.getSession()[re],isReplayForced:!!se.getSession().forcedReplay,anonymousId:se.getSession().anonymousId}}return{findSession:(ce,le)=>ae.find(ce,le),renewObservable:ie,expireObservable:oe,sessionStateUpdateObservable:se.sessionStateUpdateObservable,expire:se.expire,updateSessionState:se.updateSessionState}}function trackActivity(ee,re){const{stop:te}=addEventListeners(ee,window,["click","touchstart","keydown","scroll"],re,{capture:!0,passive:!0})}function trackVisibility(ee,re){const te=()=>{document.visibilityState==="visible"&&re()},{stop:ne}=addEventListener$1(ee,document,"visibilitychange",te);setInterval$1(te,VISIBILITY_CHECK_DELAY)}function trackResume(ee,re){const{stop:te}=addEventListener$1(ee,window,"resume",re,{capture:!0})}function isServerError(ee){return ee>=500}function tryToClone(ee){try{return ee.clone()}catch{return}}const MAX_ONGOING_BYTES_COUNT=80*ONE_KIBI_BYTE,MAX_ONGOING_REQUESTS=32,MAX_QUEUE_BYTES_COUNT=3*ONE_MEBI_BYTE,MAX_BACKOFF_TIME=ONE_MINUTE,INITIAL_BACKOFF_TIME=ONE_SECOND;function sendWithRetryStrategy(ee,re,te,ne,ie){re.transportStatus===0&&re.queuedPayloads.size()===0&&re.bandwidthMonitor.canHandle(ee)?send(ee,re,te,{onSuccess:()=>retryQueuedPayloads(0,re,te,ne,ie),onFailure:()=>{re.queuedPayloads.enqueue(ee),scheduleRetry(re,te,ne,ie)}}):re.queuedPayloads.enqueue(ee)}function scheduleRetry(ee,re,te,ne){ee.transportStatus===2&&setTimeout$1(()=>{const ie=ee.queuedPayloads.first();send(ie,ee,re,{onSuccess:()=>{ee.queuedPayloads.dequeue(),ee.currentBackoffTime=INITIAL_BACKOFF_TIME,retryQueuedPayloads(1,ee,re,te,ne)},onFailure:()=>{ee.currentBackoffTime=Math.min(MAX_BACKOFF_TIME,ee.currentBackoffTime*2),scheduleRetry(ee,re,te,ne)}})},ee.currentBackoffTime)}function send(ee,re,te,{onSuccess:ne,onFailure:ie}){re.bandwidthMonitor.add(ee),te(ee,oe=>{re.bandwidthMonitor.remove(ee),shouldRetryRequest(oe)?(re.transportStatus=re.bandwidthMonitor.ongoingRequestCount>0?1:2,ee.retry={count:ee.retry?ee.retry.count+1:1,lastFailureStatus:oe.status},ie()):(re.transportStatus=0,ne())})}function retryQueuedPayloads(ee,re,te,ne,ie){ee===0&&re.queuedPayloads.isFull()&&!re.queueFullReported&&(ie({message:`Reached max ${ne} events size queued for upload: ${MAX_QUEUE_BYTES_COUNT/ONE_MEBI_BYTE}MiB`,source:ErrorSource.AGENT,startClocks:clocksNow()}),re.queueFullReported=!0);const oe=re.queuedPayloads;for(re.queuedPayloads=newPayloadQueue();oe.size()>0;)sendWithRetryStrategy(oe.dequeue(),re,te,ne,ie)}function shouldRetryRequest(ee){return ee.type!=="opaque"&&(ee.status===0&&!navigator.onLine||ee.status===408||ee.status===429||isServerError(ee.status))}function newRetryState(){return{transportStatus:0,currentBackoffTime:INITIAL_BACKOFF_TIME,bandwidthMonitor:newBandwidthMonitor(),queuedPayloads:newPayloadQueue(),queueFullReported:!1}}function newPayloadQueue(){const ee=[];return{bytesCount:0,enqueue(re){this.isFull()||(ee.push(re),this.bytesCount+=re.bytesCount)},first(){return ee[0]},dequeue(){const re=ee.shift();return re&&(this.bytesCount-=re.bytesCount),re},size(){return ee.length},isFull(){return this.bytesCount>=MAX_QUEUE_BYTES_COUNT}}}function newBandwidthMonitor(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(ee){return this.ongoingRequestCount===0||this.ongoingByteCount+ee.bytesCount<=MAX_ONGOING_BYTES_COUNT&&this.ongoingRequestCount<MAX_ONGOING_REQUESTS},add(ee){this.ongoingRequestCount+=1,this.ongoingByteCount+=ee.bytesCount},remove(ee){this.ongoingRequestCount-=1,this.ongoingByteCount-=ee.bytesCount}}}function createHttpRequest(ee,re,te){const ne=newRetryState(),ie=(oe,se)=>fetchKeepAliveStrategy(ee,re,oe,se);return{send:oe=>{sendWithRetryStrategy(oe,ne,ie,ee.trackType,te)},sendOnExit:oe=>{sendBeaconStrategy(ee,re,oe)}}}function sendBeaconStrategy(ee,re,te){if(!!navigator.sendBeacon&&te.bytesCount<re)try{const ie=ee.build("beacon",te);if(navigator.sendBeacon(ie,te.data))return}catch(ie){reportBeaconError(ie)}fetchStrategy(ee,te)}let hasReportedBeaconError=!1;function reportBeaconError(ee){hasReportedBeaconError||(hasReportedBeaconError=!0,monitorError(ee))}function fetchKeepAliveStrategy(ee,re,te,ne){if(isKeepAliveSupported()&&te.bytesCount<re){const oe=ee.build("fetch-keepalive",te);fetch(oe,{method:"POST",body:te.data,keepalive:!0,mode:"cors"}).then(monitor(se=>ne==null?void 0:ne({status:se.status,type:se.type}))).catch(monitor(()=>fetchStrategy(ee,te,ne)))}else fetchStrategy(ee,te,ne)}function fetchStrategy(ee,re,te){const ne=ee.build("fetch",re);fetch(ne,{method:"POST",body:re.data,mode:"cors"}).then(monitor(ie=>te==null?void 0:te({status:ie.status,type:ie.type}))).catch(monitor(()=>te==null?void 0:te({status:0})))}function isKeepAliveSupported(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function getEventBridge(){const ee=getEventBridgeGlobal();if(ee)return{getCapabilities(){var re;return JSON.parse(((re=ee.getCapabilities)===null||re===void 0?void 0:re.call(ee))||"[]")},getPrivacyLevel(){var re;return(re=ee.getPrivacyLevel)===null||re===void 0?void 0:re.call(ee)},getAllowedWebViewHosts(){return JSON.parse(ee.getAllowedWebViewHosts())},send(re,te,ne){const ie=ne?{id:ne}:void 0;ee.send(JSON.stringify({eventType:re,event:te,view:ie}))}}}function bridgeSupports(ee){const re=getEventBridge();return!!re&&re.getCapabilities().includes(ee)}function canUseEventBridge(ee){var re;ee===void 0&&(ee=(re=getGlobalObject().location)===null||re===void 0?void 0:re.hostname);const te=getEventBridge();return!!te&&te.getAllowedWebViewHosts().some(ne=>ee===ne||ee.endsWith(`.${ne}`))}function getEventBridgeGlobal(){return getGlobalObject().DatadogEventBridge}const PageExitReason={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function createPageMayExitObservable(ee){return new Observable$1(re=>{const{stop:te}=addEventListeners(ee,window,["visibilitychange","freeze"],ie=>{ie.type==="visibilitychange"&&document.visibilityState==="hidden"?re.notify({reason:PageExitReason.HIDDEN}):ie.type==="freeze"&&re.notify({reason:PageExitReason.FROZEN})},{capture:!0}),ne=addEventListener$1(ee,window,"beforeunload",()=>{re.notify({reason:PageExitReason.UNLOADING})}).stop;return()=>{te(),ne()}})}function isPageExitReason(ee){return objectValues(PageExitReason).includes(ee)}function createBatch({encoder:ee,request:re,flushController:te,messageBytesLimit:ne}){let ie={};const oe=te.flushObservable.subscribe(de=>le(de));function se(de,fe,he){te.notifyBeforeAddMessage(fe),he!==void 0?(ie[he]=de,te.notifyAfterAddMessage()):ee.write(ee.isEmpty?de:`
|
|
153
155
|
${de}`,pe=>{te.notifyAfterAddMessage(pe-fe)})}function ae(de){return de!==void 0&&ie[de]!==void 0}function ue(de){const fe=ie[de];delete ie[de];const he=ee.estimateEncodedBytesCount(fe);te.notifyAfterRemoveMessage(he)}function ce(de,fe){const he=jsonStringify(de),pe=ee.estimateEncodedBytesCount(he);if(pe>=ne){display.warn(`Discarded a message whose size was bigger than the maximum allowed size ${ne}KB. ${MORE_DETAILS} ${DOCS_TROUBLESHOOTING}/#technical-limitations`);return}ae(fe)&&ue(fe),se(he,pe,fe)}function le(de){const fe=objectValues(ie).join(`
|
|
@@ -910,7 +912,7 @@ Body:`)).call(gr,Oi()(vr)));var Fr=new XMLHttpRequest;Fr.open(De._method||ue.Pos
|
|
|
910
912
|
flex-wrap: nowrap;
|
|
911
913
|
color: ${defineBadgeStyles({variant:ee}).textColor};
|
|
912
914
|
}
|
|
913
|
-
`;class Badge extends Component{constructor({items:re,variant:te="default",isFullWidth:ne=!1,align:ie="center"}){super({tag:"div",styles:()=>getBadgeStyles({variant:te,isFullWidth:ne,align:ie})}),re.forEach(({title:oe,icon:se,iconLeft:ae,iconRight:ue})=>{const ce=document.createElement("div");if(ce.classList.add("badge-content"),se||ae){const de=new Icon({name:se||ae,size:12,color:defineBadgeStyles({variant:te}).textColor}).element;ce.append(de)}const le=new Typography({text:oe,size:"xSmall",weight:500,color:defineBadgeStyles({variant:te}).textColor,align:"center"}).element;if(ce.append(le),ue){const de=new Icon({name:ue,size:12,color:defineBadgeStyles({variant:te}).textColor}).element;ce.append(de)}this.element.append(ce)})}}const APCardsFields=(ee,re,te)=>[{field:"#cc-holder",type:"text",name:"card_holder",placeholder:"card_holder_placeholder",autocomplete:"off",validations:["required","/^[a-zA-Z ]{0,200}$/"],styles:CARD_STYLES(ee,te)},{field:"#cc-number",type:"card-number",name:"card_number",placeholder:"4111 1111 1111 1111",autocomplete:"off",validations:["required","validCardNumber"],styles:CARD_STYLES(ee,te)},{field:"#cc-expiration-date",type:"card-expiration-date",name:"card_exp",lengthYear:re==="MM/YY"?2:4,placeholder:re,autocomplete:"off",validations:["required","validCardExpirationDate"],styles:CARD_STYLES(ee,te)},{field:"#cc-cvc",type:"card-security-code",name:"card_cvc",placeholder:"123",autocomplete:"off",validations:["required","/^\\d{3,4}$/"],styles:CARD_STYLES(ee,te)}],EMPTY_FORM_DATA={card_holder:{isValid:!0,isTouched:!1},card_number:{isValid:!0,isTouched:!1},card_exp:{isValid:!0,isTouched:!1},card_cvc:{isValid:!0,isTouched:!1}},formatInstallmentContent=(ee,re)=>{const{installmentNumber:te,installmentAmount:ne,totalAmount:ie}=ee,oe=AstroPayConfig.getCurrencyMode(),se=formatAmountCurrency(ne,re,oe),ae=formatAmountCurrency(ie,re,oe);return`${te}x ${se} (${ae})`},createInstallmentBadge=ee=>{const{hasInterest:re,interestValue:te}=ee;return re?new Typography({text:te,size:"small",weight:500}).element:new Badge({items:[{title:te}],variant:"highlight"}).element},mountInstallmentData=(ee,re)=>{var te;return(te=ee==null?void 0:ee.data)!=null&&te.length?ee.data.map(ne=>({value:ne.installmentNumber,content:formatInstallmentContent(ne,re),rightContent:createInstallmentBadge(ne),meta:ne})):[]},DEFAULT_EXPIRATION_DATE_FORMAT="MM/YY";class CardPaymentMethod extends Component{constructor(te){super({tag:"div",styles:ne=>getCardPaymentMethodStyles(ne,{error:!1,disabled:!1})});xe(this,"componentProps");xe(this,"loadingWrapper");xe(this,"btnPay",null);xe(this,"paymentSummary",null);xe(this,"cardManager",null);xe(this,"cardHolderInput",null);xe(this,"cardNumberInput",null);xe(this,"cardExpInput",null);xe(this,"cardCvvInput",null);xe(this,"requiredFieldsForm",null);xe(this,"formState",EMPTY_FORM_DATA);xe(this,"isFormTemplateValid",!1);xe(this,"selectedInstallment");xe(this,"hasInstallments",!1);xe(this,"pollingService",null);this.componentProps={...te,showPaymentSummary:te.showPaymentSummary??!0,expirationDateFormat:te.expirationDateFormat??DEFAULT_EXPIRATION_DATE_FORMAT},this.loadingWrapper=this.createLoadingWrapper(AstroPayI18n.translate("hold_on")),this.element.append(this.loadingWrapper),sessionStorage.getItem(EStorageKey.SESSION_ID)||sessionStorage.setItem(EStorageKey.SESSION_ID,uuid()),this.fetchPaymentMethodDetail()}async fetchPaymentMethodDetail(){try{const te=await PaymentMethodsService.getPaymentMethodDetail({paymentExternalId:this.componentProps.paymentExternalId,methodCode:this.componentProps.paymentMethod.code});this.renderCardSection(te.fields,te.installments)}catch(te){const ne=te;this.showErrorMessage(ne.description??ne.message)}finally{this.loadingWrapper.remove()}}renderCardSection(te,ne){var ce,le;const{amount:ie,currency:oe,showPaymentSummary:se,expirationDateFormat:ae}=this.componentProps;se&&(this.paymentSummary=new PaymentSummary({amount:ie,currency:oe}),this.element.append((ce=this.paymentSummary)==null?void 0:ce.element)),this.cardHolderInput=new CardField({id:"cc-holder",label:AstroPayI18n.translate("card_holder_label")}),this.cardNumberInput=new CardField({id:"cc-number",label:AstroPayI18n.translate("card_number")});const ue=document.createElement("div");ue.classList.add("row-container"),this.cardExpInput=new CardField({id:"cc-expiration-date",label:AstroPayI18n.translate("card_exp_date")}),this.cardCvvInput=new CardField({id:"cc-cvc",label:"CVV"}),ue.append(this.cardExpInput.element,this.cardCvvInput.element),this.element.append(this.cardHolderInput.element,this.cardNumberInput.element,ue),this.cardManager=new CardApService(APCardsFields(defineInputStyles().textColor,ae??DEFAULT_EXPIRATION_DATE_FORMAT,ThemeManager.getStyles()).map(de=>({...de,placeholder:AstroPayI18n.translate(de.placeholder)})),this.handleFormStateChange.bind(this)),this.cardManager.init(),this.btnPay=new Button({text:AstroPayI18n.translate("pay_amount",{amount:formatAmountCurrency(this.componentProps.amount,this.componentProps.currency,AstroPayConfig.getCurrencyMode())}),onClick:()=>{this.handleSubmit()},isFullWidth:!0,iconLeft:"lock_line",isDisabled:!0}),ne!=null&&ne.data&&((le=ne.data)==null?void 0:le.length)>0&&this.renderInstallments(ne),te&&te.length>0&&this.renderRequiredFields(te),this.element.append(this.btnPay.element)}renderRequiredFields(te){this.requiredFieldsForm=new FormTemplate({title:AstroPayI18n.translate("additional_information"),requiredFields:te}),this.requiredFieldsForm.setValidationChangeHandler(ne=>{this.isFormTemplateValid=ne,this.updateSubmitButton()}),this.element.append(this.requiredFieldsForm.element)}renderInstallments(te){if(!te)return;this.hasInstallments=!0;const ne=new SelectDropdown({label:te.label,options:mountInstallmentData(te,te.currency),onChange:ie=>{var oe;this.updateAmount((oe=ie.meta)==null?void 0:oe.totalAmount),this.selectedInstallment=ie.meta}}).element;this.element.append(ne)}updateAmount(te){var ie,oe;if(te==null)return;const ne=AstroPayI18n.translate("pay_amount",{amount:formatAmountCurrency(te,this.componentProps.currency,AstroPayConfig.getCurrencyMode())});(ie=this.btnPay)==null||ie.setText(ne),(oe=this.paymentSummary)==null||oe.setAmountAndCurrency(te,this.componentProps.currency)}handleFormStateChange(te){this.formState=te,this.updateInputsValidation(),this.updateSubmitButton()}updateInputsValidation(){[{input:this.cardHolderInput,...this.formState.card_holder},{input:this.cardNumberInput,...this.formState.card_number},{input:this.cardExpInput,...this.formState.card_exp},{input:this.cardCvvInput,...this.formState.card_cvc}].forEach(({input:ne,isValid:ie})=>{ne==null||ne.setValid(ie),ne==null||ne.setHelperText(ie?"":AstroPayI18n.translate("invalid_field"),ie)})}updateSubmitButton(){var ie;const ne=Object.values(this.formState).every(oe=>oe.isValid&&oe.isTouched)&&(this.requiredFieldsForm?this.isFormTemplateValid:!0);(ie=this.btnPay)==null||ie.setDisabled(!ne)}async handleSubmit(){var te,ne,ie,oe,se,ae;try{(te=this.btnPay)==null||te.setLoading(!0);const ue=await this.handleTokenizeCard(),ce={paymentMethods:[{methodCode:this.componentProps.paymentMethod.code,currency:this.componentProps.currency,amount:this.componentProps.amount,user:{sessionId:sessionStorage.getItem(EStorageKey.SESSION_ID)||"",...(ne=this.requiredFieldsForm)==null?void 0:ne.getFormData()},...this.hasInstallments&&{installments:((ie=this.selectedInstallment)==null?void 0:ie.installmentNumber)??1},cardData:ue}]};if((oe=this.componentProps.paymentMethod)!=null&&oe.uri){const{status:le,reason:de}=await PaymentService.postGenericPayment(this.componentProps.paymentMethod.uri,this.componentProps.paymentExternalId,ce);if(le===ECardPayStatus.PENDING)await this.checkPaymentStatus(),(se=this.btnPay)==null||se.setLoading(!1),(ae=this.btnPay)==null||ae.setDisabled(!0);else throw new Error(de||AstroPayI18n.translate("generic_error"))}else throw new Error(AstroPayI18n.translate("generic_error"))}catch(ue){const ce=ue;console.error(ce.message),this.showErrorMessage(ce.description??ce.message),this.renderRetryButton()}}async handleTokenizeCard(){return new Promise((te,ne)=>{var ae;if(!this.cardManager)return;const{document_type:ie,document_number:oe}=((ae=this.requiredFieldsForm)==null?void 0:ae.getFormData())??{},se={documentType:ie??"",documentNumber:oe??"",sessionId:sessionStorage.getItem(EStorageKey.SESSION_ID)||""};this.cardManager.tokenizeCard(se,ue=>te(ue),ue=>{ne(ue)})})}showErrorMessage(te){this.element.innerHTML="";const ne=new Typography({text:te,size:ThemeManager.getFontScale().xSmall,color:ThemeManager.getStyles().messages.error.textColor}).element;this.element.append(ne)}async checkPaymentStatus(){try{const te=await PaymentService.getPaymentStatus(this.componentProps.paymentExternalId);te.pollingStatus===EPollingStatus.ACCEPTED?this.initializePollingService(te):te.pollingStatus===EPollingStatus.FINISHED&&this.handlePaymentFinished(te)}catch(te){const ne=te;this.showErrorMessage(ne.description??ne.message),this.stopPolling()}}initializePollingService(te){this.pollingService=new PollingService(te,ne=>this.showWaitingInfo(ne),ne=>this.handlePaymentFinished(ne),ne=>this.handlePollingError(ne)),this.pollingService.startPolling()}stopPolling(){this.pollingService&&(this.pollingService.stopPolling(),this.pollingService=null)}handlePollingError(te){if(typeof te=="object"&&te!==null&&"text"in te){const ie=te;this.showErrorMessage(ie.text)}else{const ie=te;this.showErrorMessage(ie.description??ie.message)}this.stopPolling(),this.renderRetryButton()}showWaitingInfo(te){this.element.innerHTML="";const ne=this.createLoadingWrapper(te);ne.style.minHeight="400px",this.element.append(ne)}handlePaymentFinished(te){te.data.status===EPaymentStatus.COMPLETED?this.handleSuccessSection(te.data.successSection):this.handleErrorSection(te.data.errorSection)}handleSuccessSection(te){if(!te)return;const ne=[],ie=new Status$1({type:"success",title:te.title,description:te.description}).element;ne.push(ie),this.componentProps.onSuccess?this.componentProps.onSuccess(ne):(this.element.innerHTML="",ne.forEach(oe=>this.element.append(oe)))}handleErrorSection(te){if(!te)return;const ne=[],ie=new Status$1({type:"error",title:te.title,description:te.description}).element;ne.push(ie),this.componentProps.onError?this.componentProps.onError(ne):(this.element.innerHTML="",ne.forEach(oe=>this.element.append(oe)))}createLoadingWrapper(te){const ne=document.createElement("div");ne.classList.add("loading-wrapper");const ie=new Loading({size:100,variant:"fetching",color:ThemeManager.getStyles().primaryColor}).element,oe=new Typography({text:te,size:"base",lineHeight:30,weight:600,align:"center"}).element;return ne.append(ie,oe),ne}renderRetryButton(){const te=document.createElement("div");te.classList.add("center-row");const ne=new Button({text:AstroPayI18n.translate("try_again"),variant:"text",size:"small",iconRight:"refresh_2_fill",onClick:()=>{this.element.innerHTML="",this.element.append(this.loadingWrapper),this.fetchPaymentMethodDetail()}}).element;te.append(ne),this.element.append(te)}destroy(){this.stopPolling(),this.element.remove()}}let AmplitudeAnalytics$1=class{constructor(){xe(this,"tracker",AmplitudeTracker);xe(this,"astroPayPaymentImpression",re=>{this.tracker.trackEvent(new AstroPayPaymentImpression({component_name:re}))});xe(this,"astroPayPaymentStarted",re=>{this.tracker.trackEvent(new AstroPayPaymentStarted({payment_external_id:re}))});xe(this,"astroPayPaymentClicked",re=>{this.tracker.trackEvent(new AstroPayPaymentClicked({payment_external_id:re}))});xe(this,"astroPayPaymentPhoneNumberEntered",re=>{this.tracker.trackEvent(new AstroPayPaymentPhoneNumberEntered({payment_external_id:re}))});xe(this,"astroPayPaymentUserIdentified",re=>{this.tracker.trackEvent(new AstroPayPaymentUserIdentified({payment_external_id:re}))});xe(this,"astroPayPaymentLinkCopied",re=>{this.tracker.trackEvent(new AstroPayPaymentLinkCopied({payment_external_id:re}))});xe(this,"astroPayPaymentCardClicked",re=>{this.tracker.trackEvent(new AstroPayPaymentCardClicked({payment_external_id:re}))})}};const AmplitudeAnalytics=new AmplitudeAnalytics$1,CARDS_METHOD=[EPaymentCode.CREDIT_CARD,EPaymentCode.DEBIT_CARD,EPaymentCode.CW,EPaymentCode.DC,EPaymentCode.CC];var ECheckoutPaymentMethod=(ee=>(ee.ASTRO_PAY="ASTROPAY",ee.CARD="CARD",ee))(ECheckoutPaymentMethod||{});const getAstroPayCardPaymentStyles=ee=>css`
|
|
915
|
+
`;class Badge extends Component{constructor({items:re,variant:te="default",isFullWidth:ne=!1,align:ie="center"}){super({tag:"div",styles:()=>getBadgeStyles({variant:te,isFullWidth:ne,align:ie})}),re.forEach(({title:oe,icon:se,iconLeft:ae,iconRight:ue})=>{const ce=document.createElement("div");if(ce.classList.add("badge-content"),se||ae){const de=new Icon({name:se||ae,size:12,color:defineBadgeStyles({variant:te}).textColor}).element;ce.append(de)}const le=new Typography({text:oe,size:"xSmall",weight:500,color:defineBadgeStyles({variant:te}).textColor,align:"center"}).element;if(ce.append(le),ue){const de=new Icon({name:ue,size:12,color:defineBadgeStyles({variant:te}).textColor}).element;ce.append(de)}this.element.append(ce)})}}const APCardsFields=(ee,re,te)=>[{field:"#cc-holder",type:"text",name:"card_holder",placeholder:"card_holder_placeholder",autocomplete:"off",validations:["required","/^[a-zA-Z ]{0,200}$/"],styles:CARD_STYLES(ee,te)},{field:"#cc-number",type:"card-number",name:"card_number",placeholder:"4111 1111 1111 1111",autocomplete:"off",validations:["required","validCardNumber"],styles:CARD_STYLES(ee,te)},{field:"#cc-expiration-date",type:"card-expiration-date",name:"card_exp",lengthYear:re==="MM/YY"?2:4,placeholder:re,autocomplete:"off",validations:["required","validCardExpirationDate"],styles:CARD_STYLES(ee,te)},{field:"#cc-cvc",type:"card-security-code",name:"card_cvc",placeholder:"123",autocomplete:"off",validations:["required","/^\\d{3,4}$/"],styles:CARD_STYLES(ee,te)}],EMPTY_FORM_DATA={card_holder:{isValid:!0,isTouched:!1},card_number:{isValid:!0,isTouched:!1},card_exp:{isValid:!0,isTouched:!1},card_cvc:{isValid:!0,isTouched:!1}},formatInstallmentContent=(ee,re)=>{const{installmentNumber:te,installmentAmount:ne,totalAmount:ie}=ee,oe=AstroPayConfig.getCurrencyMode(),se=formatAmountCurrency(ne,re,oe),ae=formatAmountCurrency(ie,re,oe);return`${te}x ${se} (${ae})`},createInstallmentBadge=ee=>{const{hasInterest:re,interestValue:te}=ee;return re?new Typography({text:te,size:"small",weight:500}).element:new Badge({items:[{title:te}],variant:"highlight"}).element},mountInstallmentData=(ee,re)=>{var te;return(te=ee==null?void 0:ee.data)!=null&&te.length?ee.data.map(ne=>({value:ne.installmentNumber,content:formatInstallmentContent(ne,re),rightContent:createInstallmentBadge(ne),meta:ne})):[]},DEFAULT_EXPIRATION_DATE_FORMAT="MM/YY";class CardPaymentMethod extends Component{constructor(te){super({tag:"div",styles:ne=>getCardPaymentMethodStyles(ne,{error:!1,disabled:!1})});xe(this,"componentProps");xe(this,"loadingWrapper");xe(this,"btnPay",null);xe(this,"paymentSummary",null);xe(this,"cardManager",null);xe(this,"cardHolderInput",null);xe(this,"cardNumberInput",null);xe(this,"cardExpInput",null);xe(this,"cardCvvInput",null);xe(this,"requiredFieldsForm",null);xe(this,"formState",EMPTY_FORM_DATA);xe(this,"isFormTemplateValid",!1);xe(this,"selectedInstallment");xe(this,"hasInstallments",!1);xe(this,"pollingService",null);xe(this,"processingTextTimers",[]);this.componentProps={...te,showPaymentSummary:te.showPaymentSummary??!0,expirationDateFormat:te.expirationDateFormat??DEFAULT_EXPIRATION_DATE_FORMAT},this.loadingWrapper=this.createLoadingWrapper(AstroPayI18n.translate("hold_on")),this.element.append(this.loadingWrapper),sessionStorage.getItem(EStorageKey.SESSION_ID)||sessionStorage.setItem(EStorageKey.SESSION_ID,uuid()),this.fetchPaymentMethodDetail()}async fetchPaymentMethodDetail(){try{const te=await PaymentMethodsService.getPaymentMethodDetail({paymentExternalId:this.componentProps.paymentExternalId,methodCode:this.componentProps.paymentMethod.code});this.renderCardSection(te.fields,te.installments)}catch(te){const ne=te;this.showErrorMessage(ne.description??ne.message)}finally{this.loadingWrapper.remove()}}renderCardSection(te,ne){var ce,le;const{amount:ie,currency:oe,showPaymentSummary:se,expirationDateFormat:ae}=this.componentProps;se&&(this.paymentSummary=new PaymentSummary({amount:ie,currency:oe}),this.element.append((ce=this.paymentSummary)==null?void 0:ce.element)),this.cardHolderInput=new CardField({id:"cc-holder",label:AstroPayI18n.translate("card_holder_label")}),this.cardNumberInput=new CardField({id:"cc-number",label:AstroPayI18n.translate("card_number")});const ue=document.createElement("div");ue.classList.add("row-container"),this.cardExpInput=new CardField({id:"cc-expiration-date",label:AstroPayI18n.translate("card_exp_date")}),this.cardCvvInput=new CardField({id:"cc-cvc",label:"CVV"}),ue.append(this.cardExpInput.element,this.cardCvvInput.element),this.element.append(this.cardHolderInput.element,this.cardNumberInput.element,ue),this.cardManager=new CardApService(APCardsFields(defineInputStyles().textColor,ae??DEFAULT_EXPIRATION_DATE_FORMAT,ThemeManager.getStyles()).map(de=>({...de,placeholder:AstroPayI18n.translate(de.placeholder)})),this.handleFormStateChange.bind(this)),this.cardManager.init(),this.btnPay=new Button({text:AstroPayI18n.translate("pay_amount",{amount:formatAmountCurrency(this.componentProps.amount,this.componentProps.currency,AstroPayConfig.getCurrencyMode())}),onClick:()=>{this.handleSubmit()},isFullWidth:!0,iconLeft:"lock_line",isDisabled:!0}),ne!=null&&ne.data&&((le=ne.data)==null?void 0:le.length)>0&&this.renderInstallments(ne),te&&te.length>0&&this.renderRequiredFields(te),this.element.append(this.btnPay.element)}renderRequiredFields(te){this.requiredFieldsForm=new FormTemplate({title:AstroPayI18n.translate("additional_information"),requiredFields:te}),this.requiredFieldsForm.setValidationChangeHandler(ne=>{this.isFormTemplateValid=ne,this.updateSubmitButton()}),this.element.append(this.requiredFieldsForm.element)}renderInstallments(te){if(!te)return;this.hasInstallments=!0;const ne=new SelectDropdown({label:te.label,options:mountInstallmentData(te,te.currency),onChange:ie=>{var oe;this.updateAmount((oe=ie.meta)==null?void 0:oe.totalAmount),this.selectedInstallment=ie.meta}}).element;this.element.append(ne)}updateAmount(te){var ie,oe;if(te==null)return;const ne=AstroPayI18n.translate("pay_amount",{amount:formatAmountCurrency(te,this.componentProps.currency,AstroPayConfig.getCurrencyMode())});(ie=this.btnPay)==null||ie.setText(ne),(oe=this.paymentSummary)==null||oe.setAmountAndCurrency(te,this.componentProps.currency)}handleFormStateChange(te){this.formState=te,this.updateInputsValidation(),this.updateSubmitButton()}updateInputsValidation(){[{input:this.cardHolderInput,...this.formState.card_holder},{input:this.cardNumberInput,...this.formState.card_number},{input:this.cardExpInput,...this.formState.card_exp},{input:this.cardCvvInput,...this.formState.card_cvc}].forEach(({input:ne,isValid:ie})=>{ne==null||ne.setValid(ie),ne==null||ne.setHelperText(ie?"":AstroPayI18n.translate("invalid_field"),ie)})}updateSubmitButton(){var ie;const ne=Object.values(this.formState).every(oe=>oe.isValid&&oe.isTouched)&&(this.requiredFieldsForm?this.isFormTemplateValid:!0);(ie=this.btnPay)==null||ie.setDisabled(!ne)}async handleSubmit(){var te,ne,ie,oe,se,ae,ue,ce,le,de;try{(te=this.btnPay)==null||te.setLoading(!0),(ie=(ne=this.componentProps).onProcessingStart)==null||ie.call(ne);const fe=await this.handleTokenizeCard(),he={paymentMethods:[{methodCode:this.componentProps.paymentMethod.code,currency:this.componentProps.currency,amount:this.componentProps.amount,user:{sessionId:sessionStorage.getItem(EStorageKey.SESSION_ID)||"",...(oe=this.requiredFieldsForm)==null?void 0:oe.getFormData()},...this.hasInstallments&&{installments:((se=this.selectedInstallment)==null?void 0:se.installmentNumber)??1},cardData:fe}]};if((ae=this.componentProps.paymentMethod)!=null&&ae.uri){const{status:pe,reason:ge}=await PaymentService.postGenericPayment(this.componentProps.paymentMethod.uri,this.componentProps.paymentExternalId,he);if(pe===ECardPayStatus.PENDING)await this.checkPaymentStatus(),(ue=this.btnPay)==null||ue.setLoading(!1),(ce=this.btnPay)==null||ce.setDisabled(!0);else throw new Error(ge||AstroPayI18n.translate("generic_error"))}else throw new Error(AstroPayI18n.translate("generic_error"))}catch(fe){const he=fe;console.error(he.message),this.clearProcessingTextTimers(),(de=(le=this.componentProps).onProcessingEnd)==null||de.call(le),this.showErrorMessage(he.description??he.message),this.renderRetryButton()}}async handleTokenizeCard(){return new Promise((te,ne)=>{var ae;if(!this.cardManager)return;const{document_type:ie,document_number:oe}=((ae=this.requiredFieldsForm)==null?void 0:ae.getFormData())??{},se={documentType:ie??"",documentNumber:oe??"",sessionId:sessionStorage.getItem(EStorageKey.SESSION_ID)||""};this.cardManager.tokenizeCard(se,ue=>te(ue),ue=>{ne(ue)})})}showErrorMessage(te){this.element.innerHTML="";const ne=new Typography({text:te,size:ThemeManager.getFontScale().xSmall,color:ThemeManager.getStyles().messages.error.textColor}).element;this.element.append(ne)}async checkPaymentStatus(){try{const te=await PaymentService.getPaymentStatus(this.componentProps.paymentExternalId);te.pollingStatus===EPollingStatus.ACCEPTED?this.initializePollingService(te):te.pollingStatus===EPollingStatus.FINISHED&&this.handlePaymentFinished(te)}catch(te){const ne=te;this.showErrorMessage(ne.description??ne.message),this.stopPolling()}}initializePollingService(te){this.pollingService=new PollingService(te,ne=>this.showWaitingInfo(ne),ne=>this.handlePaymentFinished(ne),ne=>this.handlePollingError(ne)),this.pollingService.startPolling()}stopPolling(){this.pollingService&&(this.pollingService.stopPolling(),this.pollingService=null)}handlePollingError(te){var ie,oe;if(typeof te=="object"&&te!==null&&"text"in te){const se=te;this.showErrorMessage(se.text)}else{const se=te;this.showErrorMessage(se.description??se.message)}this.clearProcessingTextTimers(),(oe=(ie=this.componentProps).onProcessingEnd)==null||oe.call(ie),this.stopPolling(),this.renderRetryButton()}showWaitingInfo(te){if(this.processingTextTimers.length>0)return;this.element.innerHTML="";const ne=this.createLoadingWrapper(AstroPayI18n.translate("hold_on"));ne.style.minHeight="400px",this.element.append(ne);const ie=ne.lastElementChild;this.processingTextTimers.push(setTimeout(()=>{ie.textContent=AstroPayI18n.translate("payment_processing")},8e3),setTimeout(()=>{ie.textContent=AstroPayI18n.translate("payment_still_processing")},2e4))}clearProcessingTextTimers(){this.processingTextTimers.forEach(clearTimeout),this.processingTextTimers=[]}handlePaymentFinished(te){te.data.status===EPaymentStatus.COMPLETED?this.handleSuccessSection(te.data.successSection):this.handleErrorSection(te.data.errorSection)}handleSuccessSection(te){if(!te)return;const ne=[],ie=new Status$1({type:"success",title:te.title,description:te.description}).element;ne.push(ie),this.componentProps.onSuccess?this.componentProps.onSuccess(ne):(this.element.innerHTML="",ne.forEach(oe=>this.element.append(oe)))}handleErrorSection(te){var oe,se;if(!te)return;this.clearProcessingTextTimers(),(se=(oe=this.componentProps).onProcessingEnd)==null||se.call(oe);const ne=[],ie=new Status$1({type:"error",title:te.title,description:te.description}).element;ne.push(ie),this.componentProps.onError?this.componentProps.onError(ne):(this.element.innerHTML="",ne.forEach(ae=>this.element.append(ae)))}createLoadingWrapper(te){const ne=document.createElement("div");ne.classList.add("loading-wrapper");const ie=new Loading({size:100,variant:"fetching",color:ThemeManager.getStyles().primaryColor}).element,oe=new Typography({text:te,size:"base",lineHeight:30,weight:600,align:"center"}).element;return ne.append(ie,oe),ne}renderRetryButton(){const te=document.createElement("div");te.classList.add("center-row");const ne=new Button({text:AstroPayI18n.translate("try_again"),variant:"text",size:"small",iconRight:"refresh_2_fill",onClick:()=>{this.element.innerHTML="",this.element.append(this.loadingWrapper),this.fetchPaymentMethodDetail()}}).element;te.append(ne),this.element.append(te)}destroy(){this.clearProcessingTextTimers(),this.stopPolling(),this.element.remove()}}let AmplitudeAnalytics$1=class{constructor(){xe(this,"tracker",AmplitudeTracker);xe(this,"astroPayPaymentImpression",re=>{this.tracker.trackEvent(new AstroPayPaymentImpression({component_name:re}))});xe(this,"astroPayPaymentStarted",re=>{this.tracker.trackEvent(new AstroPayPaymentStarted({payment_external_id:re}))});xe(this,"astroPayPaymentClicked",re=>{this.tracker.trackEvent(new AstroPayPaymentClicked({payment_external_id:re}))});xe(this,"astroPayPaymentPhoneNumberEntered",re=>{this.tracker.trackEvent(new AstroPayPaymentPhoneNumberEntered({payment_external_id:re}))});xe(this,"astroPayPaymentUserIdentified",re=>{this.tracker.trackEvent(new AstroPayPaymentUserIdentified({payment_external_id:re}))});xe(this,"astroPayPaymentLinkCopied",re=>{this.tracker.trackEvent(new AstroPayPaymentLinkCopied({payment_external_id:re}))});xe(this,"astroPayPaymentCardClicked",re=>{this.tracker.trackEvent(new AstroPayPaymentCardClicked({payment_external_id:re}))})}};const AmplitudeAnalytics=new AmplitudeAnalytics$1,CARDS_METHOD=[EPaymentCode.CREDIT_CARD,EPaymentCode.DEBIT_CARD,EPaymentCode.CW,EPaymentCode.DC,EPaymentCode.CC];var ECheckoutPaymentMethod=(ee=>(ee.ASTRO_PAY="ASTROPAY",ee.CARD="CARD",ee))(ECheckoutPaymentMethod||{});const getAstroPayCardPaymentStyles=ee=>css`
|
|
914
916
|
background-color: ${ee.backgroundColor};
|
|
915
917
|
|
|
916
918
|
display: flex;
|
|
@@ -931,7 +933,7 @@ Body:`)).call(gr,Oi()(vr)));var Fr=new XMLHttpRequest;Fr.open(De._method||ue.Pos
|
|
|
931
933
|
gap: 8px;
|
|
932
934
|
min-height: 250px;
|
|
933
935
|
}
|
|
934
|
-
`;class AstroPayCardPayment extends Component{constructor(te){super({tag:"div",styles:ie=>getAstroPayCardPaymentStyles(ie)});xe(this,"loadingWrapper");xe(this,"componentProps");xe(this,"methodCode");xe(this,"cardTabs",null);if(this.methodCode=ECheckoutPaymentMethod.CARD,te.paymentExternalId)this.componentProps=te;else{const ie=te;this.componentProps={...ie,country:ie.country.trim().toUpperCase(),currency:ie.currency.trim().toUpperCase()}}AstroPayCore.registerComponent(this),AmplitudeAnalytics.astroPayPaymentImpression("AstroPayCardPayment"),this.loadingWrapper=document.createElement("div"),this.loadingWrapper.classList.add("loading-wrapper");const ne=new Loading({size:100,variant:"fetching",color:ThemeManager.getStyles().primaryColor}).element;this.loadingWrapper.append(ne),this.element.appendChild(this.loadingWrapper),DataDogTracker.trackEvent("ap_cl_astropay_card_payment_init"),this.createPayment()}async createPayment(){var te,ne;try{let ie;this.componentProps.paymentExternalId?ie=await PaymentService.getPaymentDetails(this.componentProps.paymentExternalId,"card_payment"):ie=await PaymentService.postCreatePayment({country:this.componentProps.country,currency:this.componentProps.currency,amount:this.componentProps.amount,order:this.componentProps.order,methodCode:this.methodCode},"card_payment"),this.renderAstroPayCardMethod(ie)}catch(ie){const oe=ie;(ne=(te=this.componentProps)==null?void 0:te.onError)==null||ne.call(te),this.showErrorMessage(oe.description??oe.message)}finally{this.loadingWrapper.remove()}}renderAstroPayCardMethod(te){var fe,he,pe,ge;const{paymentExternalId:ne,paymentMethods:ie,paymentAmount:oe,paymentCountry:se}=te;this.element.innerHTML="";const ae=(ie==null?void 0:ie.filter(me=>me.enabled&&CARDS_METHOD.includes(me.code)))??[];if(ae.length===0){(he=(fe=this.componentProps)==null?void 0:fe.onError)==null||he.call(fe),this.showErrorMessage(AstroPayI18n.translate("generic_error"));return}const ue=(oe==null?void 0:oe.amount)??this.componentProps.amount,ce=(oe==null?void 0:oe.currency)??this.componentProps.currency,le=se??this.componentProps.country;if(ue===void 0||ce===void 0||le===void 0){(ge=(pe=this.componentProps)==null?void 0:pe.onError)==null||ge.call(pe),this.showErrorMessage(AstroPayI18n.translate("generic_error"));return}const de=ae.map(me=>{let ye=null;return{label:me.label,content:()=>{var ve,be;return ye==null||ye.destroy(),ye=new CardPaymentMethod({paymentExternalId:ne,amount:ue,currency:ce,country:le,paymentMethod:me,showPaymentSummary:(ve=this.componentProps)==null?void 0:ve.showPaymentSummary,expirationDateFormat:(be=this.componentProps)==null?void 0:be.expirationDateFormat,onSuccess:_e=>this.showResultScreen(_e,{type:"success",onSuccess:this.componentProps.onSuccess}),onError:_e=>this.showResultScreen(_e,{type:"error",onError:this.componentProps.onError})}),ye.element},onClose:()=>{ye==null||ye.destroy(),ye=null},onSelect:()=>{AmplitudeAnalytics.astroPayPaymentCardClicked(ne)}}});this.cardTabs=new CardTabs({tabs:de,defaultActiveTab:0}),this.element.append(this.cardTabs.element)}showErrorMessage(te){this.element.innerHTML="";const ne=new Typography({text:te,size:ThemeManager.getFontScale().xSmall,color:ThemeManager.getStyles().messages.error.textColor}).element;this.element.append(ne)}showResultScreen(te,ne){this.element.innerHTML="";const ie=new ResultScreen({type:ne.type,contentElements:te,onSuccess:ne==null?void 0:ne.onSuccess,onError:ne==null?void 0:ne.onError});this.element.append(ie.element)}render(te){if(!te)throw new Error("Container element not found");te.appendChild(this.element)}destroy(){var te;(te=this.cardTabs)==null||te.destroy(),this.element.remove(),AstroPayCore.unregisterComponent(this)}}const getDividerStyles=ee=>css`
|
|
936
|
+
`;class AstroPayCardPayment extends Component{constructor(te){super({tag:"div",styles:ie=>getAstroPayCardPaymentStyles(ie)});xe(this,"loadingWrapper");xe(this,"componentProps");xe(this,"methodCode");xe(this,"cardTabs",null);if(this.methodCode=ECheckoutPaymentMethod.CARD,te.paymentExternalId)this.componentProps=te;else{const ie=te;this.componentProps={...ie,country:ie.country.trim().toUpperCase(),currency:ie.currency.trim().toUpperCase()}}AstroPayCore.registerComponent(this),AmplitudeAnalytics.astroPayPaymentImpression("AstroPayCardPayment"),this.loadingWrapper=document.createElement("div"),this.loadingWrapper.classList.add("loading-wrapper");const ne=new Loading({size:100,variant:"fetching",color:ThemeManager.getStyles().primaryColor}).element;this.loadingWrapper.append(ne),this.element.appendChild(this.loadingWrapper),DataDogTracker.trackEvent("ap_cl_astropay_card_payment_init"),this.createPayment()}async createPayment(){var te,ne;try{let ie;this.componentProps.paymentExternalId?ie=await PaymentService.getPaymentDetails(this.componentProps.paymentExternalId,"card_payment"):ie=await PaymentService.postCreatePayment({country:this.componentProps.country,currency:this.componentProps.currency,amount:this.componentProps.amount,order:this.componentProps.order,methodCode:this.methodCode},"card_payment"),this.renderAstroPayCardMethod(ie)}catch(ie){const oe=ie;(ne=(te=this.componentProps)==null?void 0:te.onError)==null||ne.call(te),this.showErrorMessage(oe.description??oe.message)}finally{this.loadingWrapper.remove()}}renderAstroPayCardMethod(te){var fe,he,pe,ge;const{paymentExternalId:ne,paymentMethods:ie,paymentAmount:oe,paymentCountry:se}=te;this.element.innerHTML="";const ae=(ie==null?void 0:ie.filter(me=>me.enabled&&CARDS_METHOD.includes(me.code)))??[];if(ae.length===0){(he=(fe=this.componentProps)==null?void 0:fe.onError)==null||he.call(fe),this.showErrorMessage(AstroPayI18n.translate("generic_error"));return}const ue=(oe==null?void 0:oe.amount)??this.componentProps.amount,ce=(oe==null?void 0:oe.currency)??this.componentProps.currency,le=se??this.componentProps.country;if(ue===void 0||ce===void 0||le===void 0){(ge=(pe=this.componentProps)==null?void 0:pe.onError)==null||ge.call(pe),this.showErrorMessage(AstroPayI18n.translate("generic_error"));return}const de=ae.map(me=>{let ye=null;return{label:me.label,content:()=>{var ve,be;return ye==null||ye.destroy(),ye=new CardPaymentMethod({paymentExternalId:ne,amount:ue,currency:ce,country:le,paymentMethod:me,showPaymentSummary:(ve=this.componentProps)==null?void 0:ve.showPaymentSummary,expirationDateFormat:(be=this.componentProps)==null?void 0:be.expirationDateFormat,onSuccess:_e=>this.showResultScreen(_e,{type:"success",onSuccess:this.componentProps.onSuccess}),onError:_e=>this.showResultScreen(_e,{type:"error",onError:this.componentProps.onError}),onProcessingStart:()=>{var _e;return(_e=this.cardTabs)==null?void 0:_e.lock()},onProcessingEnd:()=>{var _e;return(_e=this.cardTabs)==null?void 0:_e.unlock()}}),ye.element},onClose:()=>{ye==null||ye.destroy(),ye=null},onSelect:()=>{AmplitudeAnalytics.astroPayPaymentCardClicked(ne)}}});this.cardTabs=new CardTabs({tabs:de,defaultActiveTab:0}),this.element.append(this.cardTabs.element)}showErrorMessage(te){this.element.innerHTML="";const ne=new Typography({text:te,size:ThemeManager.getFontScale().xSmall,color:ThemeManager.getStyles().messages.error.textColor}).element;this.element.append(ne)}showResultScreen(te,ne){this.element.innerHTML="";const ie=new ResultScreen({type:ne.type,contentElements:te,onSuccess:ne==null?void 0:ne.onSuccess,onError:ne==null?void 0:ne.onError});this.element.append(ie.element)}render(te){if(!te)throw new Error("Container element not found");te.appendChild(this.element)}destroy(){var te;(te=this.cardTabs)==null||te.destroy(),this.element.remove(),AstroPayCore.unregisterComponent(this)}}const getDividerStyles=ee=>css`
|
|
935
937
|
display: flex;
|
|
936
938
|
align-items: center;
|
|
937
939
|
gap: 10px;
|
|
@@ -1010,7 +1012,7 @@ Body:`)).call(gr,Oi()(vr)));var Fr=new XMLHttpRequest;Fr.open(De._method||ue.Pos
|
|
|
1010
1012
|
padding: 12px 0;
|
|
1011
1013
|
}
|
|
1012
1014
|
}
|
|
1013
|
-
`;class AccordionItem extends Component{constructor({icon:te,title:ne,description:ie,content:oe,isOpen:se=!1,tag:ae,auxImage:ue,isDisabled:ce=!1,onClick:le,onClose:de,onReady:fe}){super({tag:"div",styles:()=>getAccordionItemStyles()});xe(this,"isOpen");xe(this,"isDisabled");xe(this,"content");xe(this,"onClick");xe(this,"onClose");xe(this,"descriptionEl",null);xe(this,"accordionContent",null);xe(this,"arrowWrapper");xe(this,"header");this.isOpen=se,this.isDisabled=ce,this.content=oe,this.onClick=le,this.onClose=de,this.header=document.createElement("div"),this.header.classList.add("accordion-header"),this.isDisabled||this.header.addEventListener("click",this.handleClick.bind(this));const he=new Icon({name:te,size:ThemeManager.getFontScale().medium,color:ThemeManager.getStyles().textPrimaryColor}).element,pe=document.createElement("div");pe.classList.add("title-description-wrapper");const ge=document.createElement("div");ge.classList.add("title-aux-content-wrapper");const me=new Typography({variant:"div",size:"medium",weight:500,text:ne}).element;if(ae&&ae.text){const ve=new Badge({variant:(ae==null?void 0:ae.variant)||"success",items:[{title:ae.text}]}).element;ge.append(me,ve)}else ge.append(me);if(ie){const ve=new Typography({variant:"div",text:ie,size:"xSmall",weight:400,color:ThemeManager.getStyles().textSecondaryColor}).element;this.descriptionEl=ve,pe.append(ge,ve)}else pe.append(ge);this.header.append(he,pe);const ye=document.createElement("div");if(ye.classList.add("actions-wrapper"),ue&&ue.length){const ve=document.createElement("div");ve.classList.add("aux-icons-wrapper"),ue.forEach(be=>{const _e=new Icon({name:be,size:24}).element;ve.append(_e)}),ye.append(ve)}if(this.arrowWrapper=document.createElement("span"),this.arrowWrapper.classList.add("arrow-wrapper"),!this.isDisabled){const ve=new Icon({name:"arrow_down_line",size:24,color:ThemeManager.getStyles().textPrimaryColor}).element;this.arrowWrapper.append(ve)}ye.append(this.arrowWrapper),this.header.append(ye),this.element.append(this.header),this.isDisabled&&this.applyDisabledStyles(),(this.isOpen||this.isDisabled)&&(this.renderContent(),this.isDisabled||this.arrowWrapper.classList.add("rotated")),fe==null||fe(ve=>this.setDescription(ve))}setDescription(te){this.descriptionEl&&(this.descriptionEl.textContent=te)}handleClick(){var te
|
|
1015
|
+
`;class AccordionItem extends Component{constructor({icon:te,title:ne,description:ie,content:oe,isOpen:se=!1,tag:ae,auxImage:ue,isDisabled:ce=!1,onClick:le,onClose:de,onReady:fe}){super({tag:"div",styles:()=>getAccordionItemStyles()});xe(this,"isOpen");xe(this,"isDisabled");xe(this,"isLocked",!1);xe(this,"content");xe(this,"onClick");xe(this,"onClose");xe(this,"descriptionEl",null);xe(this,"accordionContent",null);xe(this,"arrowWrapper");xe(this,"header");this.isOpen=se,this.isDisabled=ce,this.content=oe,this.onClick=le,this.onClose=de,this.header=document.createElement("div"),this.header.classList.add("accordion-header"),this.isDisabled||this.header.addEventListener("click",this.handleClick.bind(this));const he=new Icon({name:te,size:ThemeManager.getFontScale().medium,color:ThemeManager.getStyles().textPrimaryColor}).element,pe=document.createElement("div");pe.classList.add("title-description-wrapper");const ge=document.createElement("div");ge.classList.add("title-aux-content-wrapper");const me=new Typography({variant:"div",size:"medium",weight:500,text:ne}).element;if(ae&&ae.text){const ve=new Badge({variant:(ae==null?void 0:ae.variant)||"success",items:[{title:ae.text}]}).element;ge.append(me,ve)}else ge.append(me);if(ie){const ve=new Typography({variant:"div",text:ie,size:"xSmall",weight:400,color:ThemeManager.getStyles().textSecondaryColor}).element;this.descriptionEl=ve,pe.append(ge,ve)}else pe.append(ge);this.header.append(he,pe);const ye=document.createElement("div");if(ye.classList.add("actions-wrapper"),ue&&ue.length){const ve=document.createElement("div");ve.classList.add("aux-icons-wrapper"),ue.forEach(be=>{const _e=new Icon({name:be,size:24}).element;ve.append(_e)}),ye.append(ve)}if(this.arrowWrapper=document.createElement("span"),this.arrowWrapper.classList.add("arrow-wrapper"),!this.isDisabled){const ve=new Icon({name:"arrow_down_line",size:24,color:ThemeManager.getStyles().textPrimaryColor}).element;this.arrowWrapper.append(ve)}ye.append(this.arrowWrapper),this.header.append(ye),this.element.append(this.header),this.isDisabled&&this.applyDisabledStyles(),(this.isOpen||this.isDisabled)&&(this.renderContent(),this.isDisabled||this.arrowWrapper.classList.add("rotated")),fe==null||fe(ve=>this.setDescription(ve))}setDescription(te){this.descriptionEl&&(this.descriptionEl.textContent=te)}handleClick(){var te;!this.isDisabled&&!this.isLocked&&((te=this.onClick)==null||te.call(this))}lock(){this.isLocked=!0,this.header.style.cursor="not-allowed",this.header.style.pointerEvents="none",this.header.style.opacity="0.4"}unlock(){this.isLocked=!1,this.header.style.cursor="",this.header.style.pointerEvents="",this.header.style.opacity=""}applyDisabledStyles(){this.header.style.cursor="default",this.header.style.pointerEvents="none"}toggleContent(){this.isDisabled||(this.isOpen||(this.renderContent(),this.arrowWrapper.classList.add("rotated"),setTimeout(()=>{var te;(te=this.accordionContent)==null||te.open()},100)),this.isOpen=!0)}destroyContent(){var te,ne;this.isDisabled||(this.isOpen&&((te=this.onClose)==null||te.call(this),(ne=this.accordionContent)==null||ne.close(),this.arrowWrapper.classList.remove("rotated"),setTimeout(()=>{var ie;(ie=this.accordionContent)==null||ie.destroyContent(),this.accordionContent=null},200)),this.isOpen=!1)}renderContent(){this.accordionContent||(this.accordionContent=new AccordionContent({content:this.content}),this.element.append(this.accordionContent.element),this.isOpen&&setTimeout(()=>{var te;(te=this.accordionContent)==null||te.open()},100))}}class Accordion extends Component{constructor({items:te,defaultActiveItem:ne,onChangeContent:ie}){super({tag:"div"});xe(this,"openIndex");xe(this,"accordionItems",[]);xe(this,"onChangeContent");xe(this,"hasSingleItem");this.hasSingleItem=te.length===1,this.openIndex=this.validateDefaultIndex(ne??null,te.length),this.accordionItems=te.map((oe,se)=>{const ae=this.openIndex===se,ue=this.hasSingleItem,ce=new AccordionItem({icon:oe.icon,title:oe.title,description:oe==null?void 0:oe.description,content:oe.content,isOpen:ae,isDisabled:ue,auxImage:oe.auxImage,tag:oe.tag,onClick:ue?void 0:()=>{var le;this.handleItemClick(se),this.openIndex===se&&((le=oe.onClickCallback)==null||le.call(oe))},onClose:oe.onClose,...oe.onReady&&{onReady:oe.onReady}});if(this.element.appendChild(ce.element),se!==te.length-1){const le=new Divider({text:se===0?AstroPayI18n.translate("or"):""}).element;le.style.padding="4px 0",this.element.appendChild(le)}return ce}),this.onChangeContent=ie}validateDefaultIndex(te,ne){return ne===1?0:te!==null&&te>=0&&te<ne?te:null}handleItemClick(te){var ne;this.openIndex===te?this.openIndex=null:((ne=this.onChangeContent)==null||ne.call(this),this.openIndex=te),this.updateItems()}updateItems(){this.accordionItems.forEach((te,ne)=>{this.openIndex===ne?te.toggleContent():te.destroyContent()})}closeAllItems(){this.openIndex=null,this.updateItems()}lockAll(){this.accordionItems.forEach(te=>te.lock())}unlockAll(){this.accordionItems.forEach(te=>te.unlock())}}const defineLinkStyles=({isDisabled:ee=!1})=>{const re=ThemeManager.getStyles();return ee?re.button.disabled.textColor:re.button.text.textColor},getLinkStyles=ee=>css`
|
|
1014
1016
|
color: ${defineLinkStyles({isDisabled:ee.isDisabled})};
|
|
1015
1017
|
cursor: ${ee.isDisabled?"not-allowed":"pointer"};
|
|
1016
1018
|
text-decoration: ${ee.underline!==!1?"underline":"none"};
|
|
@@ -1162,7 +1164,7 @@ Minimum version required to store current data is: `+Re+`.
|
|
|
1162
1164
|
align-items: center;
|
|
1163
1165
|
gap: 8px;
|
|
1164
1166
|
}
|
|
1165
|
-
`;class PaymentMethod extends Component{constructor(te){super({tag:"div",styles:ne=>getPaymentMethodStyles(ne)});xe(this,"componentProps");xe(this,"loadingWrapper");xe(this,"timerElement",null);xe(this,"timerInstance",null);xe(this,"pollingService",null);this.componentProps=te,this.loadingWrapper=this.createLoadingWrapper(),this.element.append(this.loadingWrapper),this.fetchPaymentMethodData()}createLoadingWrapper(){const te=document.createElement("div");te.classList.add("loading-wrapper");const ne=new Loading({size:100,variant:"fetching",color:ThemeManager.getStyles().primaryColor}).element,ie=new Typography({text:AstroPayI18n.translate("waiting_confirmation"),size:"base",lineHeight:30,weight:600}).element;ie.style.marginTop="8px";const oe=new Typography({text:AstroPayI18n.translate("do_not_close_window"),size:"medium",lineHeight:24}).element;return te.append(ne,ie,oe),te}async fetchPaymentMethodData(){var te;try{if((te=this.componentProps.paymentMethod)!=null&&te.uri){const ne={methodCode:this.componentProps.paymentMethod.code},ie=await PaymentService.postGenericPayment(this.componentProps.paymentMethod.uri,this.componentProps.paymentExternalId,ne);this.renderSections(ie.sections)}else throw new Error(AstroPayI18n.translate("generic_error"))}catch(ne){const ie=ne;this.showErrorMessage(ie.description??ie.message)}finally{this.loadingWrapper.remove()}}async checkPaymentStatus(){try{const te=await PaymentService.getPaymentStatus(this.componentProps.paymentExternalId);te.pollingStatus===EPollingStatus.ACCEPTED?this.initializePollingService(te):te.pollingStatus===EPollingStatus.FINISHED&&this.handlePaymentFinished(te)}catch(te){const ne=te;this.showErrorMessage(ne.description??ne.message),this.stopTimer(),this.stopPolling()}}initializePollingService(te){this.pollingService=new PollingService(te,ne=>this.showWaitingInfo(ne),ne=>this.handlePaymentFinished(ne),ne=>this.handlePollingError(ne)),this.pollingService.startPolling()}handlePollingError(te){if(typeof te=="object"&&te!==null&&"text"in te){const ie=te;this.showErrorMessage(ie.text)}else{const ie=te;this.showErrorMessage(ie.description??ie.message)}this.stopPolling()}stopTimer(){this.timerInstance&&(this.timerInstance.stopTimer(),this.timerInstance=null,this.timerElement=null)}handlePaymentFinished(te){te.data.status===EPaymentStatus.COMPLETED?this.handleSuccessSection(te.data.successSection):this.handleErrorSection(te.data.errorSection)}handleSuccessSection(te){if(!te)return;const ne=[],ie=new Status$1({type:"success",title:te.title,description:te.description}).element;ne.push(ie),this.componentProps.onSuccess?this.componentProps.onSuccess(ne):(this.element.innerHTML="",ne.forEach(oe=>this.element.append(oe)))}handleErrorSection(te){if(!te)return;const ne=[],ie=new Status$1({type:"error",title:te.title,description:te.description}).element;ne.push(ie),this.componentProps.onError?this.componentProps.onError(ne):(this.element.innerHTML="",ne.forEach(oe=>this.element.append(oe)))}showErrorMessage(te){this.element.innerHTML="";const ne=document.createElement("div");ne.classList.add("timeout-container");const ie=new Typography({text:te,size:ThemeManager.getFontScale().xSmall,color:ThemeManager.getStyles().messages.error.textColor}).element;ne.append(ie,this.renderRetryButton()),this.element.append(ne)}showWaitingInfo(te){let ne=this.element.querySelector(".loading-pooling");ne||(ne=document.createElement("div"),ne.classList.add("loading-pooling"),this.element.append(ne)),ne.innerHTML="";const ie=new Loading({size:12,color:ThemeManager.getStyles().textPrimaryColor}).element,oe=new Typography({text:te,size:"xSmall"}).element;ne.append(ie,oe)}async renderSections(te){te.filter(ne=>!!ne).sort((ne,ie)=>ne.order-ie.order).forEach(ne=>{const{componentType:ie,metadata:oe}=ne;switch(ie){case EComponentType.AMOUNT_DISPLAY:this.renderAmountDisplay(oe);break;case EComponentType.COPY:this.renderCopy(oe);break;case EComponentType.DESCRIPTION:this.renderDescription(oe);break;case EComponentType.EXPIRATION_TIMER:this.renderTimer(oe);break;case EComponentType.QR_CODE:this.renderQRCode(oe);break;case EComponentType.SHARE:this.renderShare(oe);break;default:console.warn("Unknown component type:",ie)}}),await this.checkPaymentStatus()}renderCopy(te){const ne=new Button({text:te.label,variant:"copy-to-clipboard",size:"medium",iconLeft:te.iconLeft,iconRight:te.iconRight??"copy_2_line",onClick:()=>{copyToClipboard(te.value)}}).element;this.element.append(ne)}renderShare(te){const ne=new Button({text:te.label,variant:"text",size:"medium",iconRight:te.iconRight,iconLeft:te.iconLeft,onClick:()=>{var ie,oe,se;shareInfo(((ie=te==null?void 0:te.richTextInfo)==null?void 0:ie.title)??"Share",((oe=te==null?void 0:te.richTextInfo)==null?void 0:oe.description)??te.value,(se=te==null?void 0:te.richTextInfo)==null?void 0:se.url)}}).element;this.element.append(ne)}renderDescription(te){const ne=new Typography({text:`${te.text} ${formatAmountCurrency(te.amount,te.currency,AstroPayConfig.getCurrencyMode())}`,size:"medium",lineHeight:24,weight:600}).element;this.element.append(ne)}renderQRCode(te){const ne=new QrCode({value:te.value,altText:AstroPayI18n.translate("qr_code")}).element;this.element.append(ne)}renderAmountDisplay(te){const ne=new Typography({text:te.value,size:"medium",lineHeight:24,weight:600}).element;this.element.append(ne)}renderTimer(te){this.timerInstance=new Timer({time:te.time,text:te.label,iconLeft:te.iconLeft,iconRight:te.iconRight,timeoutText:te.timeoutInfo.description,onTimeOut:()=>this.handleTimeout(te)}),this.timerElement=this.timerInstance.element,this.element.append(this.timerElement)}handleTimeout(te){this.stopPolling(),this.stopTimer();const ne=document.createElement("div");ne.classList.add("timeout-container"),this.timerElement&&ne.append(this.timerElement),te.timeoutInfo.description&&ne.append(this.renderExpiredBadge(te.timeoutInfo.description)),te.timeoutInfo.retry&&ne.append(this.renderRetryButton()),this.element.innerHTML="",this.element.append(ne)}renderRetryButton(){return new Button({text:AstroPayI18n.translate("try_again"),variant:"primary",size:"medium",iconRight:"refresh_2_fill",onClick:()=>{this.element.innerHTML="",this.timerElement=null,this.timerInstance=null,this.stopPolling(),this.element.append(this.loadingWrapper),this.fetchPaymentMethodData()}}).element}renderExpiredBadge(te){return new Badge({items:[{title:te,icon:"alert_line"}],variant:"default",align:"center"}).element}stopPolling(){this.pollingService&&(this.pollingService.stopPolling(),this.pollingService=null)}destroy(){this.stopPolling(),this.element.remove()}}const paymentIcons={[EPaymentCode.AP]:"astropay_payment_method",[EPaymentCode.IX]:"system_pix",[EPaymentCode.CREDIT_CARD]:"bank_card_line",[EPaymentCode.DEBIT_CARD]:"bank_card_line",[EPaymentCode.CW]:"bank_card_line",[EPaymentCode.DC]:"bank_card_line",[EPaymentCode.CC]:"bank_card_line",[EPaymentCode.QA]:"qrcode_line"},paymentAuxIcons={[EPaymentCode.CREDIT_CARD]:["payment_visa","payment_master"],[EPaymentCode.DEBIT_CARD]:["payment_visa","payment_master"],[EPaymentCode.CW]:["payment_visa","payment_master"],[EPaymentCode.DC]:["payment_visa","payment_master"],[EPaymentCode.CC]:["payment_visa","payment_master"]},callbackEvent=(ee,re)=>{switch(ee){case EPaymentCode.CREDIT_CARD:case EPaymentCode.DEBIT_CARD:case EPaymentCode.CW:case EPaymentCode.DC:case EPaymentCode.CC:AmplitudeAnalytics.astroPayPaymentCardClicked(re);break}},validatePaymentMethod=ee=>!!ee.enabled,createPaymentInstance=(ee,re)=>{const{paymentExternalId:te,amount:ne,currency:ie,country:oe,user:se,countries:ae,benefits:ue,cardConfig:ce,actionLabel:le,onSuccess:de,onError:fe}=re;switch(ee.code){case EPaymentCode.AP:return new AstroPayPaymentMethod({paymentExternalId:te,user:se,countries:ae,benefits:ue,paymentAmount:{amount:ne,currency:ie},actionLabel:le,onSuccess:de,onError:fe});default:return CARDS_METHOD.includes(ee.code)?new CardPaymentMethod({paymentExternalId:te,amount:ne,currency:ie,country:oe,paymentMethod:ee,showPaymentSummary:ce==null?void 0:ce.showPaymentSummary,expirationDateFormat:ce==null?void 0:ce.expirationDateFormat,onSuccess:de,onError:fe}):new PaymentMethod({paymentExternalId:te,paymentMethod:ee,onSuccess:de,onError:fe})}},buildMethodDescription=(ee,re)=>ee.map((te,ne)=>ne===re&&te.description?`${te.label} · ${te.description}`:te.label).join(" · "),buildCardGroupAccordionItem=(ee,re)=>{var ae;const{paymentExternalId:te}=re,ne=ee[0];let ie=null,oe=null;const se=ee.map((ue,ce)=>{let le=null;return{label:ue.label,content:()=>(le==null||le.destroy(),le=createPaymentInstance(ue,re),le.element),onClose:()=>{le==null||le.destroy(),le=null},onSelect:()=>{oe==null||oe(buildMethodDescription(ee,ce)),callbackEvent(ue.code,te)}}});return{icon:ne.logo||paymentIcons[ne.code]||"bank_card_line",title:ne.label,description:buildMethodDescription(ee,0),auxImage:paymentAuxIcons[ne.code]??["payment_visa","payment_master"],tag:(ae=ne==null?void 0:ne.metadata)==null?void 0:ae.tag,content:()=>(ie=new CardTabs({tabs:se,defaultActiveTab:0,variant:"segmented"}),ie.element),onClose:()=>{ie==null||ie.destroy(),ie=null},onClickCallback:()=>callbackEvent(ne.code,te),onReady:ue=>{oe=ue}}},mountPaymentMethodItems=({paymentMethods:ee,paymentExternalId:re,...te})=>{var fe;if(!(ee!=null&&ee.length))return[];const ne=ee.filter(validatePaymentMethod),ie={paymentExternalId:re,...te},oe=ne.filter(he=>CARDS_METHOD.includes(he.code)),ae=ne.filter(he=>!CARDS_METHOD.includes(he.code)).map(he=>{var ge;let pe=null;return{icon:he.logo||paymentIcons[he.code]||"pay_line",title:he.label,description:he==null?void 0:he.description,auxImage:paymentAuxIcons[he.code],tag:(ge=he==null?void 0:he.metadata)==null?void 0:ge.tag,content:()=>(pe==null||pe.destroy(),pe=createPaymentInstance(he,ie),pe.element),onClose:()=>{pe==null||pe.destroy(),pe=null},onClickCallback:()=>callbackEvent(he.code,re)}});if(oe.length<=1){const he=[...ae];if(oe.length===1){const pe=oe[0];let ge=null;const me={icon:pe.logo||paymentIcons[pe.code]||"pay_line",title:pe.label,description:pe==null?void 0:pe.description,auxImage:paymentAuxIcons[pe.code],tag:(fe=pe==null?void 0:pe.metadata)==null?void 0:fe.tag,content:()=>(ge==null||ge.destroy(),ge=createPaymentInstance(pe,ie),ge.element),onClose:()=>{ge==null||ge.destroy(),ge=null},onClickCallback:()=>callbackEvent(pe.code,re)},ye=ne.findIndex(be=>CARDS_METHOD.includes(be.code)),ve=ne.slice(0,ye).filter(be=>!CARDS_METHOD.includes(be.code)).length;he.splice(ve,0,me)}return he}const ue=buildCardGroupAccordionItem(oe,ie),ce=ne.findIndex(he=>CARDS_METHOD.includes(he.code)),le=ne.slice(0,ce).filter(he=>!CARDS_METHOD.includes(he.code)).length,de=[...ae];return de.splice(le,0,ue),de},getAstroPayFullCheckoutStyles=ee=>css`
|
|
1167
|
+
`;class PaymentMethod extends Component{constructor(te){super({tag:"div",styles:ne=>getPaymentMethodStyles(ne)});xe(this,"componentProps");xe(this,"loadingWrapper");xe(this,"timerElement",null);xe(this,"timerInstance",null);xe(this,"pollingService",null);this.componentProps=te,this.loadingWrapper=this.createLoadingWrapper(),this.element.append(this.loadingWrapper),this.fetchPaymentMethodData()}createLoadingWrapper(){const te=document.createElement("div");te.classList.add("loading-wrapper");const ne=new Loading({size:100,variant:"fetching",color:ThemeManager.getStyles().primaryColor}).element,ie=new Typography({text:AstroPayI18n.translate("waiting_confirmation"),size:"base",lineHeight:30,weight:600}).element;ie.style.marginTop="8px";const oe=new Typography({text:AstroPayI18n.translate("do_not_close_window"),size:"medium",lineHeight:24}).element;return te.append(ne,ie,oe),te}async fetchPaymentMethodData(){var te;try{if((te=this.componentProps.paymentMethod)!=null&&te.uri){const ne={methodCode:this.componentProps.paymentMethod.code},ie=await PaymentService.postGenericPayment(this.componentProps.paymentMethod.uri,this.componentProps.paymentExternalId,ne);this.renderSections(ie.sections)}else throw new Error(AstroPayI18n.translate("generic_error"))}catch(ne){const ie=ne;this.showErrorMessage(ie.description??ie.message)}finally{this.loadingWrapper.remove()}}async checkPaymentStatus(){try{const te=await PaymentService.getPaymentStatus(this.componentProps.paymentExternalId);te.pollingStatus===EPollingStatus.ACCEPTED?this.initializePollingService(te):te.pollingStatus===EPollingStatus.FINISHED&&this.handlePaymentFinished(te)}catch(te){const ne=te;this.showErrorMessage(ne.description??ne.message),this.stopTimer(),this.stopPolling()}}initializePollingService(te){this.pollingService=new PollingService(te,ne=>this.showWaitingInfo(ne),ne=>this.handlePaymentFinished(ne),ne=>this.handlePollingError(ne)),this.pollingService.startPolling()}handlePollingError(te){if(typeof te=="object"&&te!==null&&"text"in te){const ie=te;this.showErrorMessage(ie.text)}else{const ie=te;this.showErrorMessage(ie.description??ie.message)}this.stopPolling()}stopTimer(){this.timerInstance&&(this.timerInstance.stopTimer(),this.timerInstance=null,this.timerElement=null)}handlePaymentFinished(te){te.data.status===EPaymentStatus.COMPLETED?this.handleSuccessSection(te.data.successSection):this.handleErrorSection(te.data.errorSection)}handleSuccessSection(te){if(!te)return;const ne=[],ie=new Status$1({type:"success",title:te.title,description:te.description}).element;ne.push(ie),this.componentProps.onSuccess?this.componentProps.onSuccess(ne):(this.element.innerHTML="",ne.forEach(oe=>this.element.append(oe)))}handleErrorSection(te){if(!te)return;const ne=[],ie=new Status$1({type:"error",title:te.title,description:te.description}).element;ne.push(ie),this.componentProps.onError?this.componentProps.onError(ne):(this.element.innerHTML="",ne.forEach(oe=>this.element.append(oe)))}showErrorMessage(te){this.element.innerHTML="";const ne=document.createElement("div");ne.classList.add("timeout-container");const ie=new Typography({text:te,size:ThemeManager.getFontScale().xSmall,color:ThemeManager.getStyles().messages.error.textColor}).element;ne.append(ie,this.renderRetryButton()),this.element.append(ne)}showWaitingInfo(te){let ne=this.element.querySelector(".loading-pooling");ne||(ne=document.createElement("div"),ne.classList.add("loading-pooling"),this.element.append(ne)),ne.innerHTML="";const ie=new Loading({size:12,color:ThemeManager.getStyles().textPrimaryColor}).element,oe=new Typography({text:te,size:"xSmall"}).element;ne.append(ie,oe)}async renderSections(te){te.filter(ne=>!!ne).sort((ne,ie)=>ne.order-ie.order).forEach(ne=>{const{componentType:ie,metadata:oe}=ne;switch(ie){case EComponentType.AMOUNT_DISPLAY:this.renderAmountDisplay(oe);break;case EComponentType.COPY:this.renderCopy(oe);break;case EComponentType.DESCRIPTION:this.renderDescription(oe);break;case EComponentType.EXPIRATION_TIMER:this.renderTimer(oe);break;case EComponentType.QR_CODE:this.renderQRCode(oe);break;case EComponentType.SHARE:this.renderShare(oe);break;default:console.warn("Unknown component type:",ie)}}),await this.checkPaymentStatus()}renderCopy(te){const ne=new Button({text:te.label,variant:"copy-to-clipboard",size:"medium",iconLeft:te.iconLeft,iconRight:te.iconRight??"copy_2_line",onClick:()=>{copyToClipboard(te.value)}}).element;this.element.append(ne)}renderShare(te){const ne=new Button({text:te.label,variant:"text",size:"medium",iconRight:te.iconRight,iconLeft:te.iconLeft,onClick:()=>{var ie,oe,se;shareInfo(((ie=te==null?void 0:te.richTextInfo)==null?void 0:ie.title)??"Share",((oe=te==null?void 0:te.richTextInfo)==null?void 0:oe.description)??te.value,(se=te==null?void 0:te.richTextInfo)==null?void 0:se.url)}}).element;this.element.append(ne)}renderDescription(te){const ne=new Typography({text:`${te.text} ${formatAmountCurrency(te.amount,te.currency,AstroPayConfig.getCurrencyMode())}`,size:"medium",lineHeight:24,weight:600}).element;this.element.append(ne)}renderQRCode(te){const ne=new QrCode({value:te.value,altText:AstroPayI18n.translate("qr_code")}).element;this.element.append(ne)}renderAmountDisplay(te){const ne=new Typography({text:te.value,size:"medium",lineHeight:24,weight:600}).element;this.element.append(ne)}renderTimer(te){this.timerInstance=new Timer({time:te.time,text:te.label,iconLeft:te.iconLeft,iconRight:te.iconRight,timeoutText:te.timeoutInfo.description,onTimeOut:()=>this.handleTimeout(te)}),this.timerElement=this.timerInstance.element,this.element.append(this.timerElement)}handleTimeout(te){this.stopPolling(),this.stopTimer();const ne=document.createElement("div");ne.classList.add("timeout-container"),this.timerElement&&ne.append(this.timerElement),te.timeoutInfo.description&&ne.append(this.renderExpiredBadge(te.timeoutInfo.description)),te.timeoutInfo.retry&&ne.append(this.renderRetryButton()),this.element.innerHTML="",this.element.append(ne)}renderRetryButton(){return new Button({text:AstroPayI18n.translate("try_again"),variant:"primary",size:"medium",iconRight:"refresh_2_fill",onClick:()=>{this.element.innerHTML="",this.timerElement=null,this.timerInstance=null,this.stopPolling(),this.element.append(this.loadingWrapper),this.fetchPaymentMethodData()}}).element}renderExpiredBadge(te){return new Badge({items:[{title:te,icon:"alert_line"}],variant:"default",align:"center"}).element}stopPolling(){this.pollingService&&(this.pollingService.stopPolling(),this.pollingService=null)}destroy(){this.stopPolling(),this.element.remove()}}const paymentIcons={[EPaymentCode.AP]:"astropay_payment_method",[EPaymentCode.IX]:"system_pix",[EPaymentCode.CREDIT_CARD]:"bank_card_line",[EPaymentCode.DEBIT_CARD]:"bank_card_line",[EPaymentCode.CW]:"bank_card_line",[EPaymentCode.DC]:"bank_card_line",[EPaymentCode.CC]:"bank_card_line",[EPaymentCode.QA]:"qrcode_line"},paymentAuxIcons={[EPaymentCode.CREDIT_CARD]:["payment_visa","payment_master"],[EPaymentCode.DEBIT_CARD]:["payment_visa","payment_master"],[EPaymentCode.CW]:["payment_visa","payment_master"],[EPaymentCode.DC]:["payment_visa","payment_master"],[EPaymentCode.CC]:["payment_visa","payment_master"]},callbackEvent=(ee,re)=>{switch(ee){case EPaymentCode.CREDIT_CARD:case EPaymentCode.DEBIT_CARD:case EPaymentCode.CW:case EPaymentCode.DC:case EPaymentCode.CC:AmplitudeAnalytics.astroPayPaymentCardClicked(re);break}},validatePaymentMethod=ee=>!!ee.enabled,createPaymentInstance=(ee,re)=>{const{paymentExternalId:te,amount:ne,currency:ie,country:oe,user:se,countries:ae,benefits:ue,cardConfig:ce,actionLabel:le,onSuccess:de,onError:fe,onProcessingStart:he,onProcessingEnd:pe}=re;switch(ee.code){case EPaymentCode.AP:return new AstroPayPaymentMethod({paymentExternalId:te,user:se,countries:ae,benefits:ue,paymentAmount:{amount:ne,currency:ie},actionLabel:le,onSuccess:de,onError:fe});default:return CARDS_METHOD.includes(ee.code)?new CardPaymentMethod({paymentExternalId:te,amount:ne,currency:ie,country:oe,paymentMethod:ee,showPaymentSummary:ce==null?void 0:ce.showPaymentSummary,expirationDateFormat:ce==null?void 0:ce.expirationDateFormat,onSuccess:de,onError:fe,...he&&{onProcessingStart:he},...pe&&{onProcessingEnd:pe}}):new PaymentMethod({paymentExternalId:te,paymentMethod:ee,onSuccess:de,onError:fe})}},buildMethodDescription=(ee,re)=>ee.map((te,ne)=>ne===re&&te.description?`${te.label} · ${te.description}`:te.label).join(" · "),buildCardGroupAccordionItem=(ee,re)=>{var ae;const{paymentExternalId:te}=re,ne=ee[0];let ie=null,oe=null;const se=ee.map((ue,ce)=>{let le=null;return{label:ue.label,content:()=>(le==null||le.destroy(),le=createPaymentInstance(ue,{...re,onProcessingStart:()=>{var de;ie==null||ie.lock(),(de=re.onProcessingStart)==null||de.call(re)},onProcessingEnd:()=>{var de;ie==null||ie.unlock(),(de=re.onProcessingEnd)==null||de.call(re)}}),le.element),onClose:()=>{le==null||le.destroy(),le=null},onSelect:()=>{oe==null||oe(buildMethodDescription(ee,ce)),callbackEvent(ue.code,te)}}});return{icon:ne.logo||paymentIcons[ne.code]||"bank_card_line",title:ne.label,description:buildMethodDescription(ee,0),auxImage:paymentAuxIcons[ne.code]??["payment_visa","payment_master"],tag:(ae=ne==null?void 0:ne.metadata)==null?void 0:ae.tag,content:()=>(ie=new CardTabs({tabs:se,defaultActiveTab:0,variant:"segmented"}),ie.element),onClose:()=>{ie==null||ie.destroy(),ie=null},onClickCallback:()=>callbackEvent(ne.code,te),onReady:ue=>{oe=ue}}},mountPaymentMethodItems=({paymentMethods:ee,paymentExternalId:re,...te})=>{var fe;if(!(ee!=null&&ee.length))return[];const ne=ee.filter(validatePaymentMethod),ie={paymentExternalId:re,...te},oe=ne.filter(he=>CARDS_METHOD.includes(he.code)),ae=ne.filter(he=>!CARDS_METHOD.includes(he.code)).map(he=>{var ge;let pe=null;return{icon:he.logo||paymentIcons[he.code]||"pay_line",title:he.label,description:he==null?void 0:he.description,auxImage:paymentAuxIcons[he.code],tag:(ge=he==null?void 0:he.metadata)==null?void 0:ge.tag,content:()=>(pe==null||pe.destroy(),pe=createPaymentInstance(he,ie),pe.element),onClose:()=>{pe==null||pe.destroy(),pe=null},onClickCallback:()=>callbackEvent(he.code,re)}});if(oe.length<=1){const he=[...ae];if(oe.length===1){const pe=oe[0];let ge=null;const me={icon:pe.logo||paymentIcons[pe.code]||"pay_line",title:pe.label,description:pe==null?void 0:pe.description,auxImage:paymentAuxIcons[pe.code],tag:(fe=pe==null?void 0:pe.metadata)==null?void 0:fe.tag,content:()=>(ge==null||ge.destroy(),ge=createPaymentInstance(pe,ie),ge.element),onClose:()=>{ge==null||ge.destroy(),ge=null},onClickCallback:()=>callbackEvent(pe.code,re)},ye=ne.findIndex(be=>CARDS_METHOD.includes(be.code)),ve=ne.slice(0,ye).filter(be=>!CARDS_METHOD.includes(be.code)).length;he.splice(ve,0,me)}return he}const ue=buildCardGroupAccordionItem(oe,ie),ce=ne.findIndex(he=>CARDS_METHOD.includes(he.code)),le=ne.slice(0,ce).filter(he=>!CARDS_METHOD.includes(he.code)).length,de=[...ae];return de.splice(le,0,ue),de},getAstroPayFullCheckoutStyles=ee=>css`
|
|
1166
1168
|
background-color: ${ee.backgroundColor};
|
|
1167
1169
|
|
|
1168
1170
|
display: flex;
|
|
@@ -1182,7 +1184,7 @@ Minimum version required to store current data is: `+Re+`.
|
|
|
1182
1184
|
gap: 8px;
|
|
1183
1185
|
min-height: 250px;
|
|
1184
1186
|
}
|
|
1185
|
-
`;class AstroPayFullCheckout extends Component{constructor(te){super({tag:"div",elementId:"payment-component",styles:ie=>getAstroPayFullCheckoutStyles(ie)});xe(this,"loadingWrapper");xe(this,"componentProps");xe(this,"accPaymentMethods");if(te.paymentExternalId){const ie=te;this.componentProps={...ie,showTitle:ie.showTitle??!0,showDescription:ie.showDescription??!0}}else{const ie=te;this.componentProps={...ie,showTitle:ie.showTitle??!0,showDescription:ie.showDescription??!0,country:ie.country.trim().toUpperCase(),currency:ie.currency.trim().toUpperCase()}}AstroPayCore.registerComponent(this),AmplitudeAnalytics.astroPayPaymentImpression("AstroPayFullCheckout"),this.loadingWrapper=document.createElement("div"),this.loadingWrapper.classList.add("loading-wrapper");const ne=new Loading({size:100,variant:"fetching",color:ThemeManager.getStyles().primaryColor}).element;this.loadingWrapper.append(ne),this.element.appendChild(this.loadingWrapper),DataDogTracker.trackEvent("ap_cl_full_checkout_init"),this.createPayment()}async createPayment(){var te,ne;try{let ie;if(this.componentProps.paymentExternalId)ie=await PaymentService.getPaymentDetails(this.componentProps.paymentExternalId,"full_checkout");else{const{description:oe,paymentLink:se}=this.componentProps;ie=await PaymentService.postCreatePayment({country:this.componentProps.country,currency:this.componentProps.currency,amount:this.componentProps.amount,user:this.componentProps.user,order:this.componentProps.order,description:oe,paymentLink:se},"full_checkout")}this.renderPaymentMethods(ie)}catch(ie){const oe=ie;(ne=(te=this.componentProps)==null?void 0:te.onError)==null||ne.call(te);const se=new Typography({text:oe.description??oe.message,size:ThemeManager.getFontScale().xSmall,color:ThemeManager.getStyles().messages.error.textColor}).element;this.element.appendChild(se)}finally{this.loadingWrapper.remove()}}renderPaymentMethods(te){var ye,ve,be;const{paymentExternalId:ne,user:ie,paymentMethods:oe,countries:se,paymentComponentDescription:ae,benefits:ue,metadata:ce,paymentAmount:le,paymentCountry:de}=te;if(this.element.innerHTML="",this.componentProps.showTitle){const _e=new Typography({text:AstroPayI18n.translate("checkout_method"),variant:"div",size:"large",weight:600}).element;this.element.append(_e)}if(this.componentProps.showDescription&&ae){const _e=new Typography({text:ae,size:"small",color:ThemeManager.getStyles().textSecondaryColor,weight:400}).element;this.element.append(_e)}const fe={code:EPaymentCode.AP,label:((ye=te==null?void 0:te.metadata)==null?void 0:ye.title)||AstroPayI18n.translate("astro_express_checkout"),description:(ve=te==null?void 0:te.metadata)==null?void 0:ve.description,enabled:!0},he=(le==null?void 0:le.amount)??this.componentProps.amount,pe=(le==null?void 0:le.currency)??this.componentProps.currency,ge=de??this.componentProps.country;if(he===void 0||pe===void 0||ge===void 0)throw new Error(AstroPayI18n.translate("generic_error"));const me=mountPaymentMethodItems({paymentMethods:[fe,...oe??[]],paymentExternalId:ne,amount:he,currency:pe,country:ge,user:ie,countries:se,benefits:ue,actionLabel:ce==null?void 0:ce.actionLabel,onSuccess:_e=>this.showResultScreen(_e,{type:"success",onSuccess:this.componentProps.onSuccess}),onError:_e=>this.showResultScreen(_e,{type:"error",onError:this.componentProps.onError}),cardConfig:(be=this.componentProps)==null?void 0:be.cardConfig});me.length>0&&(this.accPaymentMethods=new Accordion({items:me,defaultActiveItem:0}),this.element.append(this.accPaymentMethods.element))}showResultScreen(te,ne){this.element.innerHTML="";const ie=new ResultScreen({type:ne.type,contentElements:te,onSuccess:ne==null?void 0:ne.onSuccess,onError:ne==null?void 0:ne.onError});this.element.append(ie.element)}render(te){if(!te)throw new Error("Container element not found");te.appendChild(this.element)}destroy(){this.element.remove(),AstroPayCore.unregisterComponent(this)}}const getAstroPayPaymentStyles=ee=>css`
|
|
1187
|
+
`;class AstroPayFullCheckout extends Component{constructor(te){super({tag:"div",elementId:"payment-component",styles:ie=>getAstroPayFullCheckoutStyles(ie)});xe(this,"loadingWrapper");xe(this,"componentProps");xe(this,"accPaymentMethods");if(te.paymentExternalId){const ie=te;this.componentProps={...ie,showTitle:ie.showTitle??!0,showDescription:ie.showDescription??!0}}else{const ie=te;this.componentProps={...ie,showTitle:ie.showTitle??!0,showDescription:ie.showDescription??!0,country:ie.country.trim().toUpperCase(),currency:ie.currency.trim().toUpperCase()}}AstroPayCore.registerComponent(this),AmplitudeAnalytics.astroPayPaymentImpression("AstroPayFullCheckout"),this.loadingWrapper=document.createElement("div"),this.loadingWrapper.classList.add("loading-wrapper");const ne=new Loading({size:100,variant:"fetching",color:ThemeManager.getStyles().primaryColor}).element;this.loadingWrapper.append(ne),this.element.appendChild(this.loadingWrapper),DataDogTracker.trackEvent("ap_cl_full_checkout_init"),this.createPayment()}async createPayment(){var te,ne;try{let ie;if(this.componentProps.paymentExternalId)ie=await PaymentService.getPaymentDetails(this.componentProps.paymentExternalId,"full_checkout");else{const{description:oe,paymentLink:se}=this.componentProps;ie=await PaymentService.postCreatePayment({country:this.componentProps.country,currency:this.componentProps.currency,amount:this.componentProps.amount,user:this.componentProps.user,order:this.componentProps.order,description:oe,paymentLink:se},"full_checkout")}this.renderPaymentMethods(ie)}catch(ie){const oe=ie;(ne=(te=this.componentProps)==null?void 0:te.onError)==null||ne.call(te);const se=new Typography({text:oe.description??oe.message,size:ThemeManager.getFontScale().xSmall,color:ThemeManager.getStyles().messages.error.textColor}).element;this.element.appendChild(se)}finally{this.loadingWrapper.remove()}}renderPaymentMethods(te){var ye,ve,be;const{paymentExternalId:ne,user:ie,paymentMethods:oe,countries:se,paymentComponentDescription:ae,benefits:ue,metadata:ce,paymentAmount:le,paymentCountry:de}=te;if(this.element.innerHTML="",this.componentProps.showTitle){const _e=new Typography({text:AstroPayI18n.translate("checkout_method"),variant:"div",size:"large",weight:600}).element;this.element.append(_e)}if(this.componentProps.showDescription&&ae){const _e=new Typography({text:ae,size:"small",color:ThemeManager.getStyles().textSecondaryColor,weight:400}).element;this.element.append(_e)}const fe={code:EPaymentCode.AP,label:((ye=te==null?void 0:te.metadata)==null?void 0:ye.title)||AstroPayI18n.translate("astro_express_checkout"),description:(ve=te==null?void 0:te.metadata)==null?void 0:ve.description,enabled:!0},he=(le==null?void 0:le.amount)??this.componentProps.amount,pe=(le==null?void 0:le.currency)??this.componentProps.currency,ge=de??this.componentProps.country;if(he===void 0||pe===void 0||ge===void 0)throw new Error(AstroPayI18n.translate("generic_error"));const me=mountPaymentMethodItems({paymentMethods:[fe,...oe??[]],paymentExternalId:ne,amount:he,currency:pe,country:ge,user:ie,countries:se,benefits:ue,actionLabel:ce==null?void 0:ce.actionLabel,onSuccess:_e=>this.showResultScreen(_e,{type:"success",onSuccess:this.componentProps.onSuccess}),onError:_e=>this.showResultScreen(_e,{type:"error",onError:this.componentProps.onError}),cardConfig:(be=this.componentProps)==null?void 0:be.cardConfig,onProcessingStart:()=>{var _e;return(_e=this.accPaymentMethods)==null?void 0:_e.lockAll()},onProcessingEnd:()=>{var _e;return(_e=this.accPaymentMethods)==null?void 0:_e.unlockAll()}});me.length>0&&(this.accPaymentMethods=new Accordion({items:me,defaultActiveItem:0}),this.element.append(this.accPaymentMethods.element))}showResultScreen(te,ne){this.element.innerHTML="";const ie=new ResultScreen({type:ne.type,contentElements:te,onSuccess:ne==null?void 0:ne.onSuccess,onError:ne==null?void 0:ne.onError});this.element.append(ie.element)}render(te){if(!te)throw new Error("Container element not found");te.appendChild(this.element)}destroy(){this.element.remove(),AstroPayCore.unregisterComponent(this)}}const getAstroPayPaymentStyles=ee=>css`
|
|
1186
1188
|
background-color: ${ee.backgroundColor};
|
|
1187
1189
|
|
|
1188
1190
|
display: flex;
|