!function(){var e,t,n={2002:function(e,t){"use strict";const n=/(\/:?[\w-]{1,})|\//g;t.Z=class{constructor({pathname:e}={pathname:window.location.pathname}){this.routes=[],this.pathname=e}getRoutes(){return this.routes}createUrlWithParams(e,t){const a=e.match(n)||[],i=t.match(n)||[],o={url:"",parameters:{}};return a.length===i.length&&a.forEach(((e,t)=>{if(e===i[t])o.url+=i[t];else{const n=i[t].replace(/\/:\w{1,}/g,e);o.url+=n;const a=i[t].replace(/(\/:|\/)/gi,""),s=n.replace(/(\/)/gi,"");o.parameters[a]=s}})),o}matchUrl(e){const t=this.normalizeUrl(this.pathname),n=this.normalizeUrl(e),a=this.createUrlWithParams(t,n),i=new RegExp(`^${a.url}$`);return t.match(i)?a:null}normalizeUrl(e){return"/"===e?e:e.replace(/\/(?:$|(\?.*))/,"$1")}get(e,t){const n={path:e,callback:t};this.routes.push(n)}init(){let e=!1;return this.routes.forEach((t=>{if(Array.isArray(t.path))t.path.forEach((n=>{const a=this.matchUrl(n);a&&(t.callback(a),e=!0)}));else{const n=this.matchUrl(t.path);n&&(t.callback(n),e=!0)}})),e}}},208:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var a=(e,t)=>{let n=0;return function(){const a=this,i=arguments;clearTimeout(n),n=setTimeout((function(){e.apply(a,i)}),t||0)}};var i=class{constructor(e,t,n={}){this.callback=t,this.target="string"==typeof e?document.querySelector(e):e,this.props={isLoaded:!1,onScrolling:n.onScrolling||!1,isFullyVisible:n.isFullyVisible||!1,minimumScrollPixels:n.minimumScrollPixels||100},this.target&&"function"==typeof this.callback||this.props.onScrolling?this.props.onScrolling?this.onScrolling():this.intersectionViewport():console.log("target or callback does not exist")}onScrolling(){this.scrolling=a((()=>{!this.props.isLoaded&&window.scrollY>this.props.minimumScrollPixels&&(this.props.isLoaded=!0,window.removeEventListener("scroll",this.scrolling),this.callback(this.target))})),window.addEventListener("scroll",this.scrolling)}intersectionViewport(){if("IntersectionObserver"in window){const e=this.props.isFullyVisible?1:0,t=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting&&(this.callback(this.target),t.unobserve(this.target))}))}),{threshold:e});t.observe(this.target)}else console.warn("not support IntersectionObserver")}}},6157:function(e,t){"use strict";const n=({type:e,category:t,action:n,label:a,value:i})=>{const o="function"!=typeof gtag;o?console.warn("Google Analytics (gtag) not Loaded"):gtag("event",e,{event_category:t,event_action:n,event_label:a,value:i}),console.log(o?"delayed":"sent",{type:e,label:a,value:i,action:n,category:t})},a=e=>new Promise((t=>{setTimeout((()=>{t(!0),console.warn("Google Analytics (gtag) delayed")}),e)}));t.Z={send:({type:e,value:t="",action:i,category:o,timeout:s=3e3,label:r=window.location.pathname})=>{"function"==typeof gtag?n({type:e,category:o,action:i,label:r,value:t}):a(s).then((()=>n({type:e,category:o,action:i,label:r,value:t})))}}},4047:function(e){var t="minha-conta",n=window.location.origin.concat("/".concat(t));e.exports={BASE_URL:n,SLUG_URL_PROJECT:t,SLUG_STATIC_PROJECT:"minha-conta/atualizar-perfil"}},7090:function(e){!function(t,n){var a=function(e,t,n){"use strict";var a,i;if(function(){var t,n={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",fastLoadedClass:"ls-is-cached",iframeLoadMode:0,srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:!0,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:!0,ricTimeout:0,throttleDelay:125};for(t in i=e.lazySizesConfig||e.lazysizesConfig||{},n)t in i||(i[t]=n[t])}(),!t||!t.getElementsByClassName)return{init:function(){},cfg:i,noSupport:!0};var o=t.documentElement,s=e.HTMLPictureElement,r="addEventListener",c="getAttribute",l=e[r].bind(e),d=e.setTimeout,u=e.requestAnimationFrame||d,h=e.requestIdleCallback,f=/^picture$/i,m=["load","error","lazyincluded","_lazyloaded"],p={},g=Array.prototype.forEach,b=function(e,t){return p[t]||(p[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")),p[t].test(e[c]("class")||"")&&p[t]},v=function(e,t){b(e,t)||e.setAttribute("class",(e[c]("class")||"").trim()+" "+t)},y=function(e,t){var n;(n=b(e,t))&&e.setAttribute("class",(e[c]("class")||"").replace(n," "))},_=function(e,t,n){var a=n?r:"removeEventListener";n&&_(e,t),m.forEach((function(n){e[a](n,t)}))},w=function(e,n,i,o,s){var r=t.createEvent("Event");return i||(i={}),i.instance=a,r.initEvent(n,!o,!s),r.detail=i,e.dispatchEvent(r),r},k=function(t,n){var a;!s&&(a=e.picturefill||i.pf)?(n&&n.src&&!t[c]("srcset")&&t.setAttribute("srcset",n.src),a({reevaluate:!0,elements:[t]})):n&&n.src&&(t.src=n.src)},T=function(e,t){return(getComputedStyle(e,null)||{})[t]},L=function(e,t,n){for(n=n||e.offsetWidth;n49?function(){h(r,{timeout:s}),s!==i.ricTimeout&&(s=i.ricTimeout)}:x((function(){d(r)}),!0);return function(e){var i;(e=!0===e)&&(s=33),t||(t=!0,(i=o-(n.now()-a))<0&&(i=0),e||i<9?c():d(c,i))}},C=function(e){var t,a,i=99,o=function(){t=null,e()},s=function(){var e=n.now()-a;e0)&&"visible"!=T(i,"overflow")&&(a=i.getBoundingClientRect(),s=W>a.left&&Da.top-1&&G500&&o.clientWidth>500?500:370:i.expand,a._defEx=m,p=m*i.expFactor,g=i.hFac,V=null,Y2&&M>2&&!t.hidden?(Y=p,ee=0):Y=M>1&&ee>1&&X<6?m:K),f!==d&&(F=innerWidth+d*g,J=innerHeight+d,u=-1*d,f=d),s=b[n].getBoundingClientRect(),(B=s.bottom)>=u&&(G=s.top)<=J&&(W=s.right)>=u*g&&(D=s.left)<=F&&(B||W||D||G)&&(i.loadHidden||ne(b[n]))&&(j&&X<3&&!h&&(M<3||ee<4)||ae(b[n],d))){if(he(b[n]),l=!0,X>9)break}else!l&&j&&!r&&X<4&&ee<4&&M>2&&($[0]||i.preloadAfterLoad)&&($[0]||!h&&(B||W||D||G||"auto"!=b[n][c](i.sizesAttr)))&&(r=$[0]||b[n]);r&&!l&&he(r)}},oe=z(ie),se=function(e){var t=e.target;t._lazyCache?delete t._lazyCache:(te(e),v(t,i.loadedClass),y(t,i.loadingClass),_(t,ce),w(t,"lazyloaded"))},re=x(se),ce=function(e){re({target:e.target})},le=function(e,t){var n=e.getAttribute("data-load-mode")||i.iframeLoadMode;0==n?e.contentWindow.location.replace(t):1==n&&(e.src=t)},de=function(e){var t,n=e[c](i.srcsetAttr);(t=i.customMedia[e[c]("data-media")||e[c]("media")])&&e.setAttribute("media",t),n&&e.setAttribute("srcset",n)},ue=x((function(e,t,n,a,o){var s,r,l,u,h,m;(h=w(e,"lazybeforeunveil",t)).defaultPrevented||(a&&(n?v(e,i.autosizesClass):e.setAttribute("sizes",a)),r=e[c](i.srcsetAttr),s=e[c](i.srcAttr),o&&(u=(l=e.parentNode)&&f.test(l.nodeName||"")),m=t.firesLoad||"src"in e&&(r||s||u),h={target:e},v(e,i.loadingClass),m&&(clearTimeout(q),q=d(te,2500),_(e,ce,!0)),u&&g.call(l.getElementsByTagName("source"),de),r?e.setAttribute("srcset",r):s&&!u&&(H.test(e.nodeName)?le(e,s):e.src=s),o&&(r||u)&&k(e,{src:s})),e._lazyRace&&delete e._lazyRace,y(e,i.lazyClass),E((function(){var t=e.complete&&e.naturalWidth>1;m&&!t||(t&&v(e,i.fastLoadedClass),se(h),e._lazyCache=!0,d((function(){"_lazyCache"in e&&delete e._lazyCache}),9)),"lazy"==e.loading&&X--}),!0)})),he=function(e){if(!e._lazyRace){var t,n=Z.test(e.nodeName),a=n&&(e[c](i.sizesAttr)||e[c]("sizes")),o="auto"==a;(!o&&j||!n||!e[c]("src")&&!e.srcset||e.complete||b(e,i.errorClass)||!b(e,i.lazyClass))&&(t=w(e,"lazyunveilread").detail,o&&A.updateElem(e,!0,e.offsetWidth),e._lazyRace=!0,X++,ue(e,t,o,a,n))}},fe=C((function(){i.loadMode=3,oe()})),me=function(){3==i.loadMode&&(i.loadMode=2),fe()},pe=function(){j||(n.now()-N<999?d(pe,999):(j=!0,i.loadMode=3,oe(),l("scroll",me,!0)))},{_:function(){N=n.now(),a.elements=t.getElementsByClassName(i.lazyClass),$=t.getElementsByClassName(i.lazyClass+" "+i.preloadClass),l("scroll",oe,!0),l("resize",oe,!0),l("pageshow",(function(e){if(e.persisted){var n=t.querySelectorAll("."+i.loadingClass);n.length&&n.forEach&&u((function(){n.forEach((function(e){e.complete&&he(e)}))}))}})),e.MutationObserver?new MutationObserver(oe).observe(o,{childList:!0,subtree:!0,attributes:!0}):(o[r]("DOMNodeInserted",oe,!0),o[r]("DOMAttrModified",oe,!0),setInterval(oe,999)),l("hashchange",oe,!0),["focus","mouseover","click","load","transitionend","animationend"].forEach((function(e){t[r](e,oe,!0)})),/d$|^c/.test(t.readyState)?pe():(l("load",pe),t[r]("DOMContentLoaded",oe),d(pe,2e4)),a.elements.length?(ie(),E._lsFlush()):oe()},checkElems:oe,unveil:he,_aLSL:me}),A=(O=x((function(e,t,n,a){var i,o,s;if(e._lazysizesWidth=a,a+="px",e.setAttribute("sizes",a),f.test(t.nodeName||""))for(o=0,s=(i=t.getElementsByTagName("source")).length;ot._lazysizesWidth)&&(t._lazysizesWidth=a),t._lazysizesWidth))}))}}))},901:function(e,t,n){"use strict";n.d(t,{F:function(){return r}});var a=n(4960),i=n(1200),o=n(2884);const s=!("object"!=typeof safari||!safari.pushNotification);class r{constructor({ensureTasksRun:e=!1,defaultMinTaskTime:t=0}={}){this.idleCallbackHandle_=null,this.taskQueue_=[],this.isProcessing_=!1,this.state_=null,this.defaultMinTaskTime_=t,this.ensureTasksRun_=e,this.runTasksImmediately=this.runTasksImmediately.bind(this),this.runTasks_=this.runTasks_.bind(this),this.onVisibilityChange_=this.onVisibilityChange_.bind(this),this.ensureTasksRun_&&(addEventListener("visibilitychange",this.onVisibilityChange_,!0),s&&addEventListener("beforeunload",this.runTasksImmediately,!0))}pushTask(...e){this.addTask_(Array.prototype.push,...e)}unshiftTask(...e){this.addTask_(Array.prototype.unshift,...e)}runTasksImmediately(){this.runTasks_()}hasPendingTasks(){return this.taskQueue_.length>0}clearPendingTasks(){this.taskQueue_=[],this.cancelScheduledRun_()}getState(){return this.state_}destroy(){this.taskQueue_=[],this.cancelScheduledRun_(),this.ensureTasksRun_&&(removeEventListener("visibilitychange",this.onVisibilityChange_,!0),s&&removeEventListener("beforeunload",this.runTasksImmediately,!0))}addTask_(e,t,{minTaskTime:n=this.defaultMinTaskTime_}={}){const a={time:(0,i.z)(),visibilityState:document.visibilityState};e.call(this.taskQueue_,{state:a,task:t,minTaskTime:n}),this.scheduleTasksToRun_()}scheduleTasksToRun_(){this.ensureTasksRun_&&"hidden"===document.visibilityState?(0,o.Y)(this.runTasks_):this.idleCallbackHandle_||(this.idleCallbackHandle_=(0,a.$)(this.runTasks_))}runTasks_(e=void 0){if(this.cancelScheduledRun_(),!this.isProcessing_){for(this.isProcessing_=!0;this.hasPendingTasks()&&!c(e,this.taskQueue_[0].minTaskTime);){const{task:e,state:t}=this.taskQueue_.shift();this.state_=t,e(t),this.state_=null}this.isProcessing_=!1,this.hasPendingTasks()&&this.scheduleTasksToRun_()}}cancelScheduledRun_(){(0,a.x)(this.idleCallbackHandle_),this.idleCallbackHandle_=null}onVisibilityChange_(){"hidden"===document.visibilityState&&this.runTasksImmediately()}}const c=(e,t)=>!!(e&&e.timeRemaining()<=t)},4960:function(e,t,n){"use strict";n.d(t,{$:function(){return s},x:function(){return r}});var a=n(1200);const i="function"==typeof requestIdleCallback;class o{constructor(e){this.initTime_=e}get didTimeout(){return!1}timeRemaining(){return Math.max(0,50-((0,a.z)()-this.initTime_))}}const s=i?requestIdleCallback:e=>{const t=new o((0,a.z)());return setTimeout((()=>e(t)),0)},r=i?cancelIdleCallback:e=>{clearTimeout(e)}},1200:function(e,t,n){"use strict";n.d(t,{z:function(){return a}});const a=()=>+new Date},2884:function(e,t,n){"use strict";n.d(t,{Y:function(){return a}});const a="function"==typeof Promise&&Promise.toString().indexOf("[native code]")>-1?e=>{Promise.resolve().then(e)}:(()=>{let e=0,t=[];const n=new MutationObserver((()=>{t.forEach((e=>e())),t=[]})),a=document.createTextNode("");return n.observe(a,{characterData:!0}),n=>{t.push(n),a.data=String(++e%2)}})()}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var o=a[e]={exports:{}};return n[e].call(o.exports,o,o.exports,i),o.exports}i.m=n,i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=function(e){return Promise.all(Object.keys(i.f).reduce((function(t,n){return i.f[n](e,t),t}),[]))},i.u=function(e){return"js/"+({32:"personal-data",91:"celebration",164:"member-get-member-service",177:"home",209:"accordion",343:"onboarding",344:"sticker",369:"carousel",462:"algolia",463:"update-your-score",467:"popover",471:"family",498:"blu365",508:"offer",577:"address",669:"golden-ticket",789:"patrimony",813:"professional",845:"exclude",846:"financial",909:"notifications",963:"lgpd",993:"preaproval"}[e]||e)+"."+{32:"cd871eb84452184fafe5",91:"b49896e8575017b9ac97",164:"66d49e5c2159ba6bd8ab",177:"0c86face71ec9dadbfd3",209:"9b82e1374d64beab57a1",234:"095f1b4649a8856f2271",343:"051a962b9a5418b5a787",344:"229cc9f78ddd403118ec",369:"5e57d1e31b107a88d797",462:"0e385f2594714931d57e",463:"272b9cc785a57995de14",467:"19c8ec0f066d82f6b7d4",471:"fcea8f46a52f8006e99e",498:"b1b78d71c830b94e8720",508:"8835bf740a1477a9f67e",577:"56e3adda8e92430350bd",669:"c77237c8643358d14064",789:"095cdc3e96d9eabb270c",813:"daa286b2afe1898a55fb",834:"1817c9f42ddfad0dffd3",845:"dbe6208b5ffa2cf2b74e",846:"dd832299364eaf45208f",889:"1d9ed3ca49da7e35751e",907:"b5bef81531de10029d57",909:"1a05163e85616cbddd2c",963:"5d4fd83361870ba26487",993:"80b611fb1eb15557e8f3"}[e]+".js"},i.miniCssF=function(e){},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e={},t="area-logada:",i.l=function(n,a,o,s){if(e[n])e[n].push(a);else{var r,c;if(void 0!==o)for(var l=document.getElementsByTagName("script"),d=0;d{this.target.src=this.script,this.target.onload=t=>e(t),this.target.onerror=e=>{t(new Error(`Failed to load ${e.target.src}`))},this.head.appendChild(this.target)}))}},s=i(2002),r=i(6157);const c="[data-tracker-event]",l="[data-tracker-observable]",d={swipe:"swiped",click:"clicked",toggle:"toggle",opened:"opened"},u={change:"clicked",focusin:"opened"},h={toggle:"state",swipe:"direction"},f=["swipe","opened"],m=new n.F({ensureTasksRun:!0}),p=({type:e,target:t,detail:n})=>{m.pushTask((()=>{const a=f.includes(e)?t:t.closest(c);if(!a)return;const i="SELECT"===a.tagName?u[e]:d[e];if(((e,t)=>e&&e.dataset.trackerEvent&&e.dataset.trackerEvent.includes(t))(a,i)){const t=g(e,n)||i,o=a.dataset.trackerAction;r.Z.send({type:"event",action:o?`${t}+${o}`:t,category:a.dataset.trackerType})}}))},g=(e,t)=>t&&t[h[e]],b=(e,t)=>{if("IntersectionObserver"in window){const n=new IntersectionObserver((a=>{a.forEach((a=>{a.intersectionRatio>0&&(t(),n.unobserve(e))}))}));n.observe(e)}};var v=()=>{document.addEventListener("click",p,!1),document.addEventListener("swipe",p),document.addEventListener("opened",p),document.addEventListener("change",p),document.addEventListener("toggle",p),document.addEventListener("focusin",p),document.querySelectorAll(l).forEach((e=>{b(e,(()=>{m.pushTask((()=>{const t=e.dataset.trackerAction;r.Z.send({type:"exist",action:t?`showed+${t}`:"showed",category:e.dataset.trackerType})}))}))}))};var y={set:(e,t,n,a,i)=>{let o="";const s=n,r=a||"/",c=i||window.location.hostname||"foregon.com",l=new Date;l.setTime(l.getTime()+1e3*s),o=`; expires=${l.toUTCString()}`,document.cookie=`${e}=${t}${o}; domain=${c}; path=${r}`},get:e=>{const t=`; ${document.cookie}`.split(`; ${e}=`);return 2===t.length?t.pop().split(";").shift():null},delete:e=>{const t=window.location.hostname||"foregon.com";document.cookie=`${e}=;expires=Thu, 01 Jan 1970 00:00:01 GMT; domain=${t}; path=/;`}};var _={getByName:(e,t)=>{let n=t,a=e;n||(n=window.location.href),a=a.replace(/[[\]]/g,"\\$&");const i=new RegExp(`[?&]${a}(=([^&#]*)|&|#|$)`).exec(n);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}};const w=["utm_term","utm_medium","utm_source","utm_content","utm_campaign","agx_hash","affiliate_id","affiliate_click_id","affiliate_unique5","affiliate_sub3","affiliate_sub5","affiliate_source","offers_id","clickid","goalid_1","goalid_2","goalid_3","goalid_4","goalid_5","aff_sub4","aff_sub5","gclid","ttclid","fbclid"],k={method:"GET",title:document.title,url:window.location.href,userAgent:navigator.userAgent},T=(e,t={})=>{fetch(e,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})};var L=()=>{(()=>{if(window.__product__){const e=JSON.parse(window.__product__);e&&e.id&&(k.productId=e.id)}})(),w.forEach((e=>{const t=_.getByName(e);t&&(y.set(e,t),k[e]=t)})),!document.referrer||document.referrer.startsWith("https://www.foregon.com")||document.referrer.startsWith("https://accounts.google.com")||y.set("referrer_external",document.referrer),y.set("referrer",document.referrer)},E=({credentials:e}={})=>{e?T("/account/api/ping"):T("/api/v3/tracker/log",k)};var x=e=>{if("function"==typeof e)return"interactive"===document.readyState||"complete"===document.readyState?e():void document.addEventListener("DOMContentLoaded",e,!1)};const z="js-guide",C="js-guide-exit",S="js-guide-expand",A="js-guide-retract",R=[27];class P{constructor(){this.guide=document.querySelector(`.${z}`),this.expand=document.querySelector(`.${S}`),(this.guide||this.expand)&&(this.exit=document.querySelector(`.${C}`),this.retract=document.querySelectorAll(`.${A}`),this.onRetractListener(),this.expand.addEventListener("click",this.onToggle.bind(this,!0)),this.escape=this.onKeydown.bind(this))}onRetractListener(){if(this.retract.length>0){const e=this;this.retract.forEach((t=>{t.addEventListener("click",e.onToggle.bind(e,!1))}))}}onKeydown(e){R.includes(e.keyCode)&&this.expanded&&this.onToggle(!1)}onToggle(e){this.expanded=e,this.expanded?this.onExpand():this.onRetract(),this.setCustomEvent(),this.guide.classList.toggle("is-open",e),this.expand.setAttribute("aria-expanded",e)}setCustomEvent(){this.guide.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,detail:{state:this.expanded?"opened":"closed"},cancelable:!0}))}onExpand(){document.body.style.overflow="hidden",document.addEventListener("keydown",this.escape),setTimeout((()=>{this.exit.focus()}),100)}onRetract(){this.expand.focus(),document.body.style.overflow="auto",document.removeEventListener("keydown",this.escape)}static mount(){return new P}}var O=P;const I=({title:e,href:t,id:n,image:a,context:i})=>({id:n,href:t,title:e,image:a,context:U(i)}),U=(e="conteudo")=>{const t={};switch(e){case"cartaodecredito":case"creditcardgroups":t.name="Cartão de crédito",t.slug="cartaodecredito";break;case"contadigital":case"digitalaccountgroups":t.name="Conta digital",t.slug="contadigital";break;case"emprestimo":case"loangroups":t.name="Empréstimo",t.slug="emprestimo";break;case"maquinadecartao":case"paymentterminalgroups":t.name="Maquininha",t.slug="maquinadecartao"}return t},$=".js-search",j=".js-search-input",q=".js-search-expand",M=".js-search-retract",N=".js-search-listbox",F=[27],J=10,G={hint:!1,debug:!0,debounce:400,openOnFocus:!0,clearOnSelected:!0,appendTo:"#search-listbox",cssClasses:{noPrefix:!0,root:"c-autocomplete",suggestion:"c-autocomplete__item",suggestions:"c-autocomplete__list",dropdownMenu:"c-autocomplete__dropdown"}};var D=class{constructor(){this.search=document.querySelector($),this.instance=null,this.autocomplete=null,this.algoliasearch=null,this.escape=this.onKeydown.bind(this),this.expanded=!1,window.process={env:{DEBUG:void 0}}}mount(){this.search&&(this.input=this.search.querySelector(j),this.expand=this.search.querySelector(q),this.retract=this.search.querySelector(M),this.listbox=this.search.querySelector(N),this.expand.addEventListener("click",this.onInputToggle.bind(this,!0)),this.retract.addEventListener("click",this.onInputToggle.bind(this,!1)))}getAsyncAlgolia(){const e=this;Promise.all([i.e(907),i.e(462)]).then(i.bind(i,4907)).then((function(t){e.autocomplete=t.autocomplete,e.algoliasearch=t.algoliasearch,e.setAngoliaInstance()}))}setLabelOnListbox(e){const t=this.search.querySelector('[role="listbox"]');t&&t.setAttribute("aria-label",e)}setAngoliaInstance(){this.client=this.algoliasearch("157435WVOW","a3d147133f732765013e17f7ae70b720"),this.context=this.search.dataset.context,this.searchOrder=[{allproducts:this.client.initIndex("all-products-prod"),name:"Produtos",slug:"allproducts",group:"Produtos"},{allgroups:this.client.initIndex("all-groups-prod"),name:"Grupos",slug:"allgroups",group:"Listas de produtos"},{articles:this.client.initIndex("articles-prod"),name:"Conteúdos",slug:"conteudo",group:"Conteúdos"}],this.searchOrder.sort((e=>e.name===this.context?-1:1)),this.searchIndex=this.searchOrder,this.instance=this.setInstance()}onFoundItems(e=!1){this.search.classList.toggle("has-results",e),this.listbox.setAttribute("aria-hidden",!e),setTimeout((()=>{this.expanded=e}),0)}onInputToggle(e=!0){this.search.classList.toggle("is-expanded"),this.search.classList.toggle("is-retracted"),document.body.classList.add("is-search-expanded"),this.search.querySelector("[aria-expanded]").setAttribute("aria-expanded",e),e?(this.onExpand(),this.getAsyncAlgolia()):this.onRetract()}onRetract(){this.onFoundItems(!1),this.removeBackdrop(),this.expand.setAttribute("tabindex","0"),this.expand.focus(),document.body.classList.remove("is-search-expanded"),document.removeEventListener("keydown",this.escape),null!==this.instance&&this.instance.autocomplete.destroy()}onExpand(){this.input.focus(),this.openBackdrop(),this.expand.setAttribute("tabindex","-1"),document.addEventListener("keydown",this.escape)}onKeydown({keyCode:e}){!F.includes(e)||F.includes(e)&&this.expanded||this.onInputToggle(!1)}openBackdrop(){this.backdrop=document.createElement("div"),this.backdrop.className="o-backdrop is-active u-z-99",document.body.appendChild(this.backdrop),this.backdrop.addEventListener("click",this.onInputToggle.bind(this,!1))}removeBackdrop(){this.backdrop.parentNode.removeChild(this.backdrop),this.backdrop=null}setLayout(){return this.searchIndex.map(((e,t)=>{const n=Object.keys(e)[0];let a=null;return"Produtos"!==e.group&&"Listas de produtos"!==e.group&&"Conteúdos"!==e.group||(a=`\n
\n \n ${e.group}\n \n
\n `),{source:this.autocomplete.sources.hits(this.searchIndex[t][n],{hitsPerPage:J}),templates:{header:`${a||""}`,suggestion({_highlightResult:t,_id:a,link:i,imageUrl:o,groupUrl:s,productUrl:r,featured_image:c,productType:l,objectID:d}){let u={};switch(n){case"articles":u=I({href:i,id:d,context:e.slug,image:c,title:t.title.rendered.value});break;case"allgroups":u=I({id:a,image:null,href:s,context:e.slug,title:t.title&&t.title.value?t.title.value:t.name.value});break;default:u=I({id:a,image:o,href:r,context:l,title:t.name.value}),u.context.group=e.group}return(({template:e})=>`\n ${e.image?`
\n
\n \n
\n
`:""}\n
\n ${e.context.name?`\n ${e.context.name}\n `:""}\n
${e.title}
\n
\n
`)({template:u})}}}}))}setTotalResults(){const e=this.listbox.querySelectorAll(".c-autocomplete__item").length;this.listbox.querySelector("#js-total-results").textContent=`${e} resultados disponíveis`}setInstance(){return this.autocomplete(this.input,G,this.setLayout()).on("autocomplete:selected",((e,t)=>{window.location.href=t.link||t.productUrl})).on("autocomplete:empty",(()=>{this.onFoundItems(),this.setLabelOnListbox("Nenhum resultado encontrado"),this.setTotalResults()})).on("autocomplete:closed",(()=>{this.setTotalResults(),this.onFoundItems()})).on("autocomplete:shown",(()=>{this.onFoundItems(!0),this.setLabelOnListbox("Resultados da sua pesquisa"),this.setTotalResults()})).on("autocomplete:opened",(()=>{this.setTotalResults(),this.onFoundItems()})).on("autocomplete:updated",(e=>{e.srcElement.value||(this.setTotalResults(),this.onFoundItems())}))}};const W="has-active",B="js-dropdown",V="js-dropdown-menu",Z="js-dropdown-expand",H="js-dropdown-retract";class Q{constructor(e){this.dropdown="string"==typeof e?document.querySelector(`.${e}`):e,this.dropdown&&(this.menu=this.dropdown.querySelector(`.${V}`),this.expand=this.dropdown.querySelector(`.${Z}`),this.retract=this.dropdown.querySelector(`.${H}`),this.expand.setAttribute("aria-expanded",!1),this.expand.addEventListener("focusin",this.onDropToggle.bind(this,!0)),this.dropdown.addEventListener("mouseover",this.onDropToggle.bind(this,!0)),this.dropdown.addEventListener("mouseleave",this.onDropToggle.bind(this,!1)),this.retract&&this.retract.addEventListener("click",this.onDropToggle.bind(this,!1)),this.getMenuAnchor())}getMenuAnchor(){const e=this;this.menu.querySelectorAll("a[href]").forEach((function(t){t.addEventListener("focusout",(t=>{const{currentTarget:n}=t;e.onAnchorFocus(n)}))}))}onDropToggle(e){e&&"true"===this.expand.getAttribute("aria-expanded")||(e&&this.dispatchCustomEvent(),this.expand.setAttribute("aria-expanded",e),this.dropdown.classList.toggle(W,e))}dispatchCustomEvent(){this.dropdown.dispatchEvent(new CustomEvent("opened",{bubbles:!0,cancelable:!0}))}onAnchorFocus(e){e.closest("li").nextElementSibling||this.onDropToggle(!1)}static mount(){const e=document.querySelectorAll(`.${B}`);e.length<=0||e.forEach((e=>new Q(e)))}}var K=Q;var Y={explose:function(e={}){const{target:t}=e,n=(()=>{const e=document.createElement("div");return e.insertAdjacentHTML("beforeend",'\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n '),e})();t.appendChild(n),setTimeout((()=>{t.removeChild(n)}),1e3)}};const X="is-active",ee="is-tooltip-hidden",te=".js-toggle-bookmark",ne=({target:e,activated:t})=>{e.classList.add(ee),e.classList.toggle(X,!t),e.setAttribute("aria-label",t?"Adicionar aos favoritos":"Remover dos favoritos"),e.setAttribute("data-tracker-action",t?"bookmark-add":"bookmark-remove"),setTimeout((()=>{e.classList.remove(ee)}),2e3)},ae=({target:e})=>{const t=e.closest(te);if(!t)return;const{productId:n}=t.dataset;if(!n)return;const a=t.classList.contains(X);ne({target:t,activated:a}),a||Y.explose({target:t}),oe({target:t})},ie=({target:e,activated:t})=>{setTimeout((()=>{ne({target:e,activated:t})}),1500),r.Z.send({type:"event",category:e.dataset.trackerType,action:"failed"})},oe=({target:e})=>{const t=e.classList.contains(X);(({target:e})=>{const{productId:t}=e.dataset,n=e.classList.contains(X);return fetch("https://www.foregon.com/minha-conta/favoritos/"+(n?"adicionar":"remover"),{mode:"cors",method:"POST",body:JSON.stringify({productId:t}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then((e=>e.json()))})({target:e}).then((({success:n})=>{n||ie({target:e,activated:t})})).catch((()=>ie({target:e,activated:t})))};var se=()=>{document.addEventListener("click",ae)};const re="is-active",ce="is-tooltip-hidden",le=".js-toggle-alreadyhave",de="fgn-popover-already-dismiss",ue={loan:"esse empréstimo",creditcard:"esse cartão",digitalaccount:"essa conta",paymentterminal:"essa maquininha"},he=({target:e,activated:t})=>{const{productType:n}=e.dataset;e.classList.add(ce),e.classList.toggle(re,!t),e.setAttribute("aria-label",t?`Marque se já tiver ${ue[n]}`:`Desmarque se não tiver ${ue[n]}`),e.setAttribute("data-tracker-action",t?"already-have-add":"already-have-remove"),setTimeout((()=>{e.classList.remove(ce)}),2e3)},fe={type:"screenview",category:"already-have-popover",label:window.location.pathname},me=()=>{const e=document.querySelector(le);return ge(e)?document.querySelectorAll(le)[1]:e},pe=e=>{const{productType:t}=e.dataset;e.setAttribute("data-gap","16"),e.setAttribute("data-autoshow","true"),e.setAttribute("data-placement","top"),e.setAttribute("data-content",`Já tem ${ue[t]}? Marque se já tiver para receber as melhores recomendações 🎊`),e.classList.add("js-toggle-popover")},ge=e=>{const t=window.getComputedStyle(e);return"none"===t.display||"hidden"===t.visibility};const be=({target:e})=>{const t=e.closest(le);if(!t)return;const{productId:n}=t.dataset;if(!n)return;const a=t.classList.contains(re);he({target:t,activated:a}),a||Y.explose({target:t}),ye({target:t})},ve=({target:e,activated:t})=>{setTimeout((()=>{he({target:e,activated:t})}),1500),r.Z.send({type:"event",category:e.dataset.trackerType,action:"failed"})},ye=({target:e})=>{const t=e.classList.contains(re);(({target:e})=>{const{productId:t}=e.dataset,n=e.classList.contains(re);return fetch("https://www.foregon.com/minha-conta/produtos/"+(n?"adicionar":"remover"),{mode:"cors",method:"POST",body:JSON.stringify({productId:t}),headers:{Accept:"application/json","Content-Type":"application/json"}}).then((e=>e.json()))})({target:e}).then((({success:n})=>{n||ve({target:e,activated:t})})).catch((()=>ve({target:e,activated:t})))};var _e={mount:()=>{document.addEventListener("click",be)},active:e=>{const t=document.querySelectorAll(`${le}[data-product-id]`);t&&t.forEach((t=>{const{productId:n,productType:a}=t.dataset,i=parseInt(n,10),o=e.includes(i);t.classList.toggle("is-active",o),t.setAttribute("aria-label",o?`Desmarque se não tiver ${ue[a]}`:`Marque se já tiver ${ue[a]}`),t.setAttribute("data-tracker-action",o?"already-have-remove":"already-have-add")}))},onboard:()=>{if(localStorage.getItem(de))return;const e=me();e&&(pe(e),i.e(467).then(i.bind(i,5857)).then((t=>{document.addEventListener("popover-render",(()=>r.Z.send(Object.assign(fe,{action:"showed"})))),t.default.mount([e]),document.addEventListener("popover-dismiss",(()=>{localStorage.setItem(de,new Date),r.Z.send(Object.assign(fe,{action:"closed",type:"event"}))}))})))}},we=i(4047),ke="[data-animation]",Te=function(e){if("IntersectionObserver"in window){var t=new IntersectionObserver((function(t){var n=e.dataset.animation;t.forEach((function(t){t.intersectionRatio>0?e.classList.add("s-animated","s-".concat(n)):e.classList.remove("s-animated","s-".concat(n))}))}));t.observe(e)}},Le=function(){var e=document.querySelectorAll(ke);0!==e.length&&e.forEach((function(e){Te(e)}))};x((function(){setTimeout((function(){return v()}),0),setTimeout((function(){document.querySelector("#js-onboarding")&&Promise.all([i.e(834),i.e(343)]).then(i.bind(i,3560)).then((function(e){(new(0,e.Onboarding)).mount()}))}),0),setTimeout((function(){document.querySelector("#js-celebration")&&i.e(91).then(i.bind(i,487)).then((function(e){(new(0,e.default)).mount()}))}),0),setTimeout((function(){(new D).mount()}),0),setTimeout((function(){return O.mount()}),0),setTimeout((function(){return K.mount()}),0),setTimeout((function(){document.querySelector(".js-toggle-alreadyhave")&&(_e.mount(),_e.onboard())}),0),setTimeout((function(){return se()}),0),setTimeout((function(){L(),E(),E({credentials:!0})})),setTimeout((function(){return Le()}),0);var e=new n.F,t=new s.Z;t.get(["/".concat(we.SLUG_URL_PROJECT),"/".concat(we.SLUG_URL_PROJECT,"/mgm")],(function(){e.pushTask((function(){Promise.all([i.e(834),i.e(369),i.e(177)]).then(i.bind(i,6433)).then((function(e){e.default.home()}))}))})),e.pushTask((function(){document.querySelector("#blu365")&&i.e(498).then(i.bind(i,1941)).then((function(e){(new(0,e.default)).mount()}))})),t.get(["/".concat(we.SLUG_URL_PROJECT,"/servicos/")],(function(){i.e(164).then(i.bind(i,291)).then((function(e){(new(0,e.default)).mount()}))})),t.get(["/".concat(we.SLUG_URL_PROJECT),"/".concat(we.SLUG_URL_PROJECT,"/mgm"),"/".concat(we.SLUG_URL_PROJECT,"/servicos/score/")],(function(){setTimeout((function(){i.e(463).then(i.bind(i,6912)).then((function(e){e.default.mount()}))}),0),setTimeout((function(){document.querySelector("#js-golden-ticket")&&Promise.all([i.e(834),i.e(669)]).then(i.bind(i,2073)).then((function(e){(new(0,e.default)).mount()}))}),0)})),t.get("/".concat(we.SLUG_URL_PROJECT,"/radar/consultas"),(function(){e.pushTask((function(){i.e(508).then(i.bind(i,1600)).then((function(e){e.default.mount()}))})),e.pushTask((function(){new a.Z('[data-loader="postblog"]',(function(){i.e(369).then(i.bind(i,2396)).then((function(e){return new(0,e.default)({target:"postblog"})}))}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/pendencias"),(function(){e.pushTask((function(){i.e(209).then(i.bind(i,918)),i.e(369).then(i.bind(i,2396)).then((function(e){return new(0,e.default)({target:"blu365"})}))})),window.__moviedesk__&&e.pushTask((function(){new o("//chat.movidesk.com/Scripts/chat-widget.min.js").load()}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/atualizar-perfil"),(function(){e.pushTask((function(){Promise.all([i.e(234),i.e(32)]).then(i.bind(i,3765)).then((function(e){new(0,e.PersonalData)}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/atualizar-perfil/profissional"),(function(){e.pushTask((function(){Promise.all([i.e(234),i.e(813)]).then(i.bind(i,7191)).then((function(e){new(0,e.Professional)}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/atualizar-perfil/financeiro"),(function(){e.pushTask((function(){Promise.all([i.e(234),i.e(846)]).then(i.bind(i,1492)).then((function(e){(new(0,e.Financial)).mount()}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/atualizar-perfil/endereco"),(function(){e.pushTask((function(){Promise.all([i.e(234),i.e(577)]).then(i.bind(i,3223)).then((function(e){(new(0,e.Address)).mount()}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/atualizar-perfil/familia"),(function(){e.pushTask((function(){Promise.all([i.e(234),i.e(471)]).then(i.bind(i,3068)).then((function(e){new(0,e.Family)}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/atualizar-perfil/patrimonio"),(function(){e.pushTask((function(){Promise.all([i.e(234),i.e(889),i.e(789)]).then(i.bind(i,6052)).then((function(e){(new e.default).mount()}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/configuracoes/notificacoes"),(function(){e.pushTask((function(){Promise.all([i.e(234),i.e(909)]).then(i.bind(i,8386)).then((function(e){new(0,e.Notifications)}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/configuracoes/excluir-conta/escolher-motivo"),(function(){e.pushTask((function(){Promise.all([i.e(234),i.e(845)]).then(i.bind(i,9593)).then((function(e){new(0,e.ExcludeAccount)}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/favoritos"),(function(){e.pushTask((function(){i.e(369).then(i.bind(i,2396)).then((function(e){new(0,e.default)({target:"bookmarks-hints"})}))}))})),t.get("/".concat(we.SLUG_URL_PROJECT,"/produtos"),(function(){e.pushTask((function(){i.e(369).then(i.bind(i,2396)).then((function(e){new(0,e.default)({target:"already-have-hints"})}))}))})),e.pushTask((function(){return t.init()})),e.pushTask((function(){document.querySelector("#js-accept-lgpd")&&i.e(963).then(i.bind(i,6348)).then((function(e){e.default.show()}))})),window.LazyLoad=a.Z,window.AsyncModule=o}))}()}(); //# sourceMappingURL=main.077d080dddc5525e8d46.js.map