var Sequra;(()=>{var e={843:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateNumber=t.resetPromotionalWidget=t.removeElement=t.parseValue=t.parseNumber=t.isIframeNameValid=t.iframeTitles=t.getIframeTitle=t.generateUID=t.createProps=t.createIframe=t.buildIframeURL=t.applyStyles=void 0;var a=o(132);const n=e=>{if(!e)return{value:"0",valid:!1,errors:[],warnings:["No number passed. Amount for sample case will be used"]};const t=e.match(/\d+[.,]?/g);t.length>1&&(t[t.length-1]=`${t[t.length-1]}00`.slice(0,2));const o=t.join("").replace(/\D/g,"");return e!==o&&o?{value:o,valid:!0,errors:[],warnings:[`Invalid amount ${e}, expected cents. Using ${o} as amount`]}:{value:e,valid:!0,errors:[],warnings:[]}};t.validateNumber=n,t.parseNumber=e=>{const{valid:t,value:o,warnings:a,errors:r}=n(e);if((e=>{e.forEach((e=>console.error(`[SeQura] ${e}`)))})(r),(e=>{e.forEach((e=>console.warn(`[SeQura] ${e}`)))})(a),t)return o};const r={"educational-popup":"414c7388055f7ee80665","promotion-widget":"405cb27ed3e18ba11836"},i=e=>Object.keys(r).includes(e);t.isIframeNameValid=i;const s=e=>{let{iframeName:t,params:o={}}=e;if(!i(t))return null;const a=new URL(`https://live.sequracdn.com/assets/static/${t}.${r[t]}.html`);for(const e in o)if(o.hasOwnProperty(e)){const t="object"==typeof o[e]?encodeURIComponent(JSON.stringify(o[e])):encodeURIComponent(o[e]);a.searchParams.append(e,t)}return a.href};t.buildIframeURL=s,t.removeElement=e=>{let{selector:t}=e;(0,a.querySelectorAll)(document,t).forEach((e=>{e.remove()}))};const l={border:0,width:"100%",height:"100%"},u={"educational-popup":{height:"100%",width:"100%",position:"fixed",top:"0",left:"0",right:"0",bottom:"0",zIndex:"99999999",transition:"opacity .2s ease-in-out"},"promotion-widget":{width:"100%",position:"relative",display:"inline-block"}},c=e=>{let{element:t,styles:o}=e;for(const e in o)t.style[e]=o[e]};t.applyStyles=c;const d={logLevel:"error",version:"latest"},m=e=>{let t="";for(let o=0;o{let t,o,{product:a,locale:n}=e;switch(a){case"pp5":t="pp5";break;case"i1":t="i1";break;default:t="pp3"}switch(n){case"pt-PT":o="pt";break;case"fr-FR":o="fr";break;case"it-IT":o="it";break;default:o="es"}return p[t][o]};t.getIframeTitle=f,t.createIframe=e=>{let{params:t,selector:o,classname:a,iframeName:n}=e;if(!i(n))return null;const r=m(10),p=document.createElement("div");p.className=a+"Wrapper",p.id=a+`Wrapper-${r}`,c({element:p,styles:u[n]});const g=document.createElement("iframe");g.src=s({iframeName:n,params:{...t,...d,uid:r}}),g.id=r,g.className=a,g.loading="eager",g.title=f({product:t.product,locale:t.locale}),c({element:g,styles:l}),p.appendChild(g);let h=o;"object"!=typeof o&&(h=document.querySelector(o)||window.document.body),h.appendChild(p)},t.createProps=e=>{let{product:t,campaign:o,totalWithTax:n,theme:r,reverse:i,registrationAmount:s,openContext:l,config:u}=e;const c=(0,a.getProductConfigFromProductsConfig)({productConfig:u.productsConfig,product:t,campaign:o});if(!c.valid)throw new Error("Invalid product config");let d=s;void 0!==s&&(d=parseInt(s));return{env:u.env,formatterConfig:u.formatterConfig,merchant:u.merchant,product:t,productConfig:{...c.value,registration_total:d},totalWithTax:n,theme:r,reverse:i,silent:u.silent,disclaimers:c?.value?.disclaimers,openContext:l}},t.parseValue=e=>{try{return JSON.parse(e)}catch(e){return}},t.resetPromotionalWidget=e=>{let t=document.getElementById(e);for(;t;){if(t.classList.contains("sequra-promotion-widget")){t.removeAttribute("data-loaded");break}t=t.parentNode}document.getElementById(e).remove(),document.getElementById("Sequra__PromotionalWidgetWrapper-"+e).remove()}},178:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateConfiguration=t.renderEducationalPopup=t.refreshComponents=t.onLoad=t.default=t.computeCreditAgreements=void 0;var a=o(106),n=o(225),r=o(843),i=o(132);const s={},l=t.renderEducationalPopup=function(e,t,o){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"body",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";const i={env:s.env,merchant:s.merchant,product:e,totalWithTax:o};""!==n&&(i.openContext=n),t&&(i.campaign=t),(0,r.createIframe)({params:i,selector:a,classname:"Sequra__EducationalPopup",iframeName:"educational-popup"})},u=function(){try{(0,i.querySelectorAll)(document,".sequra-educational-popup").forEach((e=>{const{loaded:t}=e.dataset;t||(e.setAttribute("data-loaded",1),e.addEventListener("click",(t=>{t.stopPropagation();const{product:o,campaign:a,amount:n}=e.dataset,i=(0,r.parseNumber)(n);l(o,a,i)})))}))}catch(e){throw e}},c=function(){try{(0,i.querySelectorAll)(document,".sequra-promotion-widget").forEach((e=>{const{product:t,campaign:o,amount:a,theme:n,reverse:l,loaded:u,registrationAmount:c,...d}=e.dataset;let m;if(Object.keys(d).length>0){const e=["type","size","fontColor","backgroundColor","alignment","branding","startingText","amountFontSize","amountFontColor","amountFontBold","linkFontColor","linkUnderline","borderColor","borderRadius","noCostsClaim","version"],t=new i.ThemeBuilder;e.forEach((e=>{t[e]=d[e]})),m=t.theme}else m=(0,i.themeFactory)({theme:n});const p={env:s.env,merchant:s.merchant,product:t,totalWithTax:(0,r.parseNumber)(a),campaign:o,theme:m,reverse:l,locale:s.formatterConfig.locale,registrationAmount:void 0!==c?parseInt(c):null};if(!u){if("pp5"===t&&!o)return;(0,r.createIframe)({params:p,selector:e,classname:"Sequra__PromotionalWidget",iframeName:"promotion-widget"}),e.setAttribute("data-loaded",1)}if(u)try{const n=(0,r.createProps)({product:t,campaign:o,totalWithTax:(0,r.parseNumber)(a),theme:m,reverse:l,registrationAmount:c,config:s});e.querySelector(".Sequra__PromotionalWidget").contentWindow.postMessage({action:"Sequra.refreshWidget",data:n},"*")}catch(e){console.warn(`[SeQura] Promotional widget for product ${t} ${o?`with campaign ${o}`:""} not updated.`)}}))}catch(e){throw e}},d=()=>{c(),u()};t.refreshComponents=d;const m=t.onLoad=function e(t){try{"function"==typeof t?s.isReady?t():setTimeout((()=>{e(t)}),500):console.warn("[SeQura] Expected onLoad parameter to be a function")}catch(e){throw e}};t.default=async e=>{try{s.env="production",s.merchant=e.merchant,s.assetKey=e.assetKey,s.products=e.products,s.silent=e.silent,s.formatterConfig={decimalSeparator:e.decimalSeparator,thousandSeparator:e.thousandSeparator,locale:e.locale,currency:e.currency};const{merchant:t,assetKey:o,products:a}=s;s.productsConfig={};const n=await(0,i.fetchProductsConfig)({merchant:t,assetKey:o,products:a});s.productsConfig=n,s.productsConfig?(s.isReady=!0,window.addEventListener("message",(e=>{try{const t=(0,r.parseValue)(e?.data);switch(t.action){case"Sequra.closingPopup":(0,r.removeElement)({selector:".Sequra__EducationalPopupWrapper"});break;case"Sequra.openPopup":const{totalWithTax:e,productConfig:o}=t.params;l(o.product,o.campaign,e,void 0,void 0);break;case"Sequra.defineWidgetHeight":const{uid:a,height:n}=t.params;document.getElementById(a).style.height=n+"px",document.getElementById("Sequra__PromotionalWidgetWrapper-"+a).style.height=n+"px";break;case"Sequra.getProductConfig":const{uid:u,product:c,campaign:d}=t.data;try{const e=(0,i.getProductConfigFromProductsConfig)({productConfig:s.productsConfig,product:c,campaign:d});if(e.valid){const o={env:s.env,formatterConfig:s.formatterConfig,merchant:s.merchant,product:c,campaign:d,productConfig:{...e.value,registration_total:t.data.registrationAmount||null},silent:s.silent,disclaimers:e.value.disclaimers||[]};document.getElementById(u).contentWindow.postMessage({data:{...o,uid:u},action:"Sequra.postProductConfig"},"https://live.sequracdn.com/assets")}else(0,r.resetPromotionalWidget)(u)}catch(e){console.warn(`[SeQura] Educational popup for product ${c} ${d?`with campaign ${d}`:""} not rendered.`)}}}catch(e){}})),window.SequraOnLoad.forEach((e=>{m(e)})),c(),u()):console.warn(`[SeQura] Could not fetch product information with merchant ${t} and assetKey ${o}, review your credentials.`)}catch(e){throw e}},t.updateConfiguration=async e=>{try{const{merchant:t,assetKey:o,products:a,decimalSeparator:n,thousandSeparator:r,locale:l,currency:u,rebranding:c,silent:m}=e;if(!t||!o||!a)return void console.warn('[SeQura] "merchant", "assetKey" and "products" are required.');const p=await(0,i.fetchProductsConfig)({merchant:t,assetKey:o,products:a});if(!p)throw console.warn(`[SeQura] Could not fetch product information with merchant ${t} and assetKey ${o}, review your credentials.`),new Error("updateConfigurationError");s.productsConfig=p,s.merchant=t,s.assetKey=o,s.products=a,s.silent=m,s.formatterConfig={decimalSeparator:n||s.formatterConfig?.decimalSeparator,thousandSeparator:r||s.formatterConfig?.thousandSeparator,locale:l||s.formatterConfig?.locale,currency:u||s.formatterConfig?.currency},c&&(s.rebranding=c),d()}catch(e){throw e}},t.computeCreditAgreements=e=>{const{product:t,amount:o,campaign:r,instalmentCount:i,registrationTotal:l}=e||{};if((0,a.isEmpty)(o))return console.warn("[SeQura] Mandatory 'amount' for computeCreditAgreements"),{};let u={};return Object.values(s.productsConfig).forEach((e=>{(e instanceof Array?e:[e]).forEach((e=>{const t=(0,n.computeCreditAgreement)({totalWithTax:parseInt(o,10),formatterConfig:s.formatterConfig,productConfig:{...e,registration_total:l?parseInt(l,10):void 0}})[e.product];(0,a.isEmpty)(t)||(u[e.product]=u[e.product]||[],t.forEach((t=>u[e.product].push(t))))}))})),(0,a.isEmpty)(t)||(u=Object.keys(u).filter((e=>e===t)).reduce(((e,t)=>({...e,[t]:u[t]})),{})),(0,a.isEmpty)(r)||(u=Object.keys(u).reduce(((e,t)=>({...e,[t]:u[t].filter((e=>e.campaign===r))})),{})),(0,a.isEmpty)(i)||(u=Object.keys(u).reduce(((e,t)=>({...e,[t]:u[t].filter((e=>e.instalment_count===i))})),{})),u=Object.keys(u).reduce(((e,t)=>(0,a.isEmpty)(u[t])?e:{...e,[t]:u[t]}),{}),u}},1:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a,n=(a=o(931))&&a.__esModule?a:{default:a};t.default=class{constructor(){this.object=(0,n.default)()}set class(e){this.object.class=e||this.object.class}set type(e){this.object.type=e||this.object.type}set size(e){this.object.size=e||this.object.size}set fontColor(e){this.object.fontColor=e||this.object.fontColor}set backgroundColor(e){this.object.backgroundColor=e||this.object.backgroundColor}set alignment(e){this.object.alignment=e||this.object.alignment}set branding(e){this.object.branding=e||this.object.branding}set startingText(e){this.object.startingText=e||this.object.startingText}set amountFontSize(e){this.object.amountFontSize=e||this.object.amountFontSize}set amountFontColor(e){this.object.amountFontColor=e||this.object.amountFontColor}set amountFontBold(e){this.object.amountFontBold=e||this.object.amountFontBold}set linkFontColor(e){this.object.linkFontColor=e||this.object.linkFontColor}set linkUnderline(e){this.object.linkUnderline=e||this.object.linkUnderline}set borderColor(e){this.object.borderColor=e||this.object.borderColor}set borderRadius(e){this.object.borderRadius=e||this.object.borderRadius}set noCostsClaim(e){this.object.noCostsClaim=e||this.object.noCostsClaim}set version(e){this.object.version=e||this.object.version}get theme(){return this.object}}},934:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.default}});var a,n=(a=o(1))&&a.__esModule?a:{default:a}},914:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=async e=>{let t,{merchant:o,assetKey:a,products:n}=e;if(n.includes("i1")&&(t={i1:{product:"i1",purchase_credit_days:7}},n.splice(n.indexOf("i1"),1)),n.length>0)try{const e=await fetch(`https://live.sequracdn.com/scripts/${o}/${a}/${n.join("_")}_cost.json`);if(!e.ok)throw new Error("Request failed");const r=await e.json();t={...t,...r}}catch(e){console.log(e)}return t}},889:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=e=>{let{productConfig:t,product:o,campaign:a}=e;const n="pp5"===o?(t[o]||[]).find((e=>e.campaign===a)):t[o],r={valid:!0,value:null,warnings:[],errors:[]};return n?(r.value=n,r):(r.valid=!1,r.errors=[`Product ${o} ${a?`with campaign ${a}`:""} not found or expired.`],r)}},132:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ThemeBuilder",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"fetchProductsConfig",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"getProductConfigFromProductsConfig",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"querySelectorAll",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"themeBaseFactory",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"themeFactory",{enumerable:!0,get:function(){return r.default}});var a=u(o(931)),n=u(o(934)),r=u(o(136)),i=u(o(889)),s=u(o(914)),l=u(o(193));function u(e){return e&&e.__esModule?e:{default:e}}},106:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEqual=t.isEmpty=void 0,t.isEmpty=e=>null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length,t.isEqual=(e,t)=>JSON.stringify(e)===JSON.stringify(t)},193:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=(e,t)=>[...e.querySelectorAll(t)]},931:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;const o={class:"",type:"text",size:"M",fontColor:"",backgroundColor:"",alignment:"center",branding:"default",startingText:"only",amountFontSize:"",amountFontColor:"",amountFontBold:"",linkFontColor:"",linkUnderline:"",borderColor:"",borderRadius:"",noCostsClaim:"",version:""};t.default=()=>Object.assign({},o)},136:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.default}});var a,n=(a=o(253))&&a.__esModule?a:{default:a}},253:(e,t,o)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(o(931)),n=r(o(934));function r(e){return e&&e.__esModule?e:{default:e}}t.default=function(){let{theme:e="default"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,a.default)(),o={default:{...t,type:"banner"},white:{...t,type:"banner",backgroundColor:"white"},legacy:{...t,type:"legacy"},"legacy-negative":{...t,type:"legacy",fontColor:"white",branding:"white"}},r=o[e]||o.default,i=new n.default;return i.type=r.type,i.size=r.size,i.fontColor=r.fontColor,i.backgroundColor=r.backgroundColor,i.alignment=r.alignment,i.branding=r.branding,i.startingText=r.startingText,i.amountFontSize=r.amountFontSize,i.amountFontColor=r.amountFontColor,i.amountFontBold=r.amountFontBold,i.linkFontColor=r.linkFontColor,i.linkUnderline=r.linkUnderline,i.borderColor=r.borderColor,i.borderRadius=r.borderRadius,i.noCostsClaim=r.noCostsClaim,i.version=r.version,i.theme}},225:function(e,t){!function(e){"use strict";const t="es-ES",o="EUR",a=function(e){let{decimalSeparator:a,thousandSeparator:n,currency:r=o,locale:i=t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=Number((e/100).toFixed(2));return new Intl.NumberFormat(i,{style:"currency",currency:r}).formatToParts(s).map((e=>{let{type:t,value:o}=e;switch(t){case"group":return n||o;case"decimal":return a||o;default:return o}})).join("")},n=function(e){let{percentageSymbol:o,decimalSeparator:a,thousandSeparator:n,locale:r=t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=parseFloat(e).toFixed(2)/100;return new Intl.NumberFormat(r,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}).formatToParts(i).map((e=>{let{type:t,value:r}=e;switch(t){case"group":return n||r;case"decimal":return a||r;case"unit":return o||r;default:return r}})).join("")},r=e=>parseInt(e.toFixed(2).replace(".",""),10),i=function(e){let{locale:o=t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Date(e).toLocaleDateString(o,{day:"numeric",month:"long"})};var s=(e,t)=>{const o=t.find((t=>{let[o]=t;return o>e}));return o?o[1]:t.slice().pop()[1]};const l=(e,t,o)=>{if(e.max-e.min>1e-5){const a=(e.min+e.max)/2,n=((e,t)=>Object.keys(e).map((o=>e[o]*(1+t)**(-o/365))).reduce(((e,t)=>e+t),0))(o,a),r=e;return n-t>0?r.min=a:r.max=a,l(r,t,o)}return(e.min+e.max)/2};var u=(e,t,o)=>{const a=Object.values(t).reduce(((e,t)=>e+t),0);if(e>a)throw Error(`Initial debt (${e}) cannot be higher than total payments (${a})`);if(e<0)throw Error(`Initial debt (${e}) cannot be lower than 0`);const n=Object.keys(t).reduce(((e,a)=>{const n=new Date(a),r=new Date(o);return e[Math.ceil(function(e,t){const o=Math.abs(t.getTime()-e.getTime());return Math.round(o/864e5)}(n,r))]=t[a],e}),{}),r=((e,t,o)=>{let a=(o/e)**(1/(Object.keys(t)[0]/365))-1;return a>1e4&&(a=1e4),{min:0,max:a}})(e,n,a);return 100*l(r,e,n)};function c(e,t){if(!(e instanceof Date)||Number.isNaN(e))throw new Error("Invalid date object");if("number"!=typeof t||!Number.isInteger(t))throw new Error("Months must be a valid integer");const o=new Date(e);return o.setMonth(o.getMonth()+t),o.toISOString()}var d=e=>{const t=[...e].sort(((e,t)=>t.instalment_count-e.instalment_count)),o=t.findIndex((e=>e.instalment_total.value/e.instalment_amount.value<=1.2));return t[o>=0?o:t.length-1].default=!0,t.sort(((e,t)=>e.instalment_count-t.instalment_count))};const m=e=>{let{feesTable:t,totalWithTax:o}=e;const a=Object.keys(t);return t[a.find((e=>o{let{feesTable:t,instalmentCount:o}=e;return t[o.toString()]},f=e=>{let{feesTable:t,instalmentCounts:o}=e;const a=JSON.parse(JSON.stringify(t)),n=Object.keys(a),r=n.filter((e=>Object.keys(a[e]).toString()!==o.toString()));if(0===r.length)return t;const i=[];n.forEach((e=>{i.push({financialAmount:e,data:a[e]})}));const s=e=>{let{financialAmount:t,instalment:o,next:a,nextIndex:n}=e,r=void 0!==n?n:0;const l=a||i.find(((e,o)=>(r=o,e.financialAmount===t)));return void 0===l.data[o]?s({instalment:o,next:i[r+1],nextIndex:r+1}):l.data[o]};return r.forEach((e=>{o.forEach((t=>{a[e][t]=s({financialAmount:e,instalment:t})}))})),a};var g=(e,t,o)=>{let{instalment_counts:l,product:g,fees_table:h,fees_table_2d:b,fees_table_3d:v,max_amount:y,min_amount:_,min_amounts:C,first_date:w,last_date:j,registration_total:S=0,setup_fee_percentages:x,setup_fee_min_amounts:T,instalment_fee_percentages:P}=t;const O=new Date,k=Math.min(e,y),I=Math.max(0,e-y),E=k-S,M=S>0?0:1,F=(e=>{let{feesTable2d:t,feesTable3d:o}=e;return o&&Object.keys(o).length>0?"3d":t&&Object.keys(t).length>0?"2d":"1d"})({feesTable2d:b,feesTable3d:v}),q=(e=>{let{feesTable1d:t,feesTable2d:o,feesTable3d:a,feesTableType:n}=e;switch(n){case"1d":return t;case"2d":return o;default:return a}})({feesTable1d:h,feesTable2d:b,feesTable3d:v,feesTableType:F}),N=Array.isArray(l)?l:[l],W="3d"===F?m({feesTable:f({feesTable:q,instalmentCounts:N}),totalWithTax:e}):q,A=x&&"3d"===F?m({feesTable:f({feesTable:x,instalmentCounts:N}),totalWithTax:e}):x,$=N.map((t=>{const l="1d"===F?W:p({feesTable:W,instalmentCount:t}),d=P?p({feesTable:P,instalmentCount:t}):0,m=Math.ceil(d*(k/1e4)),f=Math.trunc(E/t),h=s(E,l)+m,b=f+h,v=A?p({feesTable:A,instalmentCount:t}):0,x=T?p({feesTable:T,instalmentCount:t}):0,q=Math.ceil(e*(v/1e4)),N=Math.max(q,x),$=(e=>{let{registrationTotal:t,upToMax:o,overMax:a,instalmentCount:n}=e;return t>0?t+a:((e,t,o)=>Math.trunc(t+o/100*e))(o,a,100/n)})({registrationTotal:S,upToMax:k,overMax:I,instalmentCount:t}),z=S>0?0:h,Q=$+z+N,R=e-$,B=t-M,D=h*B+z+N,U=Math.round(1e4*D/e),L=e+D,K=((e,t,o)=>void 0===t?e:t.find((e=>{let{instalment_count_threshold:t}=e;return o<=t})).min_amount)(_,C,t),J=e>=K,V={cost_of_credit_pct:{value:U,string:n(U/100,o)},cost_of_credit:{value:D,string:a(D,o)},default:!1,down_payment_amount:{value:$,string:a($,o)},down_payment_fees:{value:z,string:a(z,o)},down_payment_total:{value:Q,string:a(Q,o)},drawdown_payment_amount:{value:R,string:a(R,o)},grand_total:{value:L,string:a(L,o)},instalment_amount:{value:f,string:a(f,o)},instalment_count:t,instalment_fee:{value:h,string:a(h,o)},instalment_total:{value:b,string:a(b,o)},interest:{value:0,string:n(0,o)},max_amount:{value:y,string:a(y,o)},max_credit:{value:y,string:a(y,o)},max_financed_amount:{value:y,string:a(y,o)},min_amount:{value:K,string:a(K,o)},min_credit:{value:K,string:a(K,o)},over_max_financed_amount:{value:I,string:a(I,o)},over_max:{value:I,string:a(I,o)},remaining_instalment_count:B,setup_fee:{value:N,string:a(N,o)},setup_fee_min_amount:{value:x,string:a(x,o)},setup_fee_percentage:{value:v,string:n(v/100,o)},total_with_tax:{value:e,string:a(e,o)},available:J,product:g},H=((e,t,o,a,n)=>{const r={};for(let a=0;a0){const e=Object.keys(r);r[e[e.length-1]]+=i}return r})(O,B,b,R,f);let G;try{G=u(e-$-h-N,H,O.toISOString())}catch(e){G=9e3}return V.apr={value:r(G),string:n(G,o)},w&&(V.first_date={value:w,string:i(w,o)}),j&&(V.last_date={value:j,string:i(j,o)}),V}));return{[g]:d($)}};e.computeCreditAgreement=e=>{let{totalWithTax:t,productConfig:o,formatterConfig:l}=e;return((e,t,o)=>{switch(t.product){case"pp3":case"pp6":case"pp9":case"sp1":return g(e,t,o);case"pp5":return((e,t,o)=>{let{product:l,campaign:c,fees_table:d,max_amount:m,min_amount:p,first_date:f,last_date:g,due_date:h,due_in:b,title:v}=t;const y=new Date,_=Math.min(e,m),C=s(_,d),w=C,j=Math.max(0,e-m),S=j,x=e-S,T=S+w,P=C+0,O=Math.round(1e4*P/e),k=e+P,I={agreed_amount:{value:x,string:a(x,o)},campaign:c,cost_of_credit_pct:{value:O,string:n(O/100,o)},cost_of_credit:{value:P,string:a(P,o)},down_payment_amount:{value:S,string:a(S,o)},down_payment_fees:{value:w,string:a(w,o)},down_payment_total:{value:T,string:a(T,o)},drawdown_payment_amount:{value:x,string:a(x,o)},due_date:{value:h,string:i(h,o)},end_date:{value:g,string:i(g,o)},first_date:{value:f,string:i(f,o)},grand_total:{value:k,string:a(k,o)},instalment_count:1,instalment_fee:{value:0,string:a(0,o)},interest:{value:0,string:n(0,o)},last_date:{value:g,string:i(g,o)},max_credit:{value:m,string:a(m,o)},max_financed_amount:{value:m,string:a(m,o)},min_amount:{value:p,string:a(p,o)},min_credit:{value:p,string:a(p,o)},over_max_financed_amount:{value:j,string:a(j,o)},product:l,setup_fee:{value:C,string:a(C,o)},start_date:{value:f,string:i(f,o)},total_with_tax:{value:e,string:a(e,o)}},E={[h]:x};let M;try{M=u(x-C,E,y.toISOString())}catch(e){M=9e3}var F;return I.apr={value:r(M),string:n(M,o)},b&&(I.due_in={value:b,string:(F=b,`${F} días`)}),v&&(I.title=v),{pp5:[I]}})(e,t,o);case"r1":return((e,t)=>{let{product:o}=t;return{[o]:[{totalWithTax:e}]}})(e,t);default:return[]}})(t,o,l)},e.computeMaxDiscount=(e,t)=>function(e){let t=0;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]).reduce(((o,a)=>a.min_amount<=e&&a.min_amount>=t?(t=a.min_amount,a.discount):o),0)}(e,t)}(t)}},t={};function o(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,o),r.exports}var a={};(()=>{"use strict";var e=a;e.default=void 0;var t=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var o=n(t);if(o&&o.has(e))return o.get(e);var a={__proto__:null},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&{}.hasOwnProperty.call(e,i)){var s=r?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(a,i,s):a[i]=e[i]}return a.default=e,o&&o.set(e,a),a}(o(178));function n(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(n=function(e){return e?o:t})(e)}window.SequraConfiguration&&async function(){await(0,t.default)(window.SequraConfiguration)}(),e.default={onLoad:t.onLoad,updateConfiguration:t.updateConfiguration,refreshComponents:t.refreshComponents,computeCreditAgreements:t.computeCreditAgreements}})(),Sequra=a.default})();