"use strict";(self.webpackChunkaem_maven_archetype=self.webpackChunkaem_maven_archetype||[]).push([[38455],{54670:function(e,t,i){i.r(t),i.d(t,{default:function(){return v}});var l=i(85254),a=i(97650),o=i(49995),n=i(396),s=i(31477),r=i(47430),c=i(53627),d=i(95049),h=i(15450),u=function(e,t,i,l){return new(i||(i=Promise))((function(a,o){function n(e){try{r(l.next(e))}catch(e){o(e)}}function s(e){try{r(l.throw(e))}catch(e){o(e)}}function r(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(n,s)}r((l=l.apply(e,t||[])).next())}))};class v{constructor(e){this.getTitle=(e,t,i)=>{var l,a;return i.includes(null===(l=t.closest(e).previousElementSibling)||void 0===l?void 0:l.nodeName)&&t.closest(e).previousElementSibling?null===(a=t.closest(e).previousElementSibling)||void 0===a?void 0:a.textContent.trim():""},this.getSectionTitle=(e,t)=>{var i,l;e.closest("ul")&&"UL"===e.closest("ul").nodeName&&(this.sectionTitle=this.getTitle(e.closest("ul").nodeName.toLowerCase(),e,t)),e.closest("ol")&&"OL"===e.closest("ol").nodeName&&(this.sectionTitle=this.getTitle(e.closest("ol").nodeName.toLowerCase(),e,t)),e.closest("p")&&"P"===e.closest("p").nodeName&&(this.sectionTitle=t.includes(null===(i=e.parentElement.previousElementSibling)||void 0===i?void 0:i.nodeName)?null===(l=e.parentElement.previousElementSibling)||void 0===l?void 0:l.textContent.trim():"")},this.handleLinkClick=(e,t,i)=>{var l;const a={targetLink:e,event_click:"link_click",component:"article_body",target:"article_body_desc_cta",cta_text:e.textContent.trim().replace("\n",""),sec_title:t.trim()?t.trim():i||""};if(e.closest("p")&&e.closest("p").classList.contains("text--note")){const e=Object.assign(Object.assign({},a),{sec_title:null===(l=this.el.querySelector(".text--note span"))||void 0===l?void 0:l.textContent.split(":")[0].trim().toLocaleLowerCase()});(0,o.Z)(e)}else(0,o.Z)(a)},this.handleCleverTapEvent=e=>{var t,i;const l={EP_PAGE_URL:`${window.location.host}${window.location.pathname}`,EP_COMPONENT_NAME:"Article Details Card",EP_CTA:e.textContent.trim().replace("\n","")},a=`${"articles"===(null===(t=(0,s.C2)("tag-1"))||void 0===t?void 0:t.toLowerCase())?"ARTICLE":null===(i=(0,s.C2)("tag-1"))||void 0===i?void 0:i.toUpperCase()}_${d.D}`;(0,h.L)(a,l)},this.handleShareIconClick=e=>{e&&e.forEach((e=>{e.onclick=()=>{const t={component:"article_body",event_click:"link_click",target:"article_body_share",cta_text:e.textContent.trim()};(0,o.Z)(t)}}))},this.handleSocialMediaIconClick=e=>{e&&e.forEach(((e,t)=>{e.onclick=()=>{const i={targetLink:e,index:t+1,component:"article_body",event_click:"icon_click",target:"article_body_share_icon",cta_text:e.getAttribute("title")};(0,o.Z)(i)}}))},this.videoPlayDatalayer=(e,t,i)=>{const l={component:"insight_article_detail",event_click:"video_click",target:"insight_video_click",sub_section:e,section_title:t,cta_text:""};i&&i.addEventListener("click",(()=>{i.style.display="none",window[e].playVideo(),(0,o.Z)(l)}))},this.checkScroll=e=>!(e.getBoundingClientRect().bottom>0&&e.getBoundingClientRect().top<(window.innerHeight||document.documentElement.clientHeight)),this.handleVideoPlay=(e,t,i,l,a)=>{r.tq&&e?(0,r.LM)([e],"modal--video-lg"):(t&&window.addEventListener("scroll",(()=>{var e;this.checkScroll(t)&&"none"===window.getComputedStyle(i).display&&(null===(e=window[l])||void 0===e||e.pauseVideo())})),this.videoPlayDatalayer(l,a,i))},this.updateView=(e,t,i)=>{this.el.querySelector(".card-article-details .card-article-details__heading .view-read-row__view").innerHTML=e||"",(null==i?void 0:i.length)&&i.forEach((e=>{e.querySelector(".related-articles__lists__desc .view-read-row__view").classList.remove("loading");const i=()=>{for(let i=0;iu(this,void 0,void 0,(function*(){var c;try{const{data:n}=yield(0,l.default)({method:"POST",url:`${a.$b}/api/v1/dynamicviews`,data:{current:{pageUrl:window.location.pathname,pageType:null==t?void 0:t.toUpperCase(),isIncreased:!0},related:i,_csrf:(0,s.ej)("CSRFtoken")},withCredentials:!0});e.classList.remove("loading"),this.updateView(n.data.current.views,n.data.related,o)}catch(l){if(403===(null===(c=l.response)||void 0===c?void 0:c.status)&&this.allow){this.allow=!1;try{yield(0,n.Mt)(),this.getViews(e,t,i,o,r)}catch(e){this.updateView(r,i,o)}}else e.classList.remove("loading"),this.updateView(r,i,o)}})),this.updateCSRFAndGetView=(e,t,i,l,a)=>u(this,void 0,void 0,(function*(){try{yield(0,n.Mt)(),this.getViews(e,t,i,l,a)}catch(e){this.updateView(a,i,l)}})),this.generateArticleList=(e,t)=>{(null==e?void 0:e.length)&&e.forEach((e=>{this.relatedlist.push({pageUrl:e.querySelector("a").pathname,views:e.querySelector(".view-read-row__view").getAttribute("data-articleViews"),pageType:null==t?void 0:t.toUpperCase()}),e.querySelector(".related-articles__lists__desc .view-read-row .view-read-row__view").innerHTML=""}))},this.getPageType=e=>{e.forEach(((t,i)=>{"tag-1"===e[i].getAttribute("name")&&(this.page_type=e[i].getAttribute("content"))}))},this.initialize=()=>{var e,t;const i=null===(e=document.querySelector(".web-banner__title"))||void 0===e?void 0:e.textContent.trim();Array.from(this.el.querySelectorAll(".card-article-details .card-article-details__description a")).forEach((e=>{e.onclick=e=>{const t=e.target.closest("a");this.getSectionTitle(t,["H1","H2","H3","H4","H5","H6"]),this.handleLinkClick(t,this.sectionTitle,i),this.handleCleverTapEvent(t)}}));const l=Array.from(this.el.querySelectorAll(".card-article-details .share-action .share-action__button"));this.handleShareIconClick(l);const a=Array.from(this.el.querySelectorAll(".card-article-details .share-action__social-medias a"));this.handleSocialMediaIconClick(a);const o=Array.from(document.getElementsByTagName("meta"));this.getPageType(o);const n=this.el.querySelector(".card-article-details .card-article-details__heading .view-read-row__view");n.innerHTML="";const r=n.getAttribute("data-articleViews"),c=Array.from(document.querySelectorAll(".related-articles .related-articles__lists .related-articles__lists__item"));this.generateArticleList(c,this.page_type),(0,s.ej)("CSRFtoken")?this.getViews(n,this.page_type,this.relatedlist,c,r):this.updateCSRFAndGetView(n,this.page_type,this.relatedlist,c,r);const d=this.el.querySelector(".card-article-details__video-block"),h=null==d?void 0:d.querySelector(".card-article-details__kpoint-video-player"),u=null==d?void 0:d.querySelector(".card-article-details__video-block-overlay"),v=null===(t=null==h?void 0:h.getAttribute("data-kvideo-id"))||void 0===t?void 0:t.trim();this.handleVideoPlay(d,h,u,v,this.sectionTitle)},this.el=e,this.allow=!0,this.relatedlist=[],this.page_type="",this.sectionTitle="",this.el.querySelector("[data-video-id]")?(0,c.N)(this.el,(()=>{this.initialize()})):this.initialize()}}v.init=e=>new v(e)},53627:function(e,t,i){i.d(t,{N:function(){return a}});var l=i(35887);const a=(e,t)=>{const i=document.createElement("script");i.type="text/javascript",i.src="https://assets.kpoint.com/orca/media/embed/videofront-vega.js",i.async=!0;const l=e.querySelector("script");(null==l?void 0:l.src.includes("player-silk"))&&e.removeChild(l);void 0===Array.from(document.querySelectorAll("script")).find((e=>"https://assets.kpoint.com/orca/media/embed/videofront-vega.js"===e.src))?(document.body.append(i),i.onload=()=>{t()}):t()};(0,l.YV)()}}]);