/* jssdk-video.instant.message.js 2024-11-12 10:01 230677ae799abcc4f69e92dc21458c7bf509c71d */
!function(){"use strict";var U=void 0;function F(e){return e&&document.cookie.length&&(e=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)")))&&e.length&&e[1]?decodeURIComponent(e[1]):U}var e=navigator.userAgent.toLowerCase(),$=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substring(0,4));var o=function(){return(o=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function X(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,a=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(i=a.next()).done;)r.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return r}function G(e,t,n){if(n||2===arguments.length)for(var i,o=0,a=t.length;o<a;o++)!i&&o in t||((i=i||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}var e={BASE_ROTATOR_URL: "//tsyndicate.com/do2/", IM_STYLE_URL: "//cdn.tsyndicate.com/sdk/v1/video.instant.message.v2.css",METRICS_COLLECTOR_URL: "////m.tsyndicate.com/ad_stat/ad_stat"},a=(e.METRICS_COLLECTOR_URL,"".concat(e.BASE_ROTATOR_URL,"{spot}/vast")),r=e.IM_STYLE_URL,c=12,l=25,d=10,s=30,u=10,m=3,p=20,h=5,v="",f="00:00:00",g=10,y="click",L="capped",A=0,M=5,S="Visit website",Y="AD",J={closeButton:"ts-im-button-close",progressBar:"ts-im-progress-bar",progressBarCurrent:"ts-im-progress-bar__current",redirectButton:"ts-im-ad-link",mainContainer:"ts-im-container",buttonSound:"ts-im-button-sound",buttonSoundPlay:"ts-im-button-sound_play",title:"ts-im-title",videoWrapper:"ts-im-video-wrapper",video:"ts-im-video",closeButtonDelay:"ts-im-button-close-delay",ctaButtonWrapper:"ts-im-button-cta-wrapper",ctaButton:"ts-im-button-cta",ctaButtonLabel:"ts-im-button-cta__label",ctaButtonSvg:"ts-im-button-cta__svg",ctaButtonIcon:"ts-im-button-cta__icon",ctaButtonHeadline:"ts-im-button-cta__headline",ctaButtonBrandname:"ts-im-button-cta__brandname",ctaButtonCompanyInfo:"ts-im-button-cta__companyinfo",ctaButtonCompanyTextInfo:"ts-im-button-cta__textcontent",ctaButtonIconBackup:"ts-im-button-cta__icon_backup",ctaButtonIconBackupLabel:"ts-im-button-cta__icon_backup_label"};var Q=function(e){var t,n,i=e.mediaFile,o=e.btnsHeight,a=e.width,e=e.widthInPercent,i=i.width/i.height;return e?(e=window.innerHeight*window.innerWidth*e/100,n=(t=o?(-(t=o*(o=i))+Math.sqrt(t*t+4*o*e))/(2*o):Math.sqrt(e/i))*i):t=(n=a)/i,{videoWidth:n,videoHeight:t}};function Z(e){var t=document.createElement("img");t.src=e,t.width=1,t.height=1,t.style.position="absolute",t.style.top="0",t.addEventListener("load",function(){return n(t)}),t.addEventListener("error",function(){return n(t)}),document.body.appendChild(t)}function n(e){var t;null!=(t=e.parentNode)&&t.removeChild(e)}function P(a,e){var t,n,i,o,r,c,l,d=a.width,s=a.contentTitle,R=a.countdownTimerInMillis,u=a.displayMode,m=a.cappedAction,p=a.cookieExpiresInMillis,W=a.cappedValueInMillis,h=a.cookieName,v=a.styleUrl,f=a.closeButtonDelayInMillis,g=a.hideOnComplete,y=a.showCTAButton,w=e.trackers,b=e.clickThroughTrackers,z=e.clickTrackers,k=e.mediaFiles,x=e.headline,C=e.brandname,e=e.staticResourceSrc,E=(y?ee:0)+(s?te:0),T="capped"===u,B=void 0===p,j="click"===m&&B,H="impression"===m||!B,O=Array.from(w),w=(u=v,(m=document.createElement("link")).type="text/css",m.rel="stylesheet",m.media="all",m.href=u,m),N=(document.head.appendChild(w),document.createElement("div"));N.className=J.mainContainer,N.style.visibility="hidden",(v=document.createElement("div")).className=J.videoWrapper;(u=document.createElement("div")).className=J.progressBar;var _=document.createElement("div"),I=(_.className=J.progressBarCurrent,u.appendChild(_),i=k[0],o=0,k.forEach(function(e){var t=Math.abs(e.width-d);t<o&&(i=e),o=t}),i),L=((m=document.createElement("source")).src=(null==I?void 0:I.url)||"",m.type=(null==I?void 0:I.type)||"",document.createElement("video")),A=(L.className=J.video,L.appendChild(m),L.controls=!1,L.autoplay=!0,L.muted=!0,L.setAttribute("playsinline",""),L.setAttribute("controlslist","nodownload"),L.addEventListener("timeupdate",function(){var n=L.currentTime,e=L.duration,e=Math.floor(100/e*n);_.style.width="".concat(e,"%"),O.forEach(function(e,t){Number(e.offset)<=n&&e.url&&(Z(e.url),O.splice(t,1))})},!1),L.addEventListener("loadeddata",function(){(function(){var e=I&&!I.width&&L.videoWidth,t=I&&!I.height&&L.videoHeight,n=e||t;e&&(I.width=L.videoWidth);t&&(I.height=L.videoHeight);n&&S()})(),N.style.visibility="visible",N.style.right="0",N.style.margin="0",N.style.transform="none",T&&H&&setTimeout(D,R)},!1),g&&L.addEventListener("ended",q,!1),document.createElement("div"));A.addEventListener("click",function(){L.muted=!L.muted,L.muted?A.className=J.buttonSound:A.className+=" ".concat(J.buttonSoundPlay)}),A.className=J.buttonSound;(w=document.createElement("div")).className=J.redirectButton,w.addEventListener("click",V);var M=document.createElement("div");function S(){var e,t,n,i,o;I&&I.width&&I.height&&(o=$?a.mobileWidthInPercent:a.widthInPercent,e=I.width/I.height,t=window.innerHeight*K-E,n=window.innerWidth*K,i=(o=Q({widthInPercent:o,width:d,mediaFile:I,btnsHeight:E})).videoWidth,o=o.videoHeight,L.style.removeProperty("max-height"),L.style.removeProperty("max-width"),t<=o&&n<=i?(L.style.maxHeight="".concat(t,"px"),L.style.maxWidth="".concat(n,"px"),L.style.removeProperty("height"),L.style.removeProperty("width"),N.style.width="".concat(n,"px"),P(n)):t<=o?(L.style.height="".concat(t,"px"),L.style.width="auto",N.style.width="".concat(o=t*e,"px"),P(o)):n<=i?(L.style.width="".concat(n,"px"),L.style.height="auto",N.style.width="".concat(n,"px"),P(n)):(L.style.width="".concat(i,"px"),L.style.height="auto",N.style.width="".concat(i,"px"),P(i)))}function P(e){n&&(e<ne?n.classList.add("hide_cta_icon"):n.classList.remove("hide_cta_icon")),t&&(e<ie?t.classList.add("hide_cta_info"):t.classList.remove("hide_cta_info"))}function V(){var e=b[0];window.open(e,"_blank"),z.forEach(Z),b.slice(1).forEach(function(e){Z(e)}),T&&j&&D()}function q(){var e=N.parentNode;e&&e.removeChild(N)}function D(){var e,t,n,i,o,a;F(h)||(e=h,t="1",i=(n=void 0===(n={lifetimeInMillis:B?W:p})?{}:n).lifetimeInMillis,o=n.domain,n=void 0===(n=n.path)?"/":n,a=null===t,i=i!==U?new Date((new Date).getTime()+i):U,e=["".concat(e,"=").concat(a?"":t),(i=(t=void 0===(t={expireDate:i,shouldDelete:a})?{}:t).expireDate,t.shouldDelete?"expires=Thu, 01 Jan 1970 00:00:00 GMT":i?"expires=".concat(i.toUTCString()):""),o?"domain=".concat(o):"","path=".concat(n)].filter(Boolean).join(";"),document.cookie=e)}M.className=J.closeButton,M.addEventListener("click",function(){q(),T&&j&&D()}),s&&(k=document.createElement("div"),m=document.createTextNode(s),k.className=J.title,k.appendChild(m),N.appendChild(k)),N.appendChild(v),N.appendChild(M),f&&(M.classList.add(J.closeButtonDelay),setTimeout(function(){M.classList.remove(J.closeButtonDelay),M.style.transition="all 5s ease"},f)),v.appendChild(A),v.appendChild(L),v.appendChild(w),v.appendChild(u),y&&((t=document.createElement("div")).className=J.ctaButtonWrapper,t.addEventListener("click",V),(g=document.createElement("div")).className=J.ctaButton,(s=document.createElement("div")).className=J.ctaButtonLabel,(m=document.createElement("div")).className=J.ctaButtonSvg,k=document.createTextNode("View more"),s.appendChild(k),g.appendChild(s),g.appendChild(m),(n=document.createElement("div")).className=J.ctaButtonCompanyInfo,e?((k=document.createElement("img")).className=J.ctaButtonIcon,k.src=e,n.appendChild(k)):((s=document.createElement("div")).className="".concat(J.ctaButtonIcon," ").concat(J.ctaButtonIconBackup),(m=document.createElement("div")).className=J.ctaButtonIconBackupLabel,k=document.createTextNode(Y),m.appendChild(k),s.appendChild(m),n.appendChild(s)),(k=document.createElement("div")).className=J.ctaButtonCompanyTextInfo,x&&((m=document.createElement("div")).className=J.ctaButtonHeadline,s=document.createTextNode(x),m.appendChild(s),k.appendChild(m)),C&&((s=document.createElement("div")).className=J.ctaButtonBrandname,m=document.createTextNode(C),s.appendChild(m),k.appendChild(s)),n.appendChild(k),t.appendChild(n),t.appendChild(g),N.appendChild(t)),S(),document.body.appendChild(N),window.addEventListener("resize",(r=S,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];l&&window.clearTimeout(l),l=window.setTimeout(function(){r.apply(void 0,G([],X(e),!1))},c)}),!(c=400))}var K=.8,ee=64,te=14,ne=350,ie=250;function w(e,t,n){var i=new XMLHttpRequest;i.onreadystatechange=function(){4===i.readyState&&200===i.status&&t(i.responseXML)},i.onerror=n,i.open("GET",e,!0),i.send()}var b=function(e){return e.map(function(e){return null==e?void 0:e.trim()}).filter(Boolean).join(",").replace(/,+/g,",").replace(/\s*,\s*/g,",").replace(/\s+/g," ").replace(/^,|,$/g,"")};var k=["param1","param2","param3","subid","subid_1","subid_2","subid_3","subid_4","subid_5","subid_6","extid","xhid","abt","xoc","xvr","xsrc","xprf","xch","xou","xma","xtype","cookie","xu"];function D(e){var e=void 0===(e=(e||{}).collectFromPath)||e,t=function(){for(var e=document.getElementsByTagName("meta"),t=[],n=0;n<e.length;n++){var i=e[n].getAttribute("name");"description"!==i&&"keywords"!==i||(i=e[n].getAttribute("content"))&&t.push(i)}return t}();return document.title&&t.push(document.title),e&&t.push.apply(t,G([],X((e=(e=window.location.pathname.split("/"))[e.length-1].split(/[?#]/)[0])&&e.replace(/(x?html?)$/gi,"").match(/([a-zA-Z0-9]+)/g)||[]),!1)),b(t)}function i(e){var t,n,i,o,a=[(n=e,o=void 0===(i=(void 0===(i={fallbackValues:{param3:"video.instant.message.js"}})?{}:i).fallbackValues)?{}:i,k.map(function(e){var t;return[e,null!=(t=n[e])?t:o[e]]}).map(function(e){var t=(e=X(e,2))[0];return(e=e[1])?"".concat(t,"=").concat(e):""}).filter(Boolean).join("&")),(i={keywords:[e.keywords,D()],charLimitCount:1e3},a=i.keywords,t=i.charLimitCount,i=i.queryParamKey,(a=b(a).substring(0,t))?"".concat(i||"keywords","=").concat(encodeURIComponent(a)):void 0),(t=void 0===(t=window.devicePixelRatio)?1:t,(i=window.screen)&&i.width&&i.height?(a=i.width*t,i=i.height*t,"w=".concat(a,"&h=").concat(i)):U),(t=(new Date).getTimezoneOffset(),"tz=".concat(t).replace("-","%2D"))].filter(Boolean).join("&");return"".concat(e.urlTemplate.replace("{spot}",e.spot),"?t=im-slider&").concat(a)}var R="VASTAdTagURI",W="ClickThrough",z="Linear",j="Duration",H="MediaFile",O="Tracking",V="Impression",q="ClickTracking",oe="AdParameters",ae="CTABrandname",re="Headline",ce="StaticResource",x=1e3,C=60*x,le=60*C,E=function(e){e=new Date("1970-01-01T".concat(e||f,"Z"));return 60*e.getMinutes()+e.getSeconds()};function T(e,t){var n=[];return Array.from(e.getElementsByTagName(t)).forEach(function(e){e.textContent&&n.push(e.textContent)}),n}function de(n){var i=[],e=S,t="",o=Array.from(n.getElementsByTagName(R)),a=Array.from(n.getElementsByTagName(j)),r=E((null==(a=a[0])?void 0:a.textContent)||""),a=null==(a=Array.from(n.getElementsByTagName(z))[0])?void 0:a.attributes.getNamedItem("skipoffset"),c=Array.from(n.getElementsByTagName(oe)),l=(null==(l=c[0])?void 0:l.attributes.getNamedItem("xmlEncoded"))||(null==(l=c[0])?void 0:l.attributes.getNamedItem("XmlEncoded")),c=null==(c=c[0])?void 0:c.textContent;function d(e){var i=[];return Array.from(n.getElementsByTagName(e)).forEach(function(e){var t,n;e.textContent&&(t=(null==(t=e.attributes.getNamedItem("event"))?void 0:t.value)||"start",n=(null==(n=e.attributes.getNamedItem("offset"))?void 0:n.value)||"",n="start"===t?0:s(n),i.push({event:t,offset:n,url:e.textContent}))}),i}function s(e){var t;return/%/.test(e=void 0===e?f:e)?(t=parseInt(e,10),Math.ceil(r*t/100)):E(e)}function u(e,t){return void 0===t&&(t=n),(null==(t=Array.from(t.getElementsByTagName(e))[0])?void 0:t.textContent)||""}return l&&c&&(l=c,c=(new DOMParser).parseFromString(l,"text/xml"),e=u(ae,c)||e,t=u(re,c)),Array.from(n.getElementsByTagName(H)).forEach(function(e){var t;e.textContent&&i.push({url:e.textContent,type:(null==(t=e.attributes.getNamedItem("type"))?void 0:t.value)||"",width:Number((null==(t=e.attributes.getNamedItem("width"))?void 0:t.value)||"0"),height:Number((null==(t=e.attributes.getNamedItem("height"))?void 0:t.value)||"0")})}),{mediaFiles:i,durationInSeconds:r,url:(null==(l=o[0])?void 0:l.textContent)||"",skipOffset:s(null==a?void 0:a.value),clickTrackers:T(n,q),clickThroughTrackers:T(n,W),staticResourceSrc:u(ce),trackers:d(O),impressions:d(V),brandname:e,headline:t}}function B(e,t){return"boolean"==typeof e?e:t}function N(e,t){return"number"!=typeof e&&"string"!=typeof e||(e=Number(e),!Number.isFinite(e))?t:e}function _(e,t){return N(String(e).replace(/[\s%]/g,""),t)}function se(e){var t,n,i;if(e.spot&&"string"==typeof e.spot)return n=(t=function(e){if(e&&typeof e==="number")return{width:e,widthInPercent:null};var t=N(e,0);if(t)return{width:t,widthInPercent:null};var n=_(e,u),i=n<=p&&n>=m?n:u,o;return{width:document.documentElement.clientWidth/100*i,widthInPercent:i}}(e.width)).widthInPercent,t=t.width,o(o({},(i=e,k.reduce(function(e,t){var n=i[t];return e[t]="number"==typeof n&&!Number.isNaN(n)||"string"==typeof n&&""!==n?String(n):U,e},{}))),{widthInPercent:n,width:t,spot:e.spot,cookieName:I(e.cookieName,"ts_video_instant_message"),cookieExpiresInMillis:function(e){if(null!=e&&""!==e)return N(e,c)*le}(e.cookieExpires),urlTemplate:I(e.vastLink,a),styleUrl:I(e.styleLink,r),countdownTimerInMillis:N(e.countdownTimer,h)*x,contentTitle:(n=e.content)&&"object"==typeof n&&n.title&&"string"==typeof n.title?String(n.title||v):v,keywords:String(e.keywords||""),displayMode:"capped"!==(t=e.displayMode)&&"uncapped"!==t?L:t,cappedAction:"click"!==(n=e.cappedAction)&&"impression"!==n?y:n,cappedValueInMillis:N(e.cappedValueInMinutes,g)*C,closeButtonDelayInMillis:function(e){e=N(e,A);return Math.min(e,M)*x}(e.closeButtonDelay),hideOnComplete:B(e.hideOnComplete,!1),showCTAButton:B(e.showCTAButton,!0),mobileWidthInPercent:(t=e.mobileWidth,(n=_(t,l))<=s&&d<=n?n:l),url:e.url});console.warn("TS: no spot provided")}function I(e,t){return e&&"string"==typeof e?e:t}window.TSVideoInstantMessage=function(e){var t,n=se(e);n&&(e=Boolean(F(n.cookieName)),t=document.createElement("video").canPlayType,!e)&&t&&w(n.url||i(n),function(e){!function t(n,e,i){if(!e)return;var o=de(e);o.impressions.forEach(function(e){e.url&&Z(e.url)});i&&(o.trackers=i.trackers,o.clickTrackers=i.clickTrackers);if(o.url)return void w(o.url,function(e){t(n,e,o)},function(){console.error("TS: error while loading data")});P(n,o)}(n,e)},function(){console.error("TS: error while loading data")})}}();